🔬 Experimental — For illustration and benchmarking only. Not audited.
Side-by-side Fe and Solidity implementations of Ethereum contract patterns. Each example has fe/ and sol/ subdirectories with equivalent logic, verified by Foundry fuzz tests.
| Example | Description | Fuzz-tested |
|---|---|---|
| erc20 | ERC-20 token (transfer, approve, mint) | yes |
| math | 512-bit mulDiv (Uniswap V3 FullMath) | yes |
| merkle | Sorted-pair Merkle proof verification | yes |
| amm | Constant-product AMM (swap, add liquidity) | yes |
| escrow | Escrow with typed state machine | yes |
| governance | Token + governance (vs Solidity Diamond) | yes |
| verifier | Plonk and Halo2 proof verification | |
| poseidon | Poseidon hash (T=3, BN254) | excluded (sonatina#232) |
Shared libraries in shared/:
- ec — BN254 elliptic curve operations via typed
std::evm::cryptowrappers - fixed_point — Fixed-point arithmetic type
# Build all Fe contracts
fe build .
# Run Foundry equivalence + gas tests
cd examples/erc20 && forge test -vv
cd examples/math && forge test -vv
cd examples/merkle && forge test -vv
cd examples/amm && forge test -vv
cd examples/escrow && forge test -vv
cd examples/governance && forge test -vvFe code uses typed precompile wrappers (std::evm::crypto) for cryptographic operations and the effects system (uses (evm: mut Evm)) for raw memory and calldata access. No direct imports from std::evm::ops.