woke init pytypes
woke test tests/test_erc1155.py
A pure yul erc1155 implementation that shares the same ABI as the solidity implementation can be tested by removing the comment from the following line in the woke test files and pointing to a yul file .
# replace_bytecode(ERC1155Impl, "yul/ERC1155Yul.yul")
For stateful fuzz testing, I created a python class that mirrors the ERC1155 solidity class. Each flow calls the same method in both the solidity and python implementations.
There are 2 invariants that are run after each flow that verify the state matches between python and solidity, one for approvals and one for balances.
The tests are from solmate
https://github.com/transmissions11/solmate/blob/main/src/test/ERC1155.t.sol
This project was based on the foundry yul repo.
https://github.com/CodeForcer/foundry-yul
- Install Foundry
curl -L https://foundry.paradigm.xyz | bash
foundryup
-
Install solidity compiler https://docs.soliditylang.org/en/latest/installing-solidity.html#installing-the-solidity-compiler
-
Build Yul contracts and check tests pass
forge test
Run tests (compiles yul then fetch resulting bytecode in test)
forge test
To see the console logs during tests
forge test -vvv