EatTheBlocks Forum

Migration deployment flashloans - run out of gas

I am trying to deploy the flashloan. The 20 Gwei set into the code, it is too low today, so I had to increase it to 95 Gwei. Doing so I get the following error:
Error: *** Deployment Failed ***

“Flashloan” ran out of gas (using a value you set in your network config or deployment parameters.)

  • Block limit: 12432948 (0xbdb634)
  • Gas sent: 1250000 (0x1312d0)

This would mean that I need to increase the balance on the wallet. Is it normal? Based on this at current gas prices it would cost around $500, it seems a bit high.

Am I doing something wrong or is there a way I control and reduce the total cost?

Your gas price was probably too low. When gas fees are high, you can wait for them to go down.

Thank you.
I have increased the balance in the wallet but it still says that there are insufficient funds even if now there are 0.3439 ETH
How much does it cost to deploy the contract?
Could you please have a look at the below log and let me know if you see something incorrect and how much do you think it is needed to deploy the contract?

Compiling your contracts…

Everything is up to date, there is nothing to compile.

Migrations dry-run (simulation)

Network name: ‘mainnet-fork’
Network id: 1
Block gas limit: 12475564 (0xbe5cac)

1_initial_migration.js

Deploying ‘Migrations’

block number: 12181348
block timestamp: 1617648138
account: 0x930D3256F7BF764437294016De5a357529404570
balance: 0.326882624
gas used: 176931 (0x2b323)
gas price: 96 gwei
value sent: 0 ETH
total cost: 0.016985376 ETH


Total cost: 0.016985376 ETH

2-deploy-contracts.js

Deploying ‘Flashloan’

block number: 12181350
block timestamp: 1617648152
account: 0x930D3256F7BF764437294016De5a357529404570
balance: 0.115146368
gas used: 2178248 (0x213cc8)
gas price: 96 gwei
value sent: 0 ETH
total cost: 0.209111808 ETH


Total cost: 0.209111808 ETH

Summary

Total deployments: 2
Final cost: 0.226097184 ETH

Starting migrations…

Network name: ‘mainnet’
Network id: 1
Block gas limit: 12487746 (0xbe8c42)

1_initial_migration.js

Deploying ‘Migrations’

Error: *** Deployment Failed ***

“Migrations” could not deploy due to insufficient funds

  • Account: 0x930D3256F7BF764437294016De5a357529404570
  • Balance: 343868000000000000 wei
  • Message: insufficient funds for gas * price + value
  • Try:
    • Using an adequately funded account
    • If you are using a local Geth node, verify that your node is synced.
at /usr/local/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:365:1
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at Migration._deploy (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:74:1)
at Migration._load (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:61:1)
at Migration.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:212:1)
at Object.runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
at Object.runFrom (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
at Object.runAll (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:114:1)
at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:79:1)
at runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:263:1)
at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:226:1)
at Command.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:140:1)

Truffle v5.3.0 (core: 5.3.0)
Node v14.16.0

I dont see anything incorrect.
The deployment cost can be just 50 USD or less when gas is low, or much more when gas is high.
So I would suggest to wait until gas is low and try again :slight_smile: