AssessDepegRisk
Quantify a 2-asset Curve-style Stableswap LP position's exposure to a stablecoin depeg. Computes IL at multiple depeg levels (default 2%, 5%, 10%, 20%, 50%) via the closed-form stableswap-invariant expansion, with an optional V2 constant-product benchmark at each level. Some depeg levels are physically unreachable at high A — unreachable scenarios return null on il_pct, lp_value_at_depeg, and hold_value_at_depeg; the V2 benchmark stays populated.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rpc_url | Yes | An Ethereum (or L2) JSON-RPC URL used to read live pool state. Required; supplied by you per call (BYO-RPC) and may carry your provider key. The endpoint stores and logs nothing — the URL is never persisted or written to logs. | |
| chain_id | No | Optional guard. If supplied and the RPC reports a different chain id, the call is rejected. Defaults to 1 (Ethereum mainnet) conceptually; omit to skip the check. | |
| pool_type | Yes | Which protocol the pool at pool_address belongs to. This tool accepts only stableswap (2-asset plain Curve pool). | |
| compare_v2 | No | If true (default), each scenario reports the equivalent V2 constant-product IL at the same price deviation. | |
| lp_init_amt | Yes | LP tokens held, in human units. Must be > 0. | |
| block_number | No | Optional block number to pin the read to a historical block. Omit to read the latest block. | |
| depeg_levels | No | Depeg magnitudes as fractions in (0, 1). Default [0.02, 0.05, 0.10, 0.20, 0.50]. | |
| pool_address | Yes | On-chain address of the pool/pair to analyze (Uniswap V2/V3 pair, Balancer weighted pool, or Curve stableswap pool). Required. Lowercase, uppercase, or checksum casing all work. | |
| depeg_token_name | No | Optional. Symbol of the asset assumed to depeg (e.g. 'USDC', 'DAI'). Must be one of the two tokens in the pool. If omitted, the pool's first token is used. |