Skip to content

Commit

Permalink
remove mint
Browse files Browse the repository at this point in the history
  • Loading branch information
dianakocsis committed Feb 7, 2025
1 parent 567c20b commit 4bff884
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 43 deletions.
5 changes: 0 additions & 5 deletions sdks/universal-router-sdk/src/swapRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ export interface MigrateV3ToV4Options {
v4AddLiquidityOptions: V4AddLiquidityOptions
}

// function isMint(options: V4AddLiquidityOptions): options is MintOptions {
// return 'recipient' in options
// }

function isMigrate(options: V4AddLiquidityOptions): options is MintOptions {
return 'migrateOptions' in options && options.migrateOptions?.migrate === true
}
Expand Down Expand Up @@ -119,7 +115,6 @@ export abstract class SwapRouter {
'RECIPIENT_NOT_POSITION_MANAGER'
)
// Migration must be a mint operation, not an increase because the UR should not have permission to increase liquidity on a v4 position
//invariant(isMint(options.v4AddLiquidityOptions), 'MINT_REQUIRED')
invariant(isMigrate(options.v4AddLiquidityOptions), 'MIGRATE_REQUIRED')

const planner = new RoutePlanner()
Expand Down
39 changes: 1 addition & 38 deletions sdks/universal-router-sdk/test/uniswapTrades.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2381,43 +2381,6 @@ describe('Uniswap', () => {
expect(() => SwapRouter.migrateV3ToV4CallParameters(opts)).to.throw('BURN_TOKEN_REQUIRED')
})

it('throws if not minting when migrating', async () => {
const opts = Object.assign({
inputPosition: new Position({
pool: USDC_DAI_V3,
liquidity: 1,
tickLower: -USDC_DAI_V3.tickSpacing,
tickUpper: USDC_DAI_V3.tickSpacing,
}),
outputPosition: new V4Position({
pool: USDC_DAI_V4,
liquidity: 1,
tickLower: -USDC_DAI_V4.tickSpacing,
tickUpper: USDC_DAI_V4.tickSpacing,
}),
v3RemoveLiquidityOptions: {
tokenId: 1,
liquidityPercentage: new Percent(100, 100),
slippageTolerance: new Percent(5, 100),
deadline: 1,
burnToken: true,
collectOptions: {
expectedCurrencyOwed0: CurrencyAmount.fromRawAmount(USDC, 0),
expectedCurrencyOwed1: CurrencyAmount.fromRawAmount(WETH, 0),
recipient: CHAIN_TO_ADDRESSES_MAP[ChainId.MAINNET].v4PositionManagerAddress,
},
},
v4AddLiquidityOptions: {
migrate: true,
deadline: 1,
slippageTolerance: new Percent(5, 100),
sqrtPriceX96: encodeSqrtRatioX96(1, 1),
// no recipient option means not minting
},
})
expect(() => SwapRouter.migrateV3ToV4CallParameters(opts)).to.throw('MINT_REQUIRED')
})

it('throws if migrating weth to eth with token mismatch', async () => {
const opts = Object.assign({
inputPosition: new Position({
Expand Down Expand Up @@ -2445,7 +2408,7 @@ describe('Uniswap', () => {
},
},
v4AddLiquidityOptions: {
migrate: true,
migrateOptions: { migrate: true },
deadline: 1,
slippageTolerance: new Percent(5, 100),
sqrtPriceX96: encodeSqrtRatioX96(1, 1),
Expand Down

0 comments on commit 4bff884

Please sign in to comment.