Skip to content

Instantly share code, notes, and snippets.

@MichalZalecki
Last active July 3, 2018 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MichalZalecki/8d617ce74c97293d9f2bbcd0568c7630 to your computer and use it in GitHub Desktop.
Save MichalZalecki/8d617ce74c97293d9f2bbcd0568c7630 to your computer and use it in GitHub Desktop.
$ /node_modules/.bin/truffle console --network ganache
truffle(ganache)> SimpleToken.deployed().then(instance => token = instance)
truffle(ganache)> PresaleCrowdsale.deployed().then(instance => crowdsale = instance)
truffle(ganache)> token.balanceOf(web3.eth.accounts[1]).then(n => n.div(10 ** 18).toString())
'0'
truffle(ganache)> crowdsale.addToWhitelist(web3.eth.accounts[1])
truffle(ganache)> crowdsale.buyTokens(web3.eth.accounts[1], { from: web3.eth.accounts[1], value: 10 ** 18 })
truffle(ganache)> token.balanceOf(web3.eth.accounts[1]).then(n => n.div(10 ** 18).toString())
'10000'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment