I can't get my contract to deploy successfully using Infura, MetaMask, and Truffle.
When I run truffle migrate --network live
I get this error:
Error encountered, bailing. Network state unknown. Review successful transactions manually.
insufficient funds for gas * price + value
But then, if I run truffle migrate --network live --dry-run
I get this output:
sender doesn't have enough funds to send tx. The upfront cost is: 672197500000000000 and the sender's account only has: 60000000000000000
Assuming that value is in wei, why would it cost so much to deploy a contract? What can I do about this?
Here is my truffle.js
file:
var HDWalletProvider = require("truffle-hdwallet-provider");
var mnemonic = "my_mnemonic";
module.exports = {
networks: {
live: {
network_id: 1,
provider: new HDWalletProvider(mnemonic, "https://mainnet.infura.io/my_api_key")
}
}
};
msg.value
in a function, you shouldn't make that functionpayable
. That keyword means that you can send ETH to the contract with the transaction, but yourreturnEth
, andfee
don't do that - onlyadopt
expects ETH to be sent to itpayable
fromreturnEth
andfee
? What are the implications of leaving thepayable
keyword in those functions?