monkrus / merxnet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom implementation of basic ERC20 token using OpenZeppelin library

Prerequisites

  1. Check if Node.js and truffle are installed by typing in your terminal: node -v and then truffle version

  2. Initialize truffle truffle init

  3. Create package.json file npm init

  4. Install OpenZeppelin library npm install openzeppelin-solidity

Steps

  1. Create MerxToken.sol file in the contracts folder.

  2. Import from OpenZeppelin libraries using import keyword. Please note the importing format is using forward slashes. If import is highligted red in your editor, add following to your user settings(e.g. in VSC):

"solidity.packageDefaultDependenciesContractsDirectory": "",
"solidity.packageDefaultDependenciesDirectory": "node_modules", 
  1. Create a constructor to pass in arguments into DetailedERC20.Update a truffle-config.js file with solc....

  2. Run truffle compile. Please check the required version of the Solidity compiler (for all .sol files including imported libraries) by running truffle version. If needed, run npm uninstall -g truffleand the npm install -g truffle

  3. Create 2_deploy_token.js in migrations folder.

  4. Run the blockchain emulator. Install npm install ganache-cli and run it ganache-cli.

  5. Modify truffle-config.js (truffle.js for Mac).

  6. Run truffle migrate --reset to migrate the contract.

  7. Run truffle console. Test the blockchain by typing: truffle(development)>MerxNetToken.deployed().then((instance) =>{merx = instance}) and then merx

  8. To test, type merx.name(), merx.decimals()

Tests

  1. Write Merx.test.js in the test folder. See file for detailed steps.

  2. Double check the correctness of the await test, run truffle test (Expected result : 3 passing).

  3. Install chai npm install chai,npm i chai-as-promised and npm i chai-bignumber

  4. Run npm install

  5. ** 03/28/2019 There is a conflict I could not resolve between chai-bignumer and chai-as-promised libraries that results in failed test.**

About


Languages

Language:JavaScript 100.0%