So basically I am trying to mint a position in a pool created by me.
To create and initialise the pool:
const factory = await ethers.getContractAt("UniswapV3Factory", factoryAddress)
let poolAddress = await factory.getPool("0x40a42Baf86Fc821f972Ad2aC878729063CeEF403", "0x4bf010f1b9beDA5450a8dD702ED602A104ff65EE", 500);
const pool = await ethers.getContractAt("UniswapV3Pool", poolAddress);
try{
await pool.initialize(BigNumber.from(2).pow(96));
} catch(exception){
console.log("Pool already initialized");
}
Then to try to had liquidity I tried this:
let signer = await ethers.getSigner("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266");
await pool.connect(signer).mint(signer.address,-20,20,10000000,[]);
I realise it is missing the transfer of the tokens (which is suposed to come in a callback of the mint function) but I don't know how to implement it! Any ideas?
Or is this simply the wrong approach and there is a better on?