Fix BAL#304 MAX_IN_RATIO
This commit is contained in:
@@ -4,7 +4,8 @@ pragma solidity ^0.8.13;
|
||||
|
||||
import {IERC20, ISwapAdapter} from "src/interfaces/ISwapAdapter.sol";
|
||||
|
||||
uint256 constant RESERVE_LIMIT_FACTOR = 10; // TODO why is the factor so high?
|
||||
// Maximum Swap In/Out Ratio - 0.3 https://balancer.gitbook.io/balancer/core-concepts/protocol/limitations#v2-limits
|
||||
uint256 constant RESERVE_LIMIT_FACTOR = 4;
|
||||
uint256 constant SWAP_DEADLINE_SEC = 1000;
|
||||
|
||||
contract BalancerV2SwapAdapter is ISwapAdapter {
|
||||
@@ -160,10 +161,10 @@ contract BalancerV2SwapAdapter is ISwapAdapter {
|
||||
|
||||
for (uint256 i = 0; i < tokens.length; i++) {
|
||||
if (tokens[i] == sellToken) {
|
||||
limits[0] = balances[i] * RESERVE_LIMIT_FACTOR;
|
||||
limits[0] = balances[i] / RESERVE_LIMIT_FACTOR;
|
||||
}
|
||||
if (tokens[i] == buyToken) {
|
||||
limits[1] = balances[i] * RESERVE_LIMIT_FACTOR;
|
||||
limits[1] = balances[i] / RESERVE_LIMIT_FACTOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user