This repo gives a complete example of deploying a token. The single most important thing to remember is move systematically and do not cut corners. This rule goes for ALL contract deployments. Copy and pasting without taking the time to go over every detail will result in a failed deployment, or worse, a successful deployment with hidden failures. There are numerous locations where the token name and parameters need to be set. Move from file to file, look over and touch each line. Do not deploy onto the live network until running truffle test. The only files that do not need to be touched are Lib files.
Start in the build folder.
- Open
build/contracts. - Ensure a clean start by deleting any non-lib .json file. Leave all Lib.json files.
- Open
/contractsfolder. - Rename the token
.solfile toSomeNameToken.sol. - Open the token
.solfile. - Put the same
SomeNameTokenaftercontracton line 26. - Name the constructor function
function SomeNameTokenon line 31. - Open
TokenTestSpender.sol. - Change to the name of your token on lines 3 and 7.
- Open
/migrationsfolder. - Change to the name of your token in two places on line 4, then also change to the name on lines 11, 14, 24, 34, and 44.
- Within each block, set the parameters for the appropriate network. So for live, set the owner as the address you want to use on the live network, then set each parameter after. For testrpc, the owner needs to be one of the addresses generated at launch. When you launch testrpc (soon to be ganache), you can simply copy and paste one of the addresses into the owner field.
- Open
testfolder. - Rename the token
.jsfile toSomeNameToken.js. - Change to the name of your token in two places on line 1, then change on lines 3 and 8.
- Set the appropriate assertion parameters on lines 25-29.
- Rename the test token
.solfile toTestSomeNameToken.sol. - Change to the name of your token on lines 6, 9, 18, 19, 55, 57, and 80.
- Set the commented parameters on lines 14, 15, and 18.
- For security, set truffle.js parameters in the
RenameTotruffle.jsfile then rename totruffle.jsbefore committing to any repo. - Open
RenameTotruffle.js. - Set a random 12-word mnemonic on line 3 to use ropsten.
- Set the appropriate addresses on lines 19 and 27.
At this point you can truffle test by going into the truffle folder in a terminal and running truffle test.
To deploy onto rinkeby.
- Start a local node connected to rinkeby
- Unlock your primary account.
- Go to https://faucet.rinkeby.io/ and follow the instructions to get ether.
- Copy and paste the top
truffle.jsfile with your info into thetruffle.jsfile in the/trufflefolder and save. Do not git commit before reverting this change and removing your information. - Run
truffle migrate --network rinkeby.
Your token is now on the Rinkeby network.