Skip to content

fix: collateral tvl not being accounted#14458

Merged
waynebruce0x merged 3 commits intoDefiLlama:mainfrom
0xhitgo:fix/sentiment
Apr 30, 2025
Merged

fix: collateral tvl not being accounted#14458
waynebruce0x merged 3 commits intoDefiLlama:mainfrom
0xhitgo:fix/sentiment

Conversation

@0xhitgo
Copy link
Copy Markdown
Contributor

@0xhitgo 0xhitgo commented Apr 26, 2025

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

Signed-off-by: 0xhitgo <0xhitgo@protonmail.com>
@llamabutler
Copy link
Copy Markdown

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 

Comment thread projects/sentiment/v2.js Outdated
@waynebruce0x waynebruce0x self-assigned this Apr 28, 2025
Signed-off-by: 0xhitgo <0xhitgo@protonmail.com>
@llamabutler
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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.

Signed-off-by: 0xhitgo <0xhitgo@protonmail.com>
@llamabutler
Copy link
Copy Markdown

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
Copy Markdown
Collaborator

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

@0xhitgo
Copy link
Copy Markdown
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
WayneAl pushed a commit to WayneAl/DefiLlama-Adapters that referenced this pull request May 7, 2025
Signed-off-by: 0xhitgo <0xhitgo@protonmail.com>
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