有没有办法获取特定合约地址的图书馆地址?

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

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

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

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

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

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

SafeMath 函数都是内部函数。没有外部库到link到。因此无需指定用于 Etherscan 验证的库。

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.

您也可以在社区论坛上询问有关使用 OpenZeppelin 的问题:https://forum.openzeppelin.com

披露:我是 OpenZeppelin 的社区经理