rkalis / truffle-plugin-verify

✅ Verify your smart contracts on Etherscan from the Truffle CLI
https://kalis.me/verify-truffle-smart-contracts-etherscan/
MIT License
467 stars 130 forks source link

Cannot read properties of undefined (reading "address") during verification #203

Closed malm0d closed 1 year ago

malm0d commented 1 year ago

After compiling and deploying my contract on avalanche testnet (fuji), I tried to verify my contract using Truffle Verify but after running truffle run verify BatchTransfer --network fuji --debug, I get the following output:

DEBUG logging is turned ON
Running truffle-plugin-verify v0.6.3
Retrieving network's network ID & chain ID
Verifying contracts on snowtrace
   Verifying BatchTransfer
   Resolving artifact for contract BatchTransfer
   Cannot read properties of undefined (reading 'address')
   Failed to verify 1 contract(s): BatchTransfer
Verifying contracts on sourcify
   Fetching supported chains from https://sourcify.dev/server/chains
   Verifying BatchTransfer
   Resolving artifact for contract BatchTransfer
   Cannot read properties of undefined (reading 'address')
   Failed to verify 1 contract(s): BatchTransfer

This is my truffle-config.js file:

require('dotenv').config();
const mnemonic = process.env.MNEMONIC;
const snowtracefujiapikey = process.env.SNOWTRACEFUJIINFURAURL;

const HDWalletProvider = require('@truffle/hdwallet-provider');

module.exports = {
  networks: {
    fuji: {
      provider: () => new HDWalletProvider(mnemonic, snowtracefujiapikey, 1),
      network_id: "43113",
      gas: 5000000,
      networkCheckTimeout: 1000000,    
      timeoutBlocks: 200,
    }
  },

  // Set default mocha options here, use special reporters etc.
  mocha: {
    // timeout: 100000
  },

  // Configure your compilers
  compilers: {
    solc: {
      version: "0.8.13",      // Fetch exact version from solc-bin
    }
  },

  //plugins
  plugins: ["truffle-plugin-verify"],

  //API keys
  api_keys: {
    testnet_snowtrace: snowtracefujiapikey
  }
};

I cant tell whats the error since everything on my contract compiled correctly. Can anyone assist me in troubleshooting this issue?

malm0d commented 1 year ago

It worked when I ran npx truffle run verify BatchTransfer --network fuji --debug.

pmdyy commented 1 year ago

It worked when I ran npx truffle run verify BatchTransfer --network fuji --debug.

That worked for me. I'm not sure why, but thanks.