简体   繁体   中英

Solidity migrate contract dry run vs for real

Summary: Using truffle to deploy to rinkeby via infura.

I just deployed my crowdsale and that seems to succeed. However truffle is not showing me a contract address which is worrying. I notice Migrations dry-run (simulation) at the top, which makes me wonder if its not being deployed, its just testing it... is this a thing? How do i get it to actually deploy?

OK as this was hard to debug, I have an answer that may help others.

  1. Using the latest bleeding edge truffle, I was informed through a warning, to use the 1.0.0-web3one.0 version of truffle-hdwallet-provider
  2. Once I installed that, I could get past the simulation. When migrating for the rinkeby/live networks, a simulation will be attempted before actual deployment. This didn't seem documented anywhere and as truffle hung after simulation completed, this was a real brainer....
  3. Although it seems obvious now, if there is any time related code (such as a start time for a crowdsale) this needs to be minutes into the future for deployment. Not something obvious when using ganache - I had mine 20 seconds into the future, but by the time that would have been deployed, that was now in the past, causing a revert on my contracts

I'm making quite good progress with the new 1.0 version of ethereum tools, and beta of truffle, so shout if I an be of assistance!

Please try put it in the networks section, the option skipDryRun: true

module.exports = {

  networks: {
    ...

    ropsten:{
     provider: () => new HDWalletProvider(mnemonics, endpoint),
     network_id: 3,
     gas: 5000000,
     confirmation: 2, 
     timeoutBlocks: 200,
     skipDryRun: true
    },
    ...
  }
}

You can use Etherlime for deployment of smart contracts. Actually you can use it for everything instead of truffle. It is simpler and with more information. In my opinion is the better tool. It is based on ethersjs which is a lot better than web3js. Here is a link to the documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM