2

So I have this library:

library Hasher {
  function MiMCSponge(uint256 in_xL, uint256 in_xR) public pure returns (uint256 xL, uint256 xR);
}

And I'm trying to deploy it:

const Hasher = await hre.ethers.getContractFactory('Hasher')
const hasher = await Hasher.deploy()

But I get this error:

NomicLabsHardhatPluginError: You are trying to create a contract factory for the contract Hasher, which is abstract and can't be deployed.
If you want to call a contract using Hasher as its interface use the "getContractAt" function instead.
3
  • Does the library implement MiMCSponge or any other public function?
    – Ismael
    Apr 9, 2021 at 4:59
  • No it doesn't which I found weird. For some background, this is Tornado Cash's contracts: github.com/tornadocash/tornado-core. I can deploy it with truffle, but I'm trying to get it deployed with hardhat instead
    – doctopus
    Apr 9, 2021 at 15:05
  • I don't have time to check what it is doing, but it seems it uses circom to generate the hasher github.com/tornadocash/tornado-core/blob/master/….
    – Ismael
    Apr 9, 2021 at 19:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.