Skip to main content

Goal

Enable any front-end, analytics dashboard, or smart-contract to obtain the total locked value (TVL) and factory origin of a token or LP pair in a single call, then drill down into individual locks only when needed.

Quick Reads

1. Total Locked Value for a Token / LP

TokifyLock.cumulativeLockInfo(address token)

→ (token, factory, amount)
One call gives you the live total locked and the Uniswap-v2 factory (zero for normal tokens). Example – off-chain (ethers v6):
const [token, factory, amount] = await lockContract.cumulativeLockInfo(lpToken);

const locked = ethers.formatUnits(amount, 18); // human-readable
Example – on-chain (Solidity):
lp(uint256 totalLocked,,) = TokifyLock(lockAddr).cumulativeLockInfo(_token);

require(totalLocked >= minLock, "Insufficient locked liquidity");

2. is it an LP Pair?

factory != address(0) → LP token factory == address(0) → normal ERC-20

3. Paginated Lock Details for a Token

TokifyLock.getLocksForToken(token, startIdx, endIdx)

→ Lock[] memory
Returns every lock (id, owner, amount, tgeDate, tgeBps, cycle, cyleBps, unlockedAmount, description) for the token in the requested range. Use with totalLockCountForToken(token) to build paginated UI tables.

Events to Watch

EventUse
LockAddedNew lock created → refresh cumulative.
LockUpdatedAmount changed → refresh cumulative.
LockRemoved / LockVestedTokens released → refresh cumulative.