-
Notifications
You must be signed in to change notification settings - Fork 5k
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 the TVL Calculation for Joltify RWA Adapter #10628
Conversation
The adapter at projects/joltify-rwa exports TVL:
|
const [market, borrowed_denom] = pool.borrowed_amount.denom.split('-'); | ||
const market_id = `${market}:usd`; | ||
const price = price_info.prices.find(price => price.market_id === market_id)?.price; | ||
api.add(borrowed_denom, pool.borrowed_amount.amount * price); |
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.
this is already counted as part of borrowed
api.add(pool.usable_amount.denom, pool.usable_amount.amount); | ||
api.add(pool.escrow_principal_amount.denom, pool.escrow_principal_amount.amount); |
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.
what is the difference between usable_amount and escrow_principal_amount?
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.
The escrow_principal_amount.amount indicates the principal repaid by the SPV and locked into the pool so that the investors can claim their investing assets from the pool once the due time reached.
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.
Similar to escrow_interest_amount, which indicates the repaid interest by the SPV.
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.
The usable amount is the asset amount invested or put in the pool by users/investors for the SPV to borrow.
Basically, the escrow_principal and escrow_interest in the pool are from the SPV/borrower, the usable amount in the pool are from the users/investors.
api.add(pool.usable_amount.denom, pool.usable_amount.amount); | ||
api.add(pool.escrow_principal_amount.denom, pool.escrow_principal_amount.amount); | ||
api.add(pool.escrow_principal_amount.denom, pool.escrow_interest_amount); |
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.
we only count the amount locked in protocol as tvl, for example, the borrower might be insolvent and never pay back the loan, then this value will keep going up (this has already happened in a few hacked protocols)
ah ,thanks for the details, will merge the and removed the borrowed amount counted towards tvl. |
Hey, @g1nt0ki , we involve this borrowed amount in the TVL calculation due to the difference between traditional digital lending and RWA lending. I understand the concept of RWA lending can be quite confusing. To help clarify, I've compared it to digital lending. Hopefully, this side-by-side comparison brings more clarity. It's important to note that the TVL is not double-counted; it is calculated as 100 (User A's deposit) + 100 (User B's deposit) - 80 (User A's withdrawal) = 120, reflecting the accurate value locked within the protocol after User A's token withdrawal. In the case of Real-World Asset (RWA) lending, a Special Purpose Vehicle (SPV) entity, let's call it 'C,' utilizes contracts collateralized by assets like bonds or other securities to borrow 100 dollars from User D. In this scenario, the SPV mints a 100 dollar Non-Fungible Token (NFT) backed by real-world assets, and User D deposits 100 worth of USDT/USDC into the protocol. Consequently, User D receives the 100 dollar NFT as proof of ownership, which remains within the protocol, while the SPV takes out the 100 USDT/USDC. In this scenario, the protocol maintains a TVL of 100, calculated as the sum of the 100 dollar NFT and the 100 USDT/USDC initially deposited by User D, minus the 100 USDT/USDC withdrawn by the SPV. The TVL is not double-counted, as it accurately reflects the stablecoins taken out of the protocol, while the NFT representing the RWA remains locked within. It's crucial to acknowledge that the collateral's value may fluctuate or even collapse over time, potentially decreasing the corresponding NFT's value. To address this, we will continuously assess and update the NFT's value based on the underlying collateral's performance. For example, in the event of a default, the NFT's value will be adjusted accordingly, reflecting the outcome of legal proceedings and the realization of the underlying RWA's value. Our protocol will dynamically update these valuations to ensure transparency and accurate representation of the locked assets. |
hi @briangarden I understand your POV but we cant verify the NFT/off chain collateral value, this is why it is not included in tvl. We have done the same for other rwa lending protocols that we have listed. |
This PR aims to update Joltify RWA adapter.