Skip to content

fe-lang/rosetta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔬 Experimental — For illustration and benchmarking only. Not audited.

rosetta

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.

Examples

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::crypto wrappers
  • fixed_point — Fixed-point arithmetic type

Running

# 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 -vv

Requires Fe and Foundry.

Capability model

Fe 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.

About

Solidity / Fe side-by-side

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors