Test ERC20 Token Contract
Before starting my article, I would like to invite you to join my channel Texploxe (In Telegram). I share my ICO Analysis, News, Blockchain Tech, etc.
The below are some of the tests we tried on our smart contract for the token which has ERC20 Token Standard.
Function:
-Approve (Approving allowance)
- From owner account
- From non-owner account
- From an owner account after ownership transfer
-Transfer From (Transferring fund from an approved allowanced wallet)
- Try the minimum amount
- Try the maximum amount
- Try any amount
- Try an amount more than the range
- Try an amount more than the token supply
-Unpause (Unpause all the paused wallets together)
- Transfer any amount
-Mint (Mint new tokens)
- Mint new tokens from an owner
- Mint new tokens from non-owner
- Mint new tokens from the owner after ownership transfer
-Decrease Approval (Decrease already set approved allowance)
- Decrease approval of a new wallet
- Decrease approval of an earlier set wallet within range
- Decrease approval of an earlier set wallet to zero
- Decrease approval of an earlier set wallet taking the just minimum amount
- Decrease approval of an earlier set wallet greater than the current value
-Finish Minting (Complete Minting Process forever)
- Try to mint again from owner account
- Try to mint again from unknown account
-Pause (Pause all wallets together)
- Try to transfer any amount
-Transfer
- Transfer Minimum Amount
- Transfer Maximum Amount
- Transfer Any Amount
- Try an amount more than token supply
- Transfer from an invalid account
-Increase Approval (Increase already set approved allowance)
- Increase approval of a new wallet
- Increase approval of an earlier set wallet within range
- Increase approval of an earlier set wallet higher than total token supply
- Increase approval of an earlier set wallet taking the just minimum amount
- Increase approval of an earlier set wallet lower than the current value
-Transfer Ownership (Transfer ownership to a new wallet)
- Transfer ownership to a new account
Any help is appreciated.
-Other Tests
- transferring other erc20 tokens sent to this contract. (Thanks to rumkin)
If you think there are more to these test on a token contract with ERC20 Standard, please let us know.
Source:
https://ethresear.ch/t/token-contract-test-cases/1075
https://www.linkedin.com/pulse/test-erc20-tokencontract-shebin-john