首页 > 解决方案 > 有没有办法获取特定合约地址的库地址?

问题描述

我们有一个智能合约工厂,用于部署智能合约实例。

这些智能合约实例使用 SafeMath。

我们想在 Etherscan 上验证这些实例的代码。

但是,Etherscan 需要 SafeMath 库地址来验证合约代码。

问题是如何获取每个实例的 SafeMath 库地址。

标签: ethereumsolidityweb3

解决方案


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


推荐阅读