- install
npm install -g truffle
npm install -g ganache-cli
npm init -y
npm install -E zeppelin-solidity
// npm update -g truffle
(🍎) npm install openzeppelin-solidity :star: [email protected]
- create project in a empty folder
truffle init
ganache-cli -p 8545 // start client
- compile/deploy contract in root dir
truffle compile // check build folder
truffle migrate --network development // check it in truffle.js
- interact with Contract in console
truffle console --network development
// get account from ganache-cli
account0 = web3.eth.accounts[0]
// call contract
CYCToken.deployed().then(inst => { CYCTokenInstance = inst })
CYCTokenInstance.totalSupply.call()
// or like this
CYCToken.at(CYCToken.address).name.call()
// event
CYCTokenInstance.Transfer.call()
//func
CYCTokenInstance.transfer('0x', 100)
- deploy contract in
ropsten
truffle migrate --network ropsten
- runing result:
Deploying CYCToken...
... 0x2d04ff6f016a8e03f8c3f662f5a73b6ca94bfa4d95c0055b847cd8ed453f363e
CYCToken: 0xd797d0b277e2f3b01c123ceef78180b6ea643fc2
- 🎉view contract in here
when compile sol
Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
function CYCToken() public {
^ (Relevant source part starts here and spans across multiple lines).
truffle-flattener <*.sol> >> <new.sol>