Use swap fee rate when considering non margin amount (#400)

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2024-03-13 13:33:50 +01:00 committed by GitHub
parent edb1d04b3c
commit 6a8ac4e676
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -78,8 +78,12 @@ export const getTokenInMax = (
const inputReduceOnly = inputBank.areBorrowsReduceOnly()
const outputReduceOnly = outputBank.areDepositsReduceOnly()
const maxSwapFeeRate = Math.max(
inputBank.flashLoanSwapFeeRate,
outputBank.flashLoanSwapFeeRate,
)
const inputTokenBalance = new Decimal(
mangoAccount.getTokenBalanceUi(inputBank),
mangoAccount.getTokenBalanceUi(inputBank) / (1 + maxSwapFeeRate),
)
const outputTokenBalance = new Decimal(

View File

@ -2566,7 +2566,7 @@
dependencies:
"@solana/wallet-adapter-base" "^0.9.23"
"@solana/wallet-adapter-solflare@0.6.27":
"@solana/wallet-adapter-solflare@0.6.27", "@solana/wallet-adapter-solflare@^0.6.28":
version "0.6.27"
resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-solflare/-/wallet-adapter-solflare-0.6.27.tgz#49ba2dfecca4bee048e65d302216d1b732d7e39e"
integrity sha512-MBBx9B1pI8ChCT70sgxrmeib1S7G9tRQzfMHqJPdGQ2jGtukY0Puzma2OBsIAsH5Aw9rUUUFZUK+8pzaE+mgAg==
@ -2577,7 +2577,7 @@
"@solflare-wallet/sdk" "^1.3.0"
"@wallet-standard/wallet" "^1.0.1"
"@solana/wallet-adapter-solflare@0.6.28", "@solana/wallet-adapter-solflare@^0.6.28":
"@solana/wallet-adapter-solflare@0.6.28":
version "0.6.28"
resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-solflare/-/wallet-adapter-solflare-0.6.28.tgz#3de42a43220cca361050ebd1755078012a5b0fe2"
integrity sha512-iiUQtuXp8p4OdruDawsm1dRRnzUCcsu+lKo8OezESskHtbmZw2Ifej0P99AbJbBAcBw7q4GPI6987Vh05Si5rw==