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.
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
Based on block: https://api.wandfi.io/api/v2/third/points/:vaultaddress/:block
Based on timestamp: https://api.wandfi.io/api/v2/third/points/:vaultaddress/:timestamp
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:
{ data: { address: string, balance: string }[], timestamp: number}
Abnormal state description:
400: Vault not started
404: Vault has not been created in this block yet
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:
User's Share = User's Balance / Amount
Determine the Total Points allocated to Vault for the period.
Calculate points for each user:
User's Points = Total Points × User's Share
Repeat these steps for each point issuance period, accumulating user points over time.
Last updated