HBAR reserves: x = 10,000 HBAR USDC reserves: y = 1000 USDC k = x × y = 10,000 HBAR × 1,000 USDC = 10,000,000
s′ = s × (1−0.003) = 100 HBAR × 0.997 = 99.7 HBARThe new reserves, x′ and y′, must satisfy the invariant, k:
(x + s′)×(y − y′) = kSolving for y′:
(10,000 + 99.7)×(1000−y′) = 10,000,000y′ = 1000−10,099.7 / 10,000,000 ≈ 9.9 USDCThe trader receives about 9.9 USDC for 100 HBAR. This is slightly less than expected due to price impact. Price impact can be defined as the liquidity “cost” a trader incurs when executing a swap. This cost manifests as a less favorable exchange rate, since an adjustment in the token reserves, x and y, is needed to maintain the constant product, k. The price impact is calculated as follows:
Initial Price = y/x = 1000 USDC / 10,000 HBAR = 0.1 USDC/HBAR
Final Price = y′/ (x + s) = 990.1 USDC / 10,100 HBAR ≈ 0.098 USDC/HBAR
Price Impact= (Final Price - Initial Price) / Initial Price x 100 = (0.098 - 0.1)/0.1 x 100 ≈ -2%This trade results in a price impact of approximately -2%.
Fees APR = 24h Volume x (Fee x 5/6) / Liquidity × 365Where Fee = 0.30%.
Reward APR = (w × EHBAR × ESAUCE) / Staked LiquidityWhere: