DeFi points integration instructions
This page is dedicated for DeFi protocols utilizing Mellow LRTs and helps to setup points distribution for legitimate users of DeFi protocol.
DeFi Integrations
Get contracts
Async function to load contracts holding LRTs on behalf of users.
getContracts: (params: GetContractsParams) => Promise<DeFiContract[]> | DeFiContract[];Get user shares
Async function to load user shares between 2 blocks (inclusive).
This function is called for all contracts returned by getContracts.
getUserShares: (params: GetUserSharesParams) => Promise<IDeFiUserShare[]> | IDeFiUserShare[];A user share represents the amount of LRT owned by an address pro-rata to others.
User shares are sorted by block and a new entry must be added each time LRT ratios change.
Example:
1
0x01
100
0x0
0x0
1
0x02
200
0x0
0x0
1
0x03
50
0x0
0x0
3
0x03
20
0x0
0x0
4
0x01
150
0x0
0x0
5
0x02
0
0x0
0x0
At block 1,
0x01owns ~28% of the user shares (100 / (100 + 200 + 50)),0x02owns ~57% and0x03owns ~14%.At block 3,
0x03underlying LRT balance changed, he now owns ~6% of the user shares (20 / (100 + 200 + 20)), while0x01owns ~31% and0x02owns ~62%.At block 5,
0x02withdrew all his funds from the protocol, he now owns 0% of the user shares, while0x01owns ~88.2% (150 / (150 + 20)) and0x03owns ~11.8% (20 / (150 + 20)).
Get user balances (optional)
Optional async function to load user balances (if they're not 1:1 to user shares).
This function is called for all contracts returned by getContracts.
Example
Interface
Last updated