Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

UniV2ExpectedOutCalculator

Git Source

Inherits: IExpectedOutCalculator

Expected output calculator that routes through a Uniswap V2 style router (SushiSwap).

Mirrors Milkman's implementation with updated pragma and without SafeMath.

State Variables

WETH

address internal constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;

NAME

string public NAME;

UNIV2_ROUTER

address public immutable UNIV2_ROUTER;

Functions

constructor

constructor(string memory name_, address univ2Router);

getExpectedOut

function getExpectedOut(
    uint256 amountIn,
    address fromToken,
    address toToken,
    bytes calldata
)
    external
    view
    override
    returns (uint256);