DexActionEstimates ​
State Variables ​
ADDRESS_DEAD ​
solidity
address private constant ADDRESS_DEAD = 0x000000000000000000000000000000000000dEaD;
Functions ​
estimateSwapIn ​
estimates swap IN tokens execution
solidity
function estimateSwapIn(address dex_, bool swap0to1_, uint256 amountIn_, uint256 amountOutMin_)
public
payable
returns (uint256 amountOut_);
Parameters
Name | Type | Description |
---|---|---|
dex_ | address | Dex pool |
swap0to1_ | bool | Direction of swap. If true, swaps token0 for token1; if false, swaps token1 for token0 |
amountIn_ | uint256 | The exact amount of input tokens to swap |
amountOutMin_ | uint256 | The minimum amount of output tokens the user is willing to accept |
Returns
Name | Type | Description |
---|---|---|
amountOut_ | uint256 | The amount of output tokens received from the swap |
estimateSwapOut ​
estimates swap OUT tokens execution
solidity
function estimateSwapOut(address dex_, bool swap0to1_, uint256 amountOut_, uint256 amountInMax_)
public
payable
returns (uint256 amountIn_);
Parameters
Name | Type | Description |
---|---|---|
dex_ | address | Dex pool |
swap0to1_ | bool | Direction of swap. If true, swaps token0 for token1; if false, swaps token1 for token0 |
amountOut_ | uint256 | The exact amount of tokens to receive after swap |
amountInMax_ | uint256 | Maximum amount of tokens to swap in |
Returns
Name | Type | Description |
---|---|---|
amountIn_ | uint256 | The amount of input tokens used for the swap |
_decodeLowLevelUint1x ​
solidity
function _decodeLowLevelUint1x(bytes memory lowLevelData_, bytes4 targetErrorSelector_)
internal
pure
returns (uint256 value1_);