-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add figure markets #15501
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
base: main
Are you sure you want to change the base?
Add figure markets #15501
Conversation
…m/provenance-io/DefiLlama-Adapters into jarryd/initial-provenance-adapter
…m/provenance-io/DefiLlama-Adapters into jarryd/initial-provenance-adapter
The adapter at projects/figure-markets-democratized-prime exports TVL:
|
The adapter at projects/figure-markets exports TVL:
|
await Promise.all( | ||
Object.keys(tokenObject).map(async (t) => { | ||
// Get the denom exponent information | ||
const response = await fetch( |
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.
no, this is really bad, this will fetch denom metadata each time, use this structure instead: https://github.com/DefiLlama/DefiLlama-Adapters/blob/main/projects/helper/tokenMapping.js#L41
then you can do api.add(token, bal)
in the adapter code and add
return sumTokens2({ api })
, it will take care of transforming to cg tokens
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.
Updated locally, pushing after we answer the below question.
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 file can be removed
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.
Removed locally, will push once the below question is answered.
nextTokens.commitments.map((c) => | ||
c.amount.map((a) => { | ||
const denom = a.denom; | ||
if (acc[denom]) { |
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 be replaced with api.add(a.denom, a.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.
Updated, will push as soon as we answer the below question.
} | ||
|
||
// Returns all leveraged pools in Figure Markets Democratized Prime | ||
// https://www.figuremarkets.com/c/democratized-prime/lending-pools |
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.
leverage pools is derivatives trading? I wouldnt mix it with lending, also, how to get info of both on chain?
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.
Working on this. I mislabeled that, it should have read lending pools.
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): Figure Markets
Twitter Link: https://twitter.com/figuremarkets
List of audit links if any: N/A
Website Link: https://www.figuremarkets.com/
Logo (High resolution, will be shown with rounded borders):
Current TVL:
Figure Markets: 48.96 M
Figure Markets Democratized Prime: 837.08 k
Treasury Addresses (if the protocol has treasury)
N/A
Chain: Provenance
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):
Figure Markets: A crypto exchange designed for traders who demand more. Benefit from the security and asset control of decentralized custody with the ease and liquidity of a centralized exchange.
FM Democratized Prime: Democratized Prime connects your cash or crypto with borrowers seeking liquidity on their collateral.
Token address and ticker if any:
N/A
Category (full list at https://defillama.com/categories) *Please choose only one:
Figure Markets: OTC Marketplace
Figure Markets Democratized Prime: RWA Lending
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):
N/A
methodology (what is being counted as tvl, how is tvl being calculated):
Figure Markets: All commitments to the Figure Markets exchange are pulled, and those commitments are then converted to their CoinGecko denoms and values
Figure Markets Democratized Prime:
To determine the TVL and borrowed amounts in the Figure Markets Democratized Prime protocol, we query each pool, determining the total collateral and total loaned, and subtract the two to calculate the total TVL in the protocol.
Get all available pools at https://www.figuremarkets.com/service-lending/api/v1/leverage-pools?location=CAYMAN
For each asset pool that isn't YLDS, pull the existing offers at https://www.figuremarkets.com/service-lending/api/v1/offers?asset=${asset}&location=CAYMAN
YLDS is backed by lending facilities. To get all lending lending facilities, pull all assets and filter to only those whose type is LENDING_FACILITY at https://www.figuremarkets.com/service-hft-exchange/api/v1/assets?page=1&size=100&include_lending_facility_assets=true
Add all lending facility unpaid balances to get the existing total lending collateral available on the protocol. To get the total borrowed, query the existing offer for YLDS.
Calculate the TVL using these values. We also report this as doublecounted since it is likely represented in the Figure Markets protocol, and also represent the borrowed amount as borrowed in the response.
Github org/user (Optional, if your code is open source, we can track activity):
https://github.com/provenance-io/provenance