3

1. Dry run deploy

Migrations dry-run (simulation)
.....
> Total deployments:   2
> Final cost:          0.058258696 ETH

That's $83.83

2. Do I have $83.83? Yes I do. enter image description here

3. Double check mainNet configs (truffle-config.js):

  • Current gas in Gwei 105 (105000000000 Wei)
  • Final cost was 0.058258696 ETH (58258696000000000 Wei)

Plug these numbers in:

 mainnet: {
      provider: () =>
        new HDWalletProvider({
          mnemonic: { phrase: process.env.MNEMONIC },
          providerOrUrl: process.env.RPC_URL_1,
        }),
      network_id: 1,
      from: process.env.DEPLOYERS_ADDRESS,
      gas: 58258696000000000, 
      gasPrice: 105000000000,
      confirmations: 2, 
      timeoutBlocks: 200,
      skipDryRun: false, 
    },

4. Time to deploy

truffle migrate --network mainnet


Result:

Error:  *** Deployment Failed ***

"Migrations" could not deploy due to insufficient funds

So, I've...

  1. Run the dry run, gotten the estimate cost of deploying the contract. Plugged that value in.
  2. Got the current cost of Gas. Plugged that in.
  3. Ran the contract
  4. The deployment fails

Is there anything I'm missing here?

GN.
  • 8,672
  • 10
  • 61
  • 126

1 Answers1

1

Your Gas value looks incorrect. Check Dry Run Output, you will see > gas used: 4390736 (example number) or deploy contract to a test network or https://remix.ethereum.org to have an idea of gas used, then update gas in truffle-config.js

iper
  • 46
  • 3