This folder contains the core price cap adapter contracts. For usage instructions, see how-to.md.
Abstract base contract for Liquid Staking Tokens (wstETH, rETH, weETH, etc.) that grow in value over time.
The adapter caps prices based on a maximum allowed growth rate:
- Stores a snapshot ratio and timestamp of the LST/underlying exchange rate
- Calculates a maximum allowed ratio based on configured yearly growth percentage
- If current ratio exceeds the cap, returns the capped value
maxRatio = snapshotRatio + (maxGrowthPerSecond × timeSinceSnapshot)
if (currentRatio > maxRatio) return maxRatio
else return currentRatio
| Parameter | Description |
|---|---|
snapshotRatio |
Exchange ratio at snapshot time |
snapshotTimestamp |
When the snapshot was taken |
maxYearlyRatioGrowthPercent |
Maximum allowed growth in bps (e.g., 500 = 5%) |
minimumSnapshotDelay |
Minimum age of snapshot (typically 7-14 days) |
-
Precision: Maximum precision is not the objective. The cap has sufficient margin, and Aave's risk parameters provide additional protection.
-
Safety checks: Basic validation is applied, but since access is controlled by trusted entities (Aave governance), checks are not exhaustive. Additional layers (e.g., Risk Stewards) provide extra limitations.
-
Snapshot timing: Timestamps should not decrease between updates. The
MINIMUM_SNAPSHOT_DELAYprevents issues from discrete ratio updates in LSTs—if a snapshot is taken just before a ratio update, the calculated growth rate would be artificially high. -
MAXIMUM_SNAPSHOT_TERM: Snapshots cannot be older than 180 days to ensure parameters stay current.
-
Internal conversion: Yearly bps are converted to per-second growth rate internally for gas efficiency. Yearly bps format is exposed externally for consistency with other Aave systems.
Each LST has unique characteristics. Inherit from PriceCapAdapterBase and implement getRatio()
to fetch the current exchange rate. See lst-adapters/ for examples.
Simplified adapter for USD-pegged stablecoins without growth component.
if (oraclePrice > priceCap) return priceCap
else return oraclePrice
| Parameter | Description |
|---|---|
priceCap |
Maximum allowed price (e.g., 1.04e8 for 4% cap) |
MAX_STABLE_CAP_VALUE |
Hard limit of 2e8 (200%) |
Adapter for Pendle Principal Tokens using linear discount decay model.
PT tokens trade at a discount that decreases linearly to zero at maturity:
currentDiscount = (maturity - now) × discountRatePerYear / SECONDS_PER_YEAR
PT_price = assetPrice × (1 - currentDiscount)
| Parameter | Description |
|---|---|
discountRatePerYear |
Current discount rate (e.g., 0.05e18 = 5%) |
maxDiscountRatePerYear |
Maximum allowed discount rate |
maturity |
Read from PT token contract |
Combine two Chainlink feeds to derive a third price pair.
| Adapter | Formula | Use Case |
|---|---|---|
CLSynchronicityPriceAdapterBaseToPeg |
(Asset/USD) / (ETH/USD) = Asset/ETH | Get ETH-denominated price |
CLSynchronicityPriceAdapterPegToBase |
(Asset/ETH) × (ETH/USD) = Asset/USD | Get USD price from ETH pair |
FixedRatioSynchronicityPriceAdapterBaseToPeg |
Fixed ratio × (Base/Peg) | Discounted price pairs |
- For
BaseToPeg: both input feeds must have equal decimals - Output price is calculated with up to 18 decimals