[wif] slippage for burnSwap
This commit is contained in:
@@ -28,11 +28,10 @@ export function calculateSlippage(
|
||||
// Calculate actual swap price with decimal correction
|
||||
const swapPrice = Number(swapOutputAmount) / (Number(swapInputAmount) - Number(swapFee));
|
||||
|
||||
// Calculate slippage: 1 - (actualPrice / marketPrice)
|
||||
const slippage = 1 - (swapPrice / marketPrice);
|
||||
// Calculate slippage percentage: ((swapPrice - marketPrice) / marketPrice) * 100
|
||||
const slippage = ((swapPrice - marketPrice) / marketPrice) * 100;
|
||||
|
||||
// Convert to percentage
|
||||
return slippage * 100;
|
||||
return slippage;
|
||||
}
|
||||
|
||||
export interface SwapAmountResult {
|
||||
|
||||
Reference in New Issue
Block a user