-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Royco TVL to include corrected calculations for Recipe and Vau… #12925
base: main
Are you sure you want to change the base?
Conversation
The adapter at projects/royco exports TVL:
|
); | ||
|
||
if (currTimestampInSeconds.isLessThan(endTimestampInSeconds)) { | ||
api.add(incentiveTokenId, incentiveTokenAmount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we read balances from the chain using an rpc instead? propietary apis are fine for reading config data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not possible to read balances directly from chain data because of following limitations:
- For Vault Markets:
- The wrapped vault is a wrapper around another ERC4626 vault and therefore, wrapped vault itself holds no assets
- The previously committed version of royco TVL was counting balances of issued vault tokens of Wrapped Vault, rather than the assets deposited by the wrapped vault into the underlying ERC4626 vault -- this was making significant amount of TVL being excluded in summation
- For Recipe Markets:
- The assets are deposited & withdrawn by the weiroll script (this is an arbitrary sequence of transactions which will differ for each market, like swap into some other token, then deposit half in one contract, rest in another, etc.) -- so we can't deterministically find the token address and it's token amount
- The amount deposited and received is not being stored on-chain, and is only emitted as an event -- these events are then indexed by subgraph, to calculate what amount is currently present inside the market
- The events are interdependent on one another, for example: in order to find out how much an LP deposited into the market, first we need to find the event that LP filled -> this gives the address of weiroll wallet (this wallet is generated uniquely every time an LP fills a position) -> then we need to find the offer id which was filled -> based on offer id, we need to find the IP event that had made the offer, this gives us the corresponding market id -> based on market id, we need to find the Market Creation event, this gives us the input asset that was deposited -> finally, this gives us liquidity of one one position of an LP -> Now, we need to find all positions of all LPs inside all markets -> therefore, this requires a cumulative calculation, rather than on-demand -- so we are doing them in subgraph.
Moreover, the entire code of subgraph is open-source and can be referenced in this repo: https://github.com/roycoprotocol/royco-subgraphs-template
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @githubotoro
For vault markets, noticed that we are not pricing some of the erc4626 tokens, we will fix it.
For Recipe markets, you dont hold user funds right? they do some action and you rewards wallets later right? if this is the case, we cant count it as your tvl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @g1nt0ki --
Re: Vault markets - got it, sounds good.
Re: Recipe markets - it's the same as an Aave deposit in that a user has custody, but it's being held within the protocol. The user are fractured into independent Weiroll wallets to protect their main wallet from malicious scripts and also enforce a timelock. The assets doing the action within the protocol are inside the Weiroll wallet. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jbhav24 hmm, maybe I am confusing this with a different project that computes rewards off chain.
But the tokens dont end up in weiroll wallets right (btw, are they smart contract)? for example, this statestone vault is part of recipe market right? https://app.stakestone.io/u/vault/detail/bera but the tokens remain in the vault arm?
The adapter at projects/royco exports TVL:
|
…lt Markets
NOTE
Please enable "Allow edits by maintainers" while putting up the PR.
package-lock.json
file as part of your changes, we use lockfileVersion 2, and most use v1 and using that messes up our CIName (to be shown on DefiLlama):
Twitter Link:
List of audit links if any:
Website Link:
Logo (High resolution, will be shown with rounded borders):
Current TVL:
Treasury Addresses (if the protocol has treasury)
Chain:
Coingecko ID (so your TVL can appear on Coingecko, leave empty if not listed): (https://api.coingecko.com/api/v3/coins/list)
Coinmarketcap ID (so your TVL can appear on Coinmarketcap, leave empty if not listed): (https://api.coinmarketcap.com/data-api/v3/map/all?listing_status=active,inactive,untracked&start=1&limit=10000)
Short Description (to be shown on DefiLlama):
Token address and ticker if any:
Category (full list at https://defillama.com/categories) *Please choose only one:
Oracle Provider(s): Specify the oracle(s) used (e.g., Chainlink, Band, API3, TWAP, etc.):
Implementation Details: Briefly describe how the oracle is integrated into your project:
Documentation/Proof: Provide links to documentation or any other resources that verify the oracle's usage:
forkedFrom (Does your project originate from another project):
methodology (what is being counted as tvl, how is tvl being calculated):
Github org/user (Optional, if your code is open source, we can track activity):