Pendle system wraps rswETH into an ERC5115 token SY.
SY can then be used in Pendle's system to:
- Tokenize into
PTandYT, whereYTholders are entitled to all interests and rewards. - Supply into Pendle's AMM to receive
LPtoken.
LP token can then be deposited into Liquid Lockers platform (Penpie, Equilibira, StakeDAO) to enhance their yield.
We built a subgraph tracking Transfer events from all above-mentioned tokens and update addresses' balance accordingly.
- Add up shares for users with
SYbalance (excludingYTandLPaddresses). - Calculate according shares for
YTaddress, add up shares proportionally for users holdingYT. - Calculate according shares for
LPaddress, add up shares proportionally for users (excluding liquid lockers addresses). - For each liquid locker, we calculate their according share and distribute proportionally to their receipt token holders.
The function of fetchUserBalanceSnapshot(blockNumber) in ./src/snapshot.js returns a record mapping of [address] => ethers.BigNumber, representing the implied amount of rswETH each address is holding at the specified block.
A simple check can be applied to the result of the script, by checking whether the sum of returned values for all users would not exceed the amount of rswETH held in SY contract.