BalancerV3Quoter
Inherits: QuoterUtils, Masks
State Variables
SWAP
We need all these selectors for executing a single swap
bytes32 private constant SWAP = 0x2bfb780c00000000000000000000000000000000000000000000000000000000
Functions
constructor
constructor() ;
balancerQueryCallback
Callback from uniswap V4 type singletons As Balancer V3 shares the same trigger selector and (unlike this one) has a custom selector provided, we need to skip this part of the data This is mainly done to not have duplicate code and maintain the same level of security by callback validation for both DEX types
function balancerQueryCallback(bytes calldata data) external returns (uint256);
_getBalancerV3TypeAmountOut
Calculates amountOut for Balancer V3 pools
Note: calldata-offset-table:
| Offset | Length (bytes) | Description | |
|---|---|---|---|
| 0 | 20 | pool | |
| 20 | 20 | manager | |
| 40 | 1 | payFlag | |
| 41 | 2 | calldataLength | <- this here might be pool-dependent, cannot be used as flag |
| 43 | calldataLength | calldata |
function _getBalancerV3TypeAmountOut(
uint256 fromAmount,
address tokenIn,
address tokenOut,
uint256 currentOffset
)
internal
returns (uint256 receivedAmount, uint256);
Parameters
| Name | Type | Description |
|---|---|---|
fromAmount |
uint256 |
Input amount |
tokenIn |
address |
Input token address |
tokenOut |
address |
Output token address |
currentOffset |
uint256 |
Current position in the calldata |
Returns
| Name | Type | Description |
|---|---|---|
receivedAmount |
uint256 |
Output amount |
<none> |
uint256 |
Updated calldata offset after processing |
_simSwapBalancerV3ExactInGeneric
Simulates a swap on Balancer V3 pools
Note: calldata-offset-table:
| Offset | Length (bytes) | Description | |
|---|---|---|---|
| 0 | 20 | pool | |
| 20 | 20 | manager | |
| 40 | 1 | payFlag | |
| 41 | 2 | calldataLength | <- this here might be pool-dependent, cannot be used as flag |
| 43 | calldataLength | calldata |
function _simSwapBalancerV3ExactInGeneric(
uint256 fromAmount,
address tokenIn, //
address tokenOut,
uint256 currentOffset
)
internal;
Parameters
| Name | Type | Description |
|---|---|---|
fromAmount |
uint256 |
Input amount |
tokenIn |
address |
Input token address |
tokenOut |
address |
Output token address |
currentOffset |
uint256 |
Current position in the calldata |