fix(asset-swapper): Check MAX_IN_RATIO in sampleBuysFromBalancer (#338)
* fix: for swapExactAmountIn * chore: update change log * Update packages/asset-swapper/CHANGELOG.json Co-authored-by: Lawrence Forman <lawrence@0xproject.com>
This commit is contained in:
parent
d9a16ed1f9
commit
d46756ae2e
@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "16.29.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Check MAX_IN_RATIO in sampleBuysFromBalancer",
|
||||
"pr": 338
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "16.29.1",
|
||||
"changes": [
|
||||
|
@ -154,6 +154,12 @@ contract BalancerSampler {
|
||||
)
|
||||
returns (uint256 amount)
|
||||
{
|
||||
// Handles this revert scenario:
|
||||
// https://github.com/balancer-labs/balancer-core/blob/master/contracts/BPool.sol#L443
|
||||
if (amount > _bmul(poolState.takerTokenBalance, MAX_IN_RATIO)) {
|
||||
break;
|
||||
}
|
||||
|
||||
takerTokenAmounts[i] = amount;
|
||||
// Break early if there are 0 amounts
|
||||
if (takerTokenAmounts[i] == 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user