- Node.js
- Truffle Framework - Tools that allow us to write smart contract - npm install -g truffle
- Ganache - local blockchain
- Metamask Extension - Allowing us to interact with the smart contract
truffle init
- Create the contract
- Initialise with number of token available passed in the constructor through the migrations
- Allocate the total token to the admin account
- Implement Transfer tokens ** Trigger an event transfer and return bool true if successful
- Implement Deligated Transfer - Complying with ERC20 Standards
- Implement Transfer From - handles the approve function: transferFrom()
- Transfer _value amount of tokens from address _from to address _to
- Must fire a Transfer event (Already implemented)
- Impmement the approve function - allow someone to approve another account to spend tokens on their behalf (account a approve account b to spend c amount of token on my account ) like approving exchange to spend or sell your taking
- Implement Transfer From - handles the approve function: transferFrom()
- Implement Allowance - the amount of token you approve to transfer
- Takes the address of owner and spender and return uint256 remaining
- Remaining - is the amount which the _spender is still allowed to withdraw from the _owner
- Implement approval event - trigger and log when the approval function is successful
- Create a migration
- Migrate - truffle migrate --reset
- Open the console to interact with the contract - truffle console
- Get an instance of the token - DappToken.deployed().then(function(i){token = i})
- Create the test file - test/DappToken.js
- Using ERC20 Formart, the balanceOf function returns the balance of an address
- Test: truffle test
- Enter the Console: truffle console
- web3.eth.getAccounts() -> getting all accounts