Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.lfg.rich/llms.txt

Use this file to discover all available pages before exploring further.

BNB Smart Chain addresses

ContractAddress
Factory0xaf6d6F359a630Ec6eb2BaFDc338b86d3E84CaF66
Uniswap V4 Hook0xCA8D8D8d3d97cfac290a3850d32c2E8330CCe888
Swap Router0x092043364f39f7f57C4E1D32116f453BfaE37440
Pool Manager0x28e2Ea090877bF75740558f6BFB36A5ffeE9e9dF
Official TokenEach token created by the Factory has its own token address.

ABI format

The ABI constants below use the human-readable string format with functions and events only. This is the most readable format for integration examples and works directly with Ethers. Custom errors are kept in the full JSON ABI files, but are intentionally omitted here to keep this page easier to scan.
const contract = new ethers.Contract(address, FACTORY_ABI, signerOrProvider);
Viem also accepts human-readable ABI strings when using parseAbi:
import { parseAbi } from 'viem';

const abi = parseAbi(FACTORY_ABI);
const owner = await publicClient.readContract({
  address: FACTORY_ADDRESS,
  abi,
  functionName: 'owner',
});
The /abis/*.abi.json files are still available for developers who prefer the standard JSON ABI format or need the full ABI including custom errors.

Full ABI pages

Factory ABI

Full JSON ABI reference for token creation, token lookup, pool keys, and factory events.

Uniswap V4 Hook ABI

Full JSON ABI reference for protocol state, estimates, borrowing, repayment, and hook callbacks.

Token ABI

Full JSON ABI reference for official LFG.RICH token contracts.

Swap Router ABI

Full JSON ABI reference for user-facing buy and sell execution.

Factory

The Factory creates official LFG.RICH tokens and stores token metadata, creator information, pool IDs, and pool keys.
export const FACTORY_ABI = [
  "function owner() view returns (address)",
  "function poolManager() view returns (address)",
  "function hook() view returns (address)",
  "function creationFee() view returns (uint256)",
  "function POOL_FEE() view returns (uint24)",
  "function TICK_SPACING() view returns (int24)",
  "function INIT_SQRT_PRICE() view returns (uint160)",
  "function allTokens(uint256 index) view returns (address)",
  "function tokenToCreator(address token) view returns (address)",
  "function tokenInfoMap(address token) view returns (address tokenAddress, uint256 tokenId, address creator, string name, string symbol, bytes32 poolId)",
  "function createToken(string name, string symbol, uint256 totalFeeBps) payable returns (address token, bytes32 poolId)",
  "function setCreationFee(uint256 newFee)",
  "function transferOwnership(address newOwner)",
  "function withdrawAll(address to)",
  "function totalTokens() view returns (uint256)",
  "function isOfficialToken(address token) view returns (bool)",
  "function getTokenInfo(address token) view returns (tuple(address tokenAddress, uint256 tokenId, address creator, string name, string symbol, bytes32 poolId))",
  "function getUserTokens(address user) view returns (address[])",
  "function getPoolKey(address token) view returns (tuple(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks))",
  "event TokenCreated(address indexed token, uint256 indexed tokenId, address indexed creator, string name, string symbol, bytes32 poolId)",
  "event CreationFeeUpdated(uint256 oldFee, uint256 newFee)",
  "event Withdrawn(address indexed to, uint256 amount)",
] as const;

Uniswap V4 Hook

The Hook contains the protocol mechanics for registration, pricing, buy/sell accounting, floor support, borrowing, and repayment.
export const UNISWAP_V4_HOOK_ABI = [
  "function BPS_DENOMINATOR() view returns (uint256)",
  "function PLATFORM_FEE_BPS() view returns (uint256)",
  "function BORROW_FEE_BPS() view returns (uint256)",
  "function BASE_FLOOR_RATIO_BPS() view returns (uint256)",
  "function FLOOR_RESERVE_MAX_BPS() view returns (uint256)",
  "function COLLATERAL_RATIO_BPS() view returns (uint256)",
  "function MAX_SUPPLY() view returns (uint256)",
  "function DUST_THRESHOLD() view returns (uint256)",
  "function TARGET_ETH() view returns (uint256)",
  "function SQRT_TARGET_ETH() view returns (uint256)",
  "function MIN_SWEEP_AMOUNT() view returns (uint256)",
  "function POOL_FEE() view returns (uint24)",
  "function POOL_MANAGER() view returns (address)",
  "function FACTORY() view returns (address)",
  "function K() view returns (uint256)",
  "function tokenStates(bytes32 poolId) view returns (address token, uint256 totalFeeBps, uint256 floorPrice, uint256 realETH, uint256 virtualETH, uint256 totalBorrowedETH, uint256 collateralSupply, uint256 floorBoostPool, uint256 totalReserveAccumulated, uint256 allTimeHighPrice, bool initialized)",
  "function tokenToPoolId(address token) view returns (bytes32)",
  "function borrowedETH(bytes32 poolId, address user) view returns (uint256)",
  "function collateralBalance(bytes32 poolId, address user) view returns (uint256)",
  "function totalPurchasedETH(address user) view returns (uint256)",
  "function registerToken(address token, bytes32 poolId, uint256 totalFeeBps)",
  "function effectiveETH(bytes32 poolId) view returns (uint256)",
  "function getEffectivePrice(bytes32 poolId) view returns (uint256)",
  "function circulatingSupply(bytes32 poolId) view returns (uint256)",
  "function estimateBuy(bytes32 poolId, uint256 ethIn) view returns (uint256 tokensOut, uint256 platformFee, uint256 floorBoostFee)",
  "function estimateSell(bytes32 poolId, uint256 tokenAmount) view returns (uint256 ethOut, uint256 platformFee, uint256 floorBoostFee)",
  "function estimateBorrowMore(bytes32 poolId, address user) view returns (uint256 additionalEth, uint256 fee)",
  "function getHookPermissions() pure returns (tuple(bool beforeInitialize, bool afterInitialize, bool beforeAddLiquidity, bool afterAddLiquidity, bool beforeRemoveLiquidity, bool afterRemoveLiquidity, bool beforeSwap, bool afterSwap, bool beforeDonate, bool afterDonate, bool beforeSwapReturnDelta, bool afterSwapReturnDelta, bool afterAddLiquidityReturnDelta, bool afterRemoveLiquidityReturnDelta))",
  "function borrow(bytes32 poolId, uint256 amount)",
  "function borrowMore(bytes32 poolId)",
  "function repay(bytes32 poolId) payable",
  "function beforeInitialize(address, tuple(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, uint160) returns (bytes4)",
  "function beforeAddLiquidity(address, tuple(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks), tuple(int24 tickLower, int24 tickUpper, int256 liquidityDelta, bytes32 salt), bytes) returns (bytes4)",
  "function beforeSwap(address, tuple(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, tuple(bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96) params, bytes hookData) returns (bytes4 selector, int256 delta, uint24 lpFeeOverride)",
  "event TokenRegistered(address indexed token, bytes32 indexed poolId, uint256 totalFeeBps)",
  "event Buy(bytes32 indexed poolId, address indexed buyer, uint256 ethIn, uint256 tokensOut, uint256 newPrice)",
  "event Sell(bytes32 indexed poolId, address indexed seller, uint256 tokensIn, uint256 ethOut, uint256 newPrice)",
  "event FloorRaised(bytes32 indexed poolId, uint256 oldFloor, uint256 newFloor)",
  "event ATHUpdated(bytes32 indexed poolId, uint256 oldATH, uint256 newATH)",
  "event Borrow(bytes32 indexed poolId, address indexed user, uint256 tokensLocked, uint256 ethBorrowed, uint256 fee)",
  "event BorrowMore(bytes32 indexed poolId, address indexed user, uint256 additionalEth, uint256 fee)",
  "event Repay(bytes32 indexed poolId, address indexed user, uint256 ethRepaid, uint256 tokensUnlocked)",
  "event Sweep(bytes32 indexed poolId, uint256 amount)",
  "event DustCollected(bytes32 indexed poolId, uint256 amount)",
] as const;

Token

Each official LFG.RICH token follows the same token ABI. The Hook is the only contract allowed to mint and burn protocol tokens after the Factory locks the Hook address.
export const TOKEN_ABI = [
  "function FACTORY() view returns (address)",
  "function hook() view returns (address)",
  "function hookLocked() view returns (bool)",
  "function setHook(address _hook)",
  "function mint(address to, uint256 amount)",
  "function burn(address from, uint256 amount)",
  "function increaseAllowance(address spender, uint256 addedValue) returns (bool)",
  "function decreaseAllowance(address spender, uint256 subtractedValue) returns (bool)",
  "function name() view returns (string)",
  "function symbol() view returns (string)",
  "function decimals() view returns (uint8)",
  "function totalSupply() view returns (uint256)",
  "function balanceOf(address account) view returns (uint256)",
  "function transfer(address to, uint256 amount) returns (bool)",
  "function allowance(address owner, address spender) view returns (uint256)",
  "function approve(address spender, uint256 amount) returns (bool)",
  "function transferFrom(address from, address to, uint256 amount) returns (bool)",
  "event Transfer(address indexed from, address indexed to, uint256 value)",
  "event Approval(address indexed owner, address indexed spender, uint256 value)",
] as const;

Swap Router

The Swap Router is the user-facing contract for triggering LFG.RICH buys and sells through the protocol PoolKey.
export const SWAP_ROUTER_ABI = [
  "function poolManager() view returns (address)",
  "function buy(tuple(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, uint256 minTokensOut) payable",
  "function sell(tuple(address currency0, address currency1, uint24 fee, int24 tickSpacing, address hooks) key, uint256 tokenAmount, uint256 minEthOut)",
  "function unlockCallback(bytes data) returns (bytes)",
] as const;