This repository contains a comprehensive suite of tests for the ERC4626 tokenized vault standard. The tests include both stateless and stateful fuzzing approaches to ensure the correctness and robustness of the implementation. The repository is built using Foundry, a blazing-fast Ethereum development framework.
The ERC4626Mock contract is a mock implementation of the ERC4626 tokenized vault standard. It overrides key functions such as deposit, mint, withdraw, and redeem to include additional checks and logic for testing purposes.
The tests are written using Foundry's forge tool and leverage the forge-std library for cheat codes and utilities.
Stateless tests (e.g., StatelessCounter.t.sol) focus on individual function calls and their correctness in isolation.
Stateful tests simulate sequences of interactions with the contract to verify its behavior over time:
- Open Tests:
StatefulOpenCounter.t.soltests theCountercontract in an open-ended stateful manner. - Handler-Based Tests:
HandlersCaller.t.solandERC4626MockHandler.t.soluse handlers to model user interactions with theERC4626Mockcontract.
The repository includes a GitHub Actions workflow (.github/workflows/test.yml) to automatically run tests on every push or pull request.
- Install Foundry:
curl -L https://foundry.paradigm.xyz | bash foundryup - Install dependencies
forge install
- Run all tests
make test - Run
Countertestsmake test-counter
- Run
ERC4626Mocktestsmake test-erc4626