Skip to main content

TridentSushiRollCP

This contract migrates liquidity from a Uniswap V2 style pool to a Trident Constant Product Pool.

The full contract can be found here.

Functions

migrateLegacyToCP

function migrateLegacyToCP(
IUniswapV2Minimal pair,
uint256 amount,
uint256 swapFee,
bool twapSupport,
uint256 minToken0Received,
uint256 minToken1Received,
uint256 minLpReceived
) external returns (uint256 liquidity)

Migrates existing SushiSwap or other Uniswap V2 style pools to Trident and returns the amount migrated.

Parameters

NameTypeDescription
pairIUniswapV2MinimalUniswap V2 style liquidity pool address
amountuint256LP token balance to be migrated
swapFeeuint256swap fee of the CP pool being migrated into
twapSupportbooldoes CP pool moving into support TWAP oracles
minToken0Receiveduint256slippage protection for removing liquidity from UniV2 style pool
minToken1Receiveduint256slippage protection for removing liquidity from UniV2 style pool
minLpReceiveduint256slippage protection for minting liquidity on Trident CP pool

Returns

NameTypeDescription
liquidityuint256amount of liquidity migrated

migrateCP

function migrateCP(
IConstantProductPool currentPool,
uint256 amount,
uint256 swapFee,
bool twapSupport,
uint256 minToken0Received,
uint256 minToken1Received,
uint256 minLpReceived
) external returns (uint256 liquidity)

Migrates between Trident Constant Product pools with different fee / TWAP settings.

Parameters

NameTypeDescription
currentPoolIConstantProductPoolTrident CP address we want to migrate from (can be an outdated CP factory)
amountuint256LP token balance to be migrated
swapFeeuint256swap fee of the CP pool being migrated into
twapSupportbooldoes CP pool moving into support TWAP oracles
minToken0Receiveduint256slippage protection for removing liquidity from UniV2 style pool
minToken1Receiveduint256slippage protection for removing liquidity from UniV2 style pool
minLpReceiveduint256slippage protection for minting liquidity on Trident CP pool

Returns

NameTypeDescription
liquidityuint256amount of liquidity migrated