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.
doctopus
  • 315
  • 2
  • 9
  • Does the library implement MiMCSponge or any other public function? – Ismael Apr 09 '21 at 04:59
  • No it doesn't which I found weird. For some background, this is Tornado Cash's contracts: https://github.com/tornadocash/tornado-core. I can deploy it with truffle, but I'm trying to get it deployed with hardhat instead – doctopus Apr 09 '21 at 15:05
  • I don't have time to check what it is doing, but it seems it uses circom to generate the hasher https://github.com/tornadocash/tornado-core/blob/master/compileHasher.js. – Ismael Apr 09 '21 at 19:05

0 Answers0