# Pegging Mechanisms This document explains how pegging mechanisms work in the bridge system. ## Stablecoin Pegging ### USD Stablecoins (USDT, USDC) - Target price: $1.00 (1e18) - Threshold: ±0.5% (50 basis points) - Monitoring: Continuous via ReserveSystem price feeds - Rebalancing: Automatic when deviation exceeds threshold ### WETH Pegging - Target price: 1:1 with ETH (1e18) - Threshold: ±0.1% (10 basis points) - Monitoring: Continuous via ReserveSystem price feeds - Rebalancing: Automatic when deviation exceeds threshold ## Commodity Pegging All commodities are pegged through XAU (gold) as the base anchor. ### Formula ``` Commodity Price = XAU Price / XAU Rate ``` Example: If XAU = $2000/oz and XAG rate = 80, then XAG = $2000/80 = $25/oz ### Supported Commodities - XAU (Gold) - base anchor - XAG (Silver) - XPT (Platinum) - XPD (Palladium) - Oil (WTI, Brent) ## ISO-4217 Currency Pegging All currencies are triangulated through XAU. ### Conversion Formula ``` CurrencyA → XAU → CurrencyB ``` 1. Convert CurrencyA to XAU: `amount / fromXauRate` 2. Convert XAU to CurrencyB: `xauAmount * toXauRate / 1e18` ### Example Convert 2000 USD to EUR: - USD XAU rate: 2000 (1 oz XAU = 2000 USD) - EUR XAU rate: 1800 (1 oz XAU = 1800 EUR) - Result: (2000 / 2000) * 1800 = 1800 EUR ## Rebalancing When a peg deviates beyond its threshold: 1. Deviation is detected by peg manager 2. Rebalancing is triggered automatically 3. Reserves are adjusted to restore peg 4. Event is emitted for monitoring