Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$ /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
You can’t perform that action at this time.