Support multi file verification on Etherscan using Truffle.
This is instead of flattening contracts.
Flattened contracts:
Verify the following contract inheriting from OpenZeppelin Contracts v3.2.0
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
/**
* @title SimpleToken
* @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
* Note they can later distribute these tokens as they wish using `transfer` and other
* `ERC20` functions.
*/
contract SimpleToken is ERC20 {
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public ERC20("Simple Token", "SIM") {
_mint(msg.sender, 100000000 * (10**uint256(decimals())));
}
}
Ideally the contract would be verified as multiple files.
The following example shows the six files that make up the contract:
https://rinkeby.etherscan.io/address/0x3fFfF0a40E2E3152ab35D78cC49218dD2C35c6cc#code
The contract was verified using https://github.com/nomiclabs/buidler/tree/development/packages/buidler-etherscan which ideally there would be a Truffle plugin that supports multi file verification.
https://github.com/rkalis/truffle-plugin-verify flattens the contracts, removes SPDX License Identifiers and replaces with a single SPDX License Identifier and removes imports so that the contract can compile.
The following example shows a single flattened file for the contract:
https://rinkeby.etherscan.io/address/0x5D226974f9ce71179a68B8EDcC7EeE99df8FC3C5#code
$ npx truffle version
Truffle v5.1.44 (core: 5.1.44)
Solidity - 0.6.12 (solc-js)
Node v10.21.0
Web3.js v1.2.1
Thanks for the feature request! Hey @rkalis, any chance you had any plans to support this kind of thing? This is definitely something that we would like to support in the future. If not in a plugin, then somehow in Truffle itself.
That would be awesome! @abcoathup, would you mind opening this issue on the truffle-plugin-verify repo? Would love to support that in the future!
HI @abcoathup, thanks for bringing this up! We're closing this issue for maintenance, as it sounds like it will be addressed in the truffle-plugin-verify repo.
Most helpful comment
That would be awesome! @abcoathup, would you mind opening this issue on the truffle-plugin-verify repo? Would love to support that in the future!