🐛vault swap message (#451)
This commit is contained in:
parent
f61dd3e4e7
commit
4538bdabfd
@ -119,9 +119,8 @@ export function getVaultSwapActions(
|
|||||||
|
|
||||||
if (primaryLeftoverValue.isGreaterThan(0)) {
|
if (primaryLeftoverValue.isGreaterThan(0)) {
|
||||||
const swapValue = value.isLessThan(primaryLeftoverValue) ? value : primaryLeftoverValue
|
const swapValue = value.isLessThan(primaryLeftoverValue) ? value : primaryLeftoverValue
|
||||||
const swapAmount = swapValue
|
const swapAmount = getCoinAmount(bnCoin.denom, swapValue, prices)
|
||||||
.dividedBy(prices.find((coin) => coin.denom === bnCoin.denom)?.amount || 1)
|
|
||||||
.integerValue()
|
|
||||||
value = value.minus(swapValue)
|
value = value.minus(swapValue)
|
||||||
amount = amount.minus(swapAmount)
|
amount = amount.minus(swapAmount)
|
||||||
primaryLeftoverValue = primaryLeftoverValue.minus(swapValue)
|
primaryLeftoverValue = primaryLeftoverValue.minus(swapValue)
|
||||||
@ -181,4 +180,4 @@ function getSwapAction(denomIn: string, denomOut: string, amount: BigNumber, sli
|
|||||||
slippage: slippage.toString(),
|
slippage: slippage.toString(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user