Skip to content

fix: collateral tvl not being accounted #14458

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

Merged
merged 3 commits into from
Apr 30, 2025

Conversation

0xhitgo
Copy link
Contributor

@0xhitgo 0xhitgo commented Apr 26, 2025

add batching to api.multiCall for get asset (collateral) data in sentiment positions

@llamabutler
Copy link

The adapter at projects/sentiment exports TVL:

hyperliquid               12.25 M
hyperliquid-borrowed      5.09 M
borrowed                  5.09 M
arbitrum                  61.73 k

total                    12.31 M 

@waynebruce0x waynebruce0x self-assigned this Apr 28, 2025
Signed-off-by: 0xhitgo <[email protected]>
@llamabutler
Copy link

The adapter at projects/sentiment exports TVL:

hyperliquid               11.75 M
hyperliquid-borrowed      4.92 M
borrowed                  4.92 M
arbitrum                  61.61 k

total                    11.82 M 

@waynebruce0x
Copy link
Collaborator

From your UI it seems the exports should be TVL = ~1.1M$ and Borrowed should be ~4.9M$. Can you explain the difference? https://app.sentiment.xyz/create-position

@0xhitgo
Copy link
Contributor Author

0xhitgo commented Apr 29, 2025

From your UI it seems the exports should be TVL = ~1.1M$ and Borrowed should be ~4.9M$. Can you explain the difference? https://app.sentiment.xyz/create-position

~1.1M$ is the available liquidity but a large portion of the borrowed liq gets swapped to more collateral and stays in the sentiment position contracts.

thinking again more accurate tvl would be available liquidity in pool plus assets in all position contracts.

@llamabutler
Copy link

The adapter at projects/sentiment exports TVL:

hyperliquid               7.02 M
hyperliquid-borrowed      4.94 M
borrowed                  4.94 M
arbitrum                  61.31 k

total                    7.08 M 

@waynebruce0x
Copy link
Collaborator

the value exported by your tvl function should describe available liquidity (excluding borrowed funds)

@0xhitgo
Copy link
Contributor Author

0xhitgo commented Apr 30, 2025

available liquidity alone misses the tokens deposited by borrowers as collateral.

unlike aave and similar protocols, borrower's collateral is not re-deposited into lending pool, and stays inside isolated position contracts so it makes sense to account that in tvl calculation.

Screenshot 2025-04-30 at 2 36 06 PM

example borrower flow: deposits 100 wstHYPE (collateral) -> borrows 900 wHYPE (debt) from base pool and swaps it to more wstHYPE which stays in the position contract Screenshot 2025-04-30 at 3 53 41 PM

@waynebruce0x waynebruce0x merged commit d25856d into DefiLlama:main Apr 30, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants