Fix ABI encoding error with two hop buys due to applying slippage to uint(-1) values (#410)
Co-authored-by: Lawrence Forman <me@merklejerk.com>
This commit is contained in:
parent
f470d282ee
commit
c57bf86273
@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "16.49.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Fix ABI encoding error with two hop buys due to applying slippage to uint(-1) values",
|
||||
"pr": 410
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "16.49.1",
|
||||
"changes": [
|
||||
|
@ -701,8 +701,16 @@ function slipNonNativeOrders(quote: MarketSellSwapQuote | MarketBuySwapQuote): O
|
||||
return {
|
||||
...o,
|
||||
...(quote.type === MarketOperation.Sell
|
||||
? { makerAmount: o.makerAmount.times(1 - slippage).integerValue(BigNumber.ROUND_DOWN) }
|
||||
: { takerAmount: o.takerAmount.times(1 + slippage).integerValue(BigNumber.ROUND_UP) }),
|
||||
? {
|
||||
makerAmount: o.makerAmount.eq(MAX_UINT256)
|
||||
? MAX_UINT256
|
||||
: o.makerAmount.times(1 - slippage).integerValue(BigNumber.ROUND_DOWN),
|
||||
}
|
||||
: {
|
||||
takerAmount: o.takerAmount.eq(MAX_UINT256)
|
||||
? MAX_UINT256
|
||||
: o.takerAmount.times(1 + slippage).integerValue(BigNumber.ROUND_UP),
|
||||
}),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user