Point Integration

This guide explains how to track user positions in Napier markets and calculate their underlying token exposure to support points systems, airdrops, or reward campaigns

Token Mechanism

Napier users can interact with the protocol via:

PT (Principal Token)

  • Represents the principal portion of a yield position

  • Does not earn any points

  • Holds the underlying token

YT (Yield Token)

  • Represents the floating yield portion

  • Users earn points based on their proportional share of the underlying tokens stored in PT

LP Token

  • Represents liquidity in the Napier AMM (includes PT + YT)

  • LP holders earn points based on their share of the underlying tokens stored in the LP contract

Script Mechanism

You can track user balances and compute their total underlying exposure using our open-source integration script.

The script:

  1. Fetches balances for YT and LP holders of the configured market at certain block number

  2. Calculates each user's underlying token exposure

    1. For YT → it’s based on underlying stored in the PT contract

    2. For LP → It’s based on underlying stored in the pool

  3. Aggregates and exports the result to a CSV file

How to Use the Script

1. Clone & install dependencies

Go to Point Integration Example and install the dependency

git clone <https://github.com/napierfi/point-integration-example>
cd point-integration-example
pnpm install

2. Configure src/configuration.ts

Available config are:

  1. chainId of your market

  2. markets is the pt addresses of the market you want to snapshot

  3. blockNumber the block number of the snapshot period

export const configuration = {
  chainId: 1,
  markets: ['0x8eb9f9e97d6a63aab7572ad0d96fa3f09255cce9'],
  blockNumber: 22160745,
};

Finding address

You can use the Napier Interface (app.napier.finance) to find address of your market

3. Run the Script

pnpm start

4. Examine the output

Output of the script is generated as csv with the filename below

user_balances_lp.csv
user_balances_yt.csv

Output Format

The script generates two CSV (one for LP and one for YT) formatted like this:

address,balances
0x1234...abcd, 3524219
0xabcd...5678, 1980132

Each row represents a user address and their total underlying exposure (from YT or LP).


How to Verify Results

You can verify a user's calculated exposure manually:

YT Verification

Formula

underlying.balanceOf(pt) * yt.balanceOf(user) / yt.totalSupply()

Checking via etherscan

  1. Check the underlying holding of PT contract

  2. Using value above we can calculate

underlying proportion = 16.2994% * 1,008,799 = 164,428.184206

LP Verification

Formula

underlying.balanceOf(lp) * lp.balanceOf(user) / lp.totalSupply()

Checking via etherscan

  1. Check the underlying holding of LP contract

  2. Using value above we can calculate

underlying proportion = 15.5851% * 1,102,728 = 171.861,261528

Post Maturity

Once a market matures:

  • YT no longer accrues yield

  • Points tracking should stop

Last updated