0

i have a following structure for my contracts : 1 - OpenZeppelin v 4.9 2 - safepool 3 - safepoolfactory i have a single file that this code :

pragma solidity ^0.8.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.9/contracts/token/ERC20/ERC20.sol";

contract SafePool {
constructor(string memory _name, address Owner ,address TokenAddress) {
        name = _name;
        owner = Owner;
        token_address = TokenAddress;
    }
//other codes
}

contract SafePoolFactory {
 constructor(address Token_Address)  {
        _owner = msg.sender;
        token_address = Token_Address;
    }
//other codes
}

i have deployed and verifyed safepool factory contract then i have tried to create 10 safe pools and transfered some matic to them but now i want to verify contracts but everythings i have tried dosent work i have tried to use safepool factory code , safepool and factory code to gether and in final i have tried flattened file with 3 contracts in single file and dosent worked also i have tried remix verify plugins and dosent worked again please help me to verify this contracts thanks

1 Answer 1

0

You can verify using tool like Foundry or Hardhat, after compiling the contract that’s being created by your factory contract.

Using Foundry:

  1. Compile the contract:

    forge compile
    
  2. Then, you can use the forge verify-contract command like this:

    forge verify-contract \
        --chain-id 11155111 \
        --num-of-optimizations 1000000 \
        --watch \
        --constructor-args $(cast abi encode "constructor(string,string,uint256,uint256)" "ForgeUSD" "FUSD" 18 1000000000000000000000) \
        --etherscan-api-key <your_etherscan_api_key> \
        --compiler-version v0.8.10+commit.fc410830 \
        <the_contract_address> \
        src/MyToken.sol:MyToken 
    

Using Hardhat:

  1. Compile the contract:

    npx hardhat compile
    
  2. Then, you can use the hardhat-verify plugin, and verify the contract using command like this:

    npx hardhat verify --network NETWORK_NAME DEPLOYED_CONTRACT_ADDRESS "Constructor argument 1" "Constructor argument 2"
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.