Minting a Position
This section explains how to create (or mint) a liquidity position on the Storyhunt V3 protocol.
Introduction
Giving Approval to Transfer Tokens
import { ethers, BigNumber } from 'ethers';
async function getTokenTransferApproval(address: string, amount: BigNumber) {
const provider = new ethers.providers.JsonRpcProvider(rpcUrl);
const tokenContract = new ethers.Contract(
address,
ERC20_ABI,
provider
);
return tokenContract.approve(
NONFUNGIBLE_POSITION_MANAGER_CONTRACT_ADDRESS,
amount
);
}
const token0Approval = await getTokenTransferApproval(token0Address, amount0);
const token1Approval = await getTokenTransferApproval(token1Address, amount1);