Skip to content

DexActionEstimates ​

Git Source

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

NameTypeDescription
dex_addressDex pool
swap0to1_boolDirection of swap. If true, swaps token0 for token1; if false, swaps token1 for token0
amountIn_uint256The exact amount of input tokens to swap
amountOutMin_uint256The minimum amount of output tokens the user is willing to accept

Returns

NameTypeDescription
amountOut_uint256The 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

NameTypeDescription
dex_addressDex pool
swap0to1_boolDirection of swap. If true, swaps token0 for token1; if false, swaps token1 for token0
amountOut_uint256The exact amount of tokens to receive after swap
amountInMax_uint256Maximum amount of tokens to swap in

Returns

NameTypeDescription
amountIn_uint256The amount of input tokens used for the swap

_decodeLowLevelUint1x ​

solidity
function _decodeLowLevelUint1x(bytes memory lowLevelData_, bytes4 targetErrorSelector_)
    internal
    pure
    returns (uint256 value1_);