Skip to main content

DeFi Integrations

Get contracts

Async function to load contracts holding LRTs on behalf of users.

Get user shares

Async function to load user shares between 2 blocks (inclusive). This function is called for all contracts returned by getContracts.
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:
chainIdblockuseramountvaultprotocol_address
110x011000x00x0
110x022000x00x0
110x03500x00x0
130x03200x00x0
140x011500x00x0
150x0200x00x0
  • At block 1, 0x01 owns ~28% of the user shares (100 / (100 + 200 + 50)), 0x02 owns ~57% and 0x03 owns ~14%.
  • At block 3, 0x03 underlying LRT balance changed, he now owns ~6% of the user shares (20 / (100 + 200 + 20)), while 0x01 owns ~31% and 0x02 owns ~62%.
  • At block 5, 0x02 withdrew all his funds from the protocol, he now owns 0% of the user shares, while 0x01 owns ~88.2% (150 / (150 + 20)) and 0x03 owns ~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