Skip to content

Commit

Permalink
feat: add slippage for preview amounts (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
janndriessen authored Dec 11, 2024
1 parent aa03bab commit 4e473ee
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/component-swap-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,11 @@ async function getAmount(
functionName: isMinting ? 'previewMint' : 'previewRedeem',
args: [issuanceUnits],
})) as bigint
return preview
if (isMinting) {
return (preview * BigInt(10001)) / BigInt(10000)
} else {
return (preview * BigInt(9999)) / BigInt(10000)
}
} catch {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const usdc = getTokenByChainAndSymbol(chainId, 'USDC')!
Expand Down

0 comments on commit 4e473ee

Please sign in to comment.