Collecting Fees
This section explains how to collect fees from a liquidity position on the Storyhunt V3 protocol.
Introduction
Setting Up Fee Collection
import { ethers } from 'ethers';
import JSBI from 'jsbi';
const nfpmContract = new ethers.Contract(
NONFUNGIBLE_POSITION_MANAGER_ADDRESS,
INONFUNGIBLE_POSITION_MANAGER.abi,
provider
);
const position = await nfpmContract.positions(positionId);import { CurrencyAmount } from '@storyhunt/sdk-core';
const collectOptions: CollectOptions = {
tokenId: positionId,
expectedCurrencyOwed0: CurrencyAmount.fromRawAmount(
CurrentConfig.tokens.token0,
JSBI.BigInt(position.tokensOwed0)
),
expectedCurrencyOwed1: CurrencyAmount.fromRawAmount(
CurrentConfig.tokens.token1,
JSBI.BigInt(position.tokensOwed1)
),
recipient: address,
};