Any idea what can cause this to happen?
$ npx oz balance
? Enter an address to query its balance 0x....
? Pick a network development
Balance: 113353818.74917066 ETH
✖ Validating and deploying contract
deployment failed with error: Returned error: sender doesn't have enough funds to send tx. The upfront cost is: 180143985094819820000000000 and the sender's account only has: 113353818749170660000000000
2 Likes
Hi @CrackerHax,
My first thought is that gasPrice
is set very high in network.js
.
Are you able to share your network.js
?
I was able to reproduce by setting the gasPrice
to 5e18
.
Deploy
Fails with high gas price.
$ npx oz deploy
Nothing to compile, all contracts are up to date.
? Choose the kind of deployment regular
? Pick a network development
? Pick a contract to deploy Box
✖ Deploying an instance of Box
Returned error: sender doesn't have enough funds to send tx.
The upfront cost is: 25000000000000000000000000 and the sender's account only has: 100000000000000000000
network.js
Default gasPrice is 5e9
.
module.exports = {
networks: {
development: {
protocol: 'http',
host: 'localhost',
port: 8545,
gas: 5000000,
gasPrice: 5e18,
networkId: '*',
},
},
};
Box.sol
// contracts/Box.sol
pragma solidity ^0.5.0;
contract Box {
uint256 private value;
// Emitted when the stored value changes
event ValueChanged(uint256 newValue);
// Stores a new value in the contract
function store(uint256 newValue) public {
value = newValue;
emit ValueChanged(newValue);
}
// Reads the last stored value
function retrieve() public view returns (uint256) {
return value;
}
}
gas: 0x1fffffffffffff, no price
1 Like
Hi @CrackerHax,
What network are you deploying to for development? I am using ganache-cli
What version of OpenZeppelin CLI are you using.
If I use your gas limit, then I get Exceeds block gas limit
for a regular deploy using OpenZeppelin CLI 2.8.
network.js
module.exports = {
networks: {
development: {
protocol: 'http',
host: 'localhost',
port: 8545,
gas: 0x1fffffffffffff,
networkId: '*',
},
},
};
Deploy (regular)
$ npx oz deploy
Nothing to compile, all contracts are up to date.
? Choose the kind of deployment regular
? Pick a network development
? Pick a contract to deploy Box
✖ Deploying an instance of Box
Returned error: Exceeds block gas limit
Thing is I updated the contract maybe 7 or 8 times and it suddenly just started doing this.
1 Like
Hi @CrackerHax,
Unfortunately I haven’t been able to reproduce through upgrades, I ran about 8 upgrades on my development network (ganache-cli
).
Are you still getting the error?
I’m not getting an error message just a really high gas price. I am going to have to start over and redeploy all my contracts from scratch.
1 Like
Ok I redeployed all the contracts and its not doing it now.
1 Like
In Hardhat, setting the gas and gasPrice solves it for me!
hardhat: {
gas: 7000000,
gasPrice: 1000,
}
1 Like