> For the complete documentation index, see [llms.txt](https://docs.wandfi.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wandfi.io/products/yield-vault-v2/points-tracking.md).

# Points Tracking

Rewards in the form of Points calculated off-chain, the following method is required for integration.

### Mechanism

Yield-Vault comprises PT, YT, BT, and LP.&#x20;

* Principal Token (PT): Users receive a fixed yield in exchange for no yield and points.
* Yield Token(YT): 1 YT receives the yields and points generated by 1 underlying asset.
* Base Token(BT): :1 BT receives the yields and points generated by 1 underlying asset.
* Liquidity Providers(LP): Since LP is made up of BT + YT + PT, users will also receive some points exposure from the BT and YT in the LP

For developers, there's no need to analyze the complex mechanisms here; simply follow the methods below to complete the integration.

### Points Tracking Method

This method applies to continuous point issuance, such as protocols that distribute points based on TVL daily or per hour/block. Yield-Vault’s TVL earns points in the protocol’s system, and these points should be passed through to users, not retained by Yield-Vault. The implementation is as follows:

* Wand provides a JSON file

&#x20;      Based on block: **<https://api.wandfi.io/api/v2/third/points>**<mark style="color:red;">**/:vaultaddress/:block**</mark>                                 &#x20;

&#x20;      Based on timestam&#x70;**:   <https://api.wandfi.io/api/v2/third/points>**<mark style="color:red;">**/:vaultaddress/timestamp/:timestamp**</mark>

* Inputs the relevant parameter to query the JSON file for the user list and their balances. Wand has standardized the holdings of BT, YT, and LP users' underlying assets into a unified balance. The data structure is as follows:

&#x20;    **{ data: { address: string, balance: string }\[], timestamp: number}**

&#x20;      Abnormal state description:

&#x20;      400: Vault not started

&#x20;      404: Vault has not been created in this block yet

&#x20;      500: Needs to wait for server indexing data

#### Method 1

The sum of these Balances represents the underlying assets held by the Vault, and you can directly use the Balance data to calculate use's points according to your rules.

#### Method 2

First, calculate the Vault's points based on your rules, then allocate them to users proportionally. The calculation process for this method is as follows:

* Sum all **Balances** to calculate the total **Amount**.
* Calculate a user’s **Share**:&#x20;

&#x20;      **User's** **Share = User's Balance /  Amount**

* Determine the Total Points allocated to Vault for the period.
* Calculate points for each user:

&#x20;      **User's Points = Total Points × User's Share**

* Repeat these steps for each point issuance period, accumulating user points over time.

{% hint style="info" %}
Example

A protocol distributes points daily at 12:00 UTC.

* Day 1: Vault is allocated 1,000 points.
* Input the block or timestamp parameter to query the JSON file, retrieving balances for all users, including Alice.
* Calculate Alice’s Share, e.g., 1%.
* Allocate 10 points (1,000 × 1%) to Alice for Day 1.
* Day 2: More users come in, diluting Alice’s Share to 0.5%.
* Vault is allocated 1,200 points for Day 2.
* Alice earns 6 points (1,200 × 0.5%) for Day 2.
* By the end of Day 2, Alice has accumulated 16 points.
  {% endhint %}
