subgraphs
subgraphs copied to clipboard
Notional-Finance Ethereum: Revenue and TVL calculation issues
TVL: TVL is currently being calculated by adding deposits and subtracting withdrawals. This doesn't take into account the interest generated.
@dmelotik suggested using the contract calls that will return real amounts.
Revenue: If the subgraph is only taking interest paid via the net fcash amount bought and sold the docs recommends the following: Revenue from lending and borrowing service. Interests paid by borrowers to lenders. Different from Aave or Compound, Notional operates like a trading platform of zero-interest coupon (buying and selling fCASH), so the interests paid by borrowers to lenders do not accrue per block, but rather happens when each trade takes place. To simplify, we take the difference between the cTOKEN value and fCASH future value as the interest paid. For any given period, the higher of borrowing interests paid (selling fCASH) and lending interest paid (buying fCASH) is the interest revenue for that period. For more details please refer to Appendix: Consideration on Interest Revenue For Notional. To simplify, the formula of Notional's lending and borrowing revenue is:
Revenue = value of fCASH transacted
* interest rate annualized
* (loan duration in days / 365)
This doesn't take into account the 0.3% exchange fees.
The current subgraph is calculating this as: amountUSD
* .3%
= revenue
with 80% to supply.
but this is the total revenue of the exchange and not the lending protocol. The revenue from exchange is 80% protocol and 20% supply. the docs say this is not what is being measured here.
@fortysevenlabs DMing you on discord
-Add to document whether account level data is included in TVL. -Add to document how TVL is calculated sum of pool (deposits-withdrawals)
zero out the total borrow balance.
Related issue here: https://github.com/messari/subgraphs/issues/1765
@dhruv-chauhan can you take this issue over? You should have a good understanding of where this is at and what the next steps are by reading through the current PR: https://github.com/messari/subgraphs/pull/1725
Feel free to reuse any code in that PR too
@dmelotik I picked this back yesterday since arbitrum and across are finished (dev finished, in-qa). I'll go ahead and push out the changes this weekend. May be @dhruv-chauhan can review and thumbs up. Sound good?
sgtm @fortysevenlabs
@ishraq8 fix for notional here: https://okgraph.xyz/?q=fortysevenlabs%2Fnotional-finance-ethereum
- pending version - includes all market pools, use this for full QA
- current version - used this to test supply side revenue for a single market pool 3-1640736000, use this for single market pool QA
new version syncing failed for this/
@ishraq8 Use the current version (the pending version synced, current failed pending version is intentional) https://subgraphs.messari.io/subgraph?endpoint=https://api.thegraph.com/subgraphs/id/QmTFvfuzGQRamaCbEVpcMV5kruGTXoV9hn4R4qqMxLKs9L&tab=protocol