What is ANK?
ANK is a deterministic on-chain simulator designed for building and backtesting execution strategies across multiple DeFi protocols. It provides a focused testing environment where you can validate complex cross-protocol strategies before deploying them on-chain. The framework is built around three core concepts:- Engine: A small orchestrator that advances time (ticks), routes transaction bundles to protocols, and tracks wallet balances
- Protocols: Pluggable protocol implementations (Aave V3, Lido, Uniswap V3, Pendle) that share a common trait interface
- Strategies: Code that inspects market/user state each tick and emits actions
ANK is a research and backtesting tool. It does not simulate all production risks including MEV, oracle latency, gas costs, slippage nuances, or liquidation bonuses across chains. Protocol models are simplified—use cautiously for decision-making.
Key features
Multi-protocol support
Simulate strategies across Aave V3, Lido wstETH, Uniswap V3, and Pendle with accurate state modeling and cross-protocol interactions.
Deterministic execution
Advance time tick by tick with reproducible results. Each protocol accrues interest, fees, and rewards independently.
Risk analytics
Per-tick CSV exports with wallet/deposits/debt/net value, LTV, health factor, drawdown, and volatility metrics.
Strategy optimization
Parameter sweep scaffolding with configurable objectives to find optimal strategy parameters.
Supported protocols
Aave V3
Aave V3
Multi-asset lending with deposit/borrow/repay/withdraw operations, dynamic pricing, per-tick variable debt accrual, and fractional liquidation support.
Lido (wstETH)
Lido (wstETH)
Stake/unstake ETH with exchange rate growth per tick. wstETH can be used as Aave collateral with automatic price synchronization.
Uniswap V3
Uniswap V3
Toy fixed-fee pool implementation for simple swap flows and price impact testing.
Pendle
Pendle
Full PT/YT implementation with SY wrapper, mint/claim/redeem operations, PT↔SY AMM with LP shares and fees, and admin rate/maturity controls.
Example use cases
Cross-protocol leverage
Borrow ETH from Aave, stake in Lido for wstETH, deposit wstETH back to Aave as collateral, and loop.
Yield farming strategies
Test PT/YT minting strategies in Pendle while managing collateral positions in Aave.
Liquidation resistance
Stress test strategies under price shocks using oracle CSV overrides to validate health factor management.
Parameter optimization
Sweep target LTV, rebalancing bands, and position sizes to maximize risk-adjusted returns.
Get started
Quick start
Run your first Lido ↔ Aave leverage simulation in minutes
Installation
Install Rust and build the ANK CLI tools
API reference
Explore the protocol trait and action schemas
Architecture overview
The ANK repository is organized into focused modules:Token conventions
By convention, ANK uses numeric token IDs:1= ETH2= USDC3= wstETH4-7= Pendle tokens (SY, PT, YT, LP)