ethereumsolidityweb3jsetherscan

Is there any way to get the address of the library for a specific contract address?


We have a smart contract factory which deploys smart contract instances. These smart contract instances use SafeMath.

We want verify code for these instance on Etherscan. But, Etherscan requires SafeMath library address to verify contract code.

How can I get the SafeMath library address for each instance?


Solution

  • SafeMath functions are all internal. There is no external library to link to. Hence no need to specify a library for Etherscan verification.

    https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol

    https://solidity.readthedocs.io/en/latest/contracts.html#libraries
    ... code of internal library functions and all functions called from therein will at compile time be pulled into the calling contract, and a regular JUMP call will be used instead of a DELEGATECALL.

    You can also ask questions about using OpenZeppelin on the Community Forum: https://forum.openzeppelin.com

    Disclosure: I am the Community Manager at OpenZeppelin