SAMM: The first dynamically sharded AMM — upto 16x throughput, and upto 15x LP returns
SAMM adapts the number of AMM shards in real-time based on transaction throughput. It uses game-theoretically sound mechanisms to prevent front-running, ensure pricing fairness, and increase LP profitability.
SAMM enhances LP returns by:
Fee Differentiation: Smaller shards offer better fee incentives to LPs, driving liquidity rebalancing. Increased Utilization: During high demand, dynamic scaling ensures more trades and higher fee income. Minimized Idle Capital: In low-demand regimes, LPs consolidate in a single shard for maximum ROI.
SAMM introduces a bounded-ratio polynomial fee function to balance liquidity across shards.
Fee(Δ) = (R_B / R_A) × Δ × max{ r_min, min{ r_max, β₁ × R_A^β₂ × R_B^β₃ × Δ^β₄ + β₅ } }
Where: Δ: amount traded (R_A, R_B): token reserves (βᵢ): tunable coefficients (r_min, r_max): fee ratio bounds
SAMM is a sharded AMM built from scratch across two live testnets simultaneously.
Core contracts (RiseChain OP Stack, chain 11155931): Six Solidity 0.8.20 contracts compiled with Hardhat — SAMMPool (output-based AMM with custom dynamic fee formula: fee = max(r_min, β₁·(O_A/R_A) + r_max) in 18-decimal fixed-point), SAMMPoolFactory, CrossPoolRouter (multi-hop routing up to 4 hops), DynamicShardOrchestrator (atomic split/merge/rebalance), SAMMAgentRegistry, and TokenFaucet. All built on OpenZeppelin v5.
Chainlink CRE: A TypeScript workflow runs on a Chainlink DON every 60s — reads live AggregatorV3 price feeds (ETH/USD, BTC/USD, USDC/USD, DAI/USD), fetches SAMM pool state, and autonomously splits shards when TPS/shard ≥ 250, merges when ≤ 62.5, and rebalances when spot price deviates >0.3% from oracle.
Uniswap Trading API: Proxied through an Express 5 backend (API key server-side). Two endpoints handle the full swap flow — /prepare returns a Uniswap quote + Permit2 typed data, /execute returns the unsigned tx for MetaMask.
ENS (SAMMAgentRegistry): Every agent and pool shard gets an on-chain ENS identity — 5 agents + 42 shard subnames (e.g. small.weth-usdc.samm.eth). External protocols can call resolveENS() to get address, role, and metadata, making the entire system composable.
Notable hack: The shard orchestrator triggers atomically from the Chainlink DON — no multisig, no manual intervention. The DON computes n = min(⌈TPS/50⌉, 10) off-chain and writes the decision on-chain in a single transaction.

