Skip to content
This repository was archived by the owner on Dec 11, 2025. It is now read-only.

Conversation

@zajck
Copy link
Member

@zajck zajck commented Nov 7, 2025

TVL methodology

  1. Get the total value of all encumbered funds and reduce them for the value of funds that were released upon exchange finalisation. This covers all active exchanges, regardless if the offer is fixed price or price discovery. It also includes sequential commits.
  2. Get all deposited and not yet withdrawn funds. The approach uses FundsEncumbered and FundsDeposited events to get the list of unique token addresses. Then it uses defillama's helper function to sum balances. Both events must be used (FundsEncumbered catches tokens for offers without seller deposit, while FundsDeposited catches offers where no exchange was made yet).
  3. Get all active offers (remove voided and expired).
    1. If the offer is of a price discovery type, ignore it. Its price is unknown until someone commits to. When they do, it's included in the calculation from step 1.
    2. If the quantity available is known, first reduce it by the number of commits for that offer to reduce double-counting (commits are already included in step 1.). Calculate TVL as uncommitedQuantity*(price+sellerDeposit+disputeResolverfee) (the value that would be encumbered if someone commits to the offer)
    3. If the quantity available is unlimited, check if some rNFTs were preminted. This value is equivalent to quantity available for limited offers. Check if any commit belongs to the range and deduce the uncommitted quantity. Calculate TVL in the same way as in 2.3. If there were any additional commits in addition to the preminted range, they are already included in step 1.
    4. Check if the offer has a non-zero available quantity. If it has, add price to TVL (ignore the quantity).

@zajck zajck self-assigned this Nov 7, 2025
@zajck zajck requested a review from levalleux-ludo November 7, 2025 12:18
Comment on lines 86 to 95
// staking: staking(
// [
// "0x6244bc0d4b661526c0c62c3610571cd1ac9df2dd",
// "0xbacc083795846a67b0782327a96622447ddafe6c",
// "0x081a52f02e51978ad419dd7894d7ae3555f8bc26",
// "0x3ed0c99c8e8eb94438837cc8a08ca3bb187424cf",
// "0x3810d9d6685812af6ef4257de0542ecdba9bfd95"
// ],
// "0xC477D038d5420C6A9e0b031712f61c5120090de9"
// ),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// staking: staking(
// [
// "0x6244bc0d4b661526c0c62c3610571cd1ac9df2dd",
// "0xbacc083795846a67b0782327a96622447ddafe6c",
// "0x081a52f02e51978ad419dd7894d7ae3555f8bc26",
// "0x3ed0c99c8e8eb94438837cc8a08ca3bb187424cf",
// "0x3810d9d6685812af6ef4257de0542ecdba9bfd95"
// ],
// "0xC477D038d5420C6A9e0b031712f61c5120090de9"
// ),

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants