Skip to content

Commit

Permalink
More logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoopmann committed Dec 12, 2024
1 parent 087bb1b commit 5a77513
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run lint
# - run: npm run lint
- run: npm run build --if-present
- run: npm run hardhat:arbitrum &
- run: npm run hardhat:base &
Expand Down
17 changes: 6 additions & 11 deletions src/utils/component-swap-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,21 +210,16 @@ async function getAmount(
functionName: isMinting ? 'previewMint' : 'previewRedeem',
args: [issuanceUnits],
})) as bigint
if (isMinting) {
return (preview * BigInt(1001)) / BigInt(1000)
} else {
return (preview * BigInt(999)) / BigInt(1000)
}
const previewWithSlippage = isMinting ? preview * BigInt(1001) / BigInt(1000) : preview * BigInt(999) / BigInt(1000)
console.log({component, issuanceUnits, preview, previewWithSlippage})
return previewWithSlippage
} catch {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const usdc = getTokenByChainAndSymbol(chainId, 'USDC')!
if (isAddressEqual(component, usdc)) return issuanceUnits
// Apply slippage to issuance units amount (for all none erc4262)
if (isMinting) {
return (issuanceUnits * BigInt(1005)) / BigInt(1000)
} else {
return (issuanceUnits * BigInt(995)) / BigInt(1000)
}
const issuanceUnitsWithSlippage = isMinting ? (issuanceUnits * BigInt(1005)) / BigInt(1000) : (issuanceUnits * BigInt(995)) / BigInt(1000)
console.log({component, issuanceUnits, issuanceUnitsWithSlippage})
return issuanceUnitsWithSlippage
}
}

Expand Down

0 comments on commit 5a77513

Please sign in to comment.