Skip to main content

OpenMevZapperV01

Provides an optimal UniswapV2Pair Liquidity deposits and withdrawls with a single token / eth (or relevant native currency)

Functions

constructor

  function constructor(
) public

receive

  function receive(
) external

withdrawLiquidityAndSwap

  function withdrawLiquidityAndSwap(
address pairAddress,
uint256 withdrawAmount,
address desiredToken,
uint256 desiredTokenOutMin
) external returns (uint256 amountOut)

Removes liquidity from an ERC-20⇄ERC-20 pool into a single token / ETH . msg.sender should have already given the zapper an allowance of at least liquidity on the pool.

Parameters:

NameTypeDescription
pairAddressaddressAddress of V2 pool
withdrawAmountuint256Amount of liquidity to withdraw
desiredTokenaddressWithdrawl token desired
desiredTokenOutMinuint256Minimum amount of total desiredToken, can be 0

Return Values:

TypeDescription
uint256amountOut Amount of desiredToken received

swapAndStakeLiquidity

  function swapAndStakeLiquidity(
address tokenA,
address tokenB,
uint256 amountA,
uint256 amountBMin
) external returns (uint256 liquidity)

/ @notice Adds liquidity to an ERC-20⇄ERC-20 pool from a single token. msg.sender should have already given the router an allowance of at least amountA on tokenA

Parameters:

NameTypeDescription
tokenAaddressToken in pool
tokenBaddressToken in pool
amountAuint256Amount of token A desired to add to pool, inclusive of swap half to tokenB
amountBMinuint256Minimum amount of token B on swap, can be 0

Return Values:

TypeDescription
uint256liquidity amount of liquidity token received, sent to msg.sender

swapETHAndStakeLiquidity

  function swapETHAndStakeLiquidity(
address tokenB,
uint256 amountBMin
) external returns (uint256 liquidity)

Adds liquidity to an ERC-20⇄ERC-20 pool from eth. msg.value is treated as a amountETHDesired. Leftover ETH, if any, is returned to msg.sender

Parameters:

NameTypeDescription
tokenBaddressToken in pool
amountBMinuint256Minimum amount of token B on swap, can be 0

Return Values:

TypeDescription
uint256liquidity amount of liquidity token received, sent to msg.sender
f