wighawag / hardhat-deploy

hardhat deployment plugin
MIT License
1.19k stars 292 forks source link

Verifying openzeppelin TransparentUpgradeableProxy contract on Moonbase-Alpha #310

Open gtsui opened 2 years ago

gtsui commented 2 years ago

Describe the bug I'm using openzeppelin's TransparentUpgradeableProxy for my smart contract which I am trying to launch on Moonbase-Alpha, the testnet for Moonbeam, but have not been able to find a way to make it work. In particular, I am not able to verify the PROXY contract (as opposed to the implementation contract).

To Reproduce Steps to reproduce the behavior:

I'm trying: npx hardhat --network moonbase etherscan-verify

and get the following errors:

verifying DefaultProxyAdmin (0x042b86A2416390Eb9E97A2C4fc5154008AB1eEBa) ...
contract DefaultProxyAdmin failed to submit : "NOTOK" : "Error! Missing Or invalid Module name" [object Object]
verifying [PROXYCONTRACT] (0xa3aD0738eB57a552748bfC88754C3670eF628b14) ...
contract [PROXYCONTRACT] failed to submit : "NOTOK" : "Error! Missing Or invalid Module name" [object Object]

If I try running the exact same command a second time I start getting the below error:

SyntaxError: Unexpected token W in JSON at position 0
SyntaxError: Unexpected token W in JSON at position 0
SyntaxError: Unexpected token W in JSON at position 0
SyntaxError: Unexpected token W in JSON at position 0

I've also tried to manually verify it on moonscan with the solc-input.json file from openzeppelin but also no luck, as well as using the json file inside deployments/moonbase/solcInput (should i select compiler version and #runs on moonscan to be the same as the settings in my hardhat.config.js here?).

I can use the hardhat-etherscan plugin to verify my implementation contract perfectly fine, and that works on Ethereum testnets where the proxy contract seems to already be verified by virtue of similar contracts. However, it seems like on Moonbase Alpha is a less used chain so there is no prior verification of the proxy contract. How can I go about verifying that?

versions

This is my hardhat.config.js

  solidity: {
    version: "0.8.9",
    settings: {
      optimizer: {
        enabled: true,
        runs: 200
      }
    }
  },
.
.
.
  networks: {
    moonbase: {
      url: process.env.PROVIDER_MOONBASE,
      chainId: 1287,
      accounts: process.env.KEYS.split(","),
      timeout: 120000000,
      verify: {
        etherscan: {
          apiUrl: "http://moonbase.moonscan.io",
          apiKey: process.env.MOONSCAN_APIKEY
        }
      }
    }

My dependencies versions:

  "devDependencies": {
    "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13",
    "@nomiclabs/hardhat-etherscan": "^3.0.3",
    "@nomiclabs/hardhat-waffle": "^2.0.3",
    "chai": "^4.3.6",
    "chai-ethers": "^0.0.1",
    "dotenv": "^16.0.0",
    "ethereum-waffle": "^3.4.0",
    "ethers": "^5.6.4",
    "hardhat": "^2.9.1",
    "hardhat-deploy": "^0.11.4",
    "hardhat-gas-reporter": "^1.0.7",
    "mocha": "^9.2.2",
    "sol-merger": "^3.1.0",
    "solidity-docgen": "^0.6.0-beta.10",
    "web3": "^1.7.3"
  },
  "dependencies": {
    "@openzeppelin/contracts-upgradeable": "^4.5.2",
    "@openzeppelin/hardhat-upgrades": "^1.16.0"
  }

Additional context For reference this is my proxy contract address on https;//moonbase.moonscan.io:

0xa3aD0738eB57a552748bfC88754C3670eF628b14

And the implementation contract address: 0xfE7e2E9e49a1E51387882c263b34cd3f1BE7e226