🐛vault swap message (#451)

This commit is contained in:
Bob van der Helm 2023-09-11 11:40:42 +02:00 committed by GitHub
parent f61dd3e4e7
commit 4538bdabfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,9 +119,8 @@ export function getVaultSwapActions(
if (primaryLeftoverValue.isGreaterThan(0)) {
const swapValue = value.isLessThan(primaryLeftoverValue) ? value : primaryLeftoverValue
const swapAmount = swapValue
.dividedBy(prices.find((coin) => coin.denom === bnCoin.denom)?.amount || 1)
.integerValue()
const swapAmount = getCoinAmount(bnCoin.denom, swapValue, prices)
value = value.minus(swapValue)
amount = amount.minus(swapAmount)
primaryLeftoverValue = primaryLeftoverValue.minus(swapValue)