Open eliotstock opened 3 years ago
@eliotstock did you resolve the issue or get more information?
I did not resolve the issue, nor get more info, sorry.
I did not resolve the issue, nor get more info, sorry.
@eliotstock Could you provide more detail your first step when you create v3 position programmatically? Are you using the factory contract which is deployed by Uniswap or you deploy your own contract?
Sure. Here's what I do to create the position:
const position = Position.fromAmounts({
pool: rangeOrderPool,
tickLower: this.minTick,
tickUpper: this.maxTick,
amount0: availableUsdc,
amount1: availableWeth,
useFullPrecision: true
})
const mintOptions: MintOptions = {
slippageTolerance: CHAIN_CONFIG.slippageTolerance,
deadline: moment().unix() + DEADLINE_SECONDS,
recipient: wallet.address,
createPool: false
}
const { calldata, value } = NonfungiblePositionManager.addCallParameters(position, mintOptions)
const nonce = await wallet.getTransactionCount("latest")
const txRequest = {
from: wallet.address,
to: CHAIN_CONFIG.addrPositionManager,
value: VALUE_ZERO_ETHER,
nonce: nonce,
gasLimit: CHAIN_CONFIG.gasLimit,
gasPrice: CHAIN_CONFIG.gasPrice,
data: calldata
}
const txResponse: TransactionResponse = await wallet.sendTransaction(txRequest)
const txReceipt: TransactionReceipt = await txResponse.wait()
Hey EliotStock - I know it's been awhile, but are you still having this issue? If so, it would be helpful to know what version of the SDK you're using
Haven't been running this code lately, sorry. At the time I was using these versions:
"dependencies": {
"@uniswap/sdk-core": "^3.0.1",
"@uniswap/v3-core": "^1.0.0",
"@uniswap/v3-sdk": "^3.5.1",
...
},
im having issues minting a position with nonfungiblePositionManager. and this dont work for me on mainnet hardhat fork: const { Pool, Position, Route, TickMath, nearestUsableTick, tickSpacing } = require('@uniswap/v3-sdk');
Partial stack trace:
Steps to repro:
const position: Position = await positionManagerContract.positions(tokenId)
RemoveLiquidityOptions.liquidityPercentage
isnew Percent(1)
removeCallParameters
BigNumber
Also note that the docs don't explain how to get hold of an existing v3 position for passing to
removeCallParameters()