We will implement a Token distribution contract that will add multiple members to the array so we can distribute the ERC20 tokens equally between them. We will also implement a fuzzing contract using assertion mode in echidna to check if there's still some tokens remaining in the contract.
Steps |
---|
1- Install Foundry on your Windows machine |
2- Clone the repository to your local machine |
3- Open your terminal and run forge build |
4- Install Docker for Windows |
5- Install Trail of Bits Security Toolbox on docker |
6- Install Foundry on Docker by running ```curl -L https://foundry.paradigm.xyz |
Steps | Copy/Paste commands |
---|---|
1 | docker build -t <ChooseAName> . to create a Docker image with both ToB security toolbox and Foundry |
2 | docker run -it --mount type=bind,source="${PWD}",target=/code <ChooseAName> to create a container of the image |
3 | cd .. |
4 | cd .. |
5 | cd code |
6 | forge build to compile the project |
7 | echidna-test . --contract TutorialTest --test-mode assertion to run echidna in assertion mode |
Run the fuzz test using the command echidna-test . --contract TutorialTest --test-mode assertion
.
Echidna divided 1 billion tokens between 15 addressess so 1,000,000,000 / 15 = 66,666,666.666667 tokens per user.
0.666667 x 15 = 10.000005 tokens left in the contract that's why the test will fail.