diff --git a/web/src/components/PoolDashboard.tsx b/web/src/components/PoolDashboard.tsx index 006a137f..3fb22494 100644 --- a/web/src/components/PoolDashboard.tsx +++ b/web/src/components/PoolDashboard.tsx @@ -290,7 +290,7 @@ const PoolDashboard = () => { // This is a simplified calculation // Real APR = (24h fees × 365) / TVL const dailyVolumeEstimate = totalLiquidityUSD * 0.1; // Assume 10% daily turnover - const dailyFees = dailyVolumeEstimate * 0.03; // 3% fee + const dailyFees = dailyVolumeEstimate * 0.003; // 0.3% fee const annualFees = dailyFees * 365; const apr = (annualFees / totalLiquidityUSD) * 100; diff --git a/web/src/components/TokenSwap.tsx b/web/src/components/TokenSwap.tsx index 38b33ea9..d2f09e36 100644 --- a/web/src/components/TokenSwap.tsx +++ b/web/src/components/TokenSwap.tsx @@ -105,10 +105,10 @@ const TokenSwap = () => { const reserveOut = isAsset0ToAsset1 ? reserve1 : reserve0; // Uniswap V2 AMM formula (matches Substrate runtime exactly) - // Runtime: amount_in_with_fee = amount_in * (1000 - LPFee) = amount_in * 970 - // LPFee = 30 (3% fee, not 0.3%!) - // Formula: amountOut = (amountIn * 970 * reserveOut) / (reserveIn * 1000 + amountIn * 970) - const LP_FEE = 30; // 3% fee + // Runtime: amount_in_with_fee = amount_in * (1000 - LPFee) = amount_in * 997 + // LPFee = 3 (0.3% fee - standard DEX fee) + // Formula: amountOut = (amountIn * 997 * reserveOut) / (reserveIn * 1000 + amountIn * 997) + const LP_FEE = 3; // 0.3% fee const amountInWithFee = amountIn * (1000 - LP_FEE); // = amountIn * 970 const numerator = amountInWithFee * reserveOut; const denominator = reserveIn * 1000 + amountInWithFee; diff --git a/web/src/components/dex/SwapInterface.tsx b/web/src/components/dex/SwapInterface.tsx index 9ee8e83f..d81533e9 100644 --- a/web/src/components/dex/SwapInterface.tsx +++ b/web/src/components/dex/SwapInterface.tsx @@ -135,7 +135,7 @@ export const SwapInterface: React.FC = ({ pools }) => { const reserveIn = isForward ? activePool.reserve1 : activePool.reserve2; const reserveOut = isForward ? activePool.reserve2 : activePool.reserve1; - const toAmountRaw = getAmountOut(fromAmountRaw, reserveIn, reserveOut, 30); // 3% fee + const toAmountRaw = getAmountOut(fromAmountRaw, reserveIn, reserveOut, 3); // 0.3% fee const toAmountDisplay = formatTokenBalance(toAmountRaw, toTokenInfo.decimals, 6); setToAmount(toAmountDisplay);