In this homework, we will be adding transfer, transfer_from, burn and burn_from functions to our simple token smart contract that we have developed in previous lessons.
Steps
Make sure that all functions must be added to the contract.rs file.
- Complete the transfer function
- Transfer amount of tokens from from address to to address.
- Check if there is sufficient balance during the transfer.
- Complete the transfer_from function
- Transfer amount of tokens from from address to to address.
- This operation should check if the from address has given permission to the to address to make the transfer.
- Complete the burn function
- Burn amount of tokens from from address.
- Check if there is sufficient balance during the burn operation.
- Complete the burn_from function
- Burn amount of tokens from from address to to address.
- This operation should check if the from address has given permission to the to address to burn the tokens.