Skip to content

Conversation

A60AB5450353F40E
Copy link
Contributor

@A60AB5450353F40E A60AB5450353F40E commented Mar 3, 2023

NOTE

  • If you would like to add a volume adapter please submit the PR here.
  • If you would like to add a liquidations adapter, please refer to this readme document for details.
  1. Once your adapter has been merged, it takes time to show on the UI. If more than 24 hours have passed, please let us know in Discord.
  2. Sorry, We no longer accept fetch adapter for new projects, we prefer the tvl to computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you.
  3. The protocol is usually listed within 24 hours of merging the PR
  4. Please fill the form below only if the PR is for listing a new protocol else it can be ignored/replaced with reason/details about the PR
  5. For updating listing info It is a different repo, you can find your listing in this file: https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data2.ts, you can edit it there and put up a PR
  6. Do not edit/push package-lock.json file as part of your changes, we use lockfileVersion 2, and most use v1 and using that messes up our CI
  7. No need to go to our discord and announce that you've created a PR, we monitor all PRs and will review it asap

Name (to be shown on DefiLlama):

AnyHedge (v0.11)

Twitter Link:

https://twitter.com/AnyHedge

List of audit links if any:
Website Link:

https://anyhedge.com/

Logo (High resolution, preferably in .svg and .png, for application on both white and black backgrounds. Will be shown with rounded borders):

https://anyhedge.com/assets/svg/logo.svg

Current TVL:

5871 BCH

Treasury Addresses (if the protocol has treasury)

N/A

Chain:

Bitcoin Cash (BCH)

Coingecko ID (so your TVL can appear on Coingecko): (https://api.coingecko.com/api/v3/coins/list)

bitcoin-cash

Coinmarketcap ID (so your TVL can appear on Coinmarketcap): (https://api.coinmarketcap.com/data-api/v3/map/all?listing_status=active,inactive,untracked&start=1&limit=10000)

1831

Short Description (to be shown on DefiLlama):

AnyHedge allows users to take leveraged long or short positions against main-chain BCH.
It is permissionless, non-custodial, and on-chain.
The contracts are fully funded on creation and have no counterparty risk.
The risks are early liquidation, slippage, and oracle risks.

Token address and ticker if any:

N/A

Category (full list at https://defillama.com/categories) *Please choose only one:

Derivatives

Oracle used (Chainlink/Band/API3/TWAP or any other that you are using):

Oracle library: https://gitlab.com/GeneralProtocols/priceoracle/library

Oracle dashboard: https://oracles.cash/

forkedFrom (Does your project originate from another project):

N/A

methodology (what is being counted as tvl, how is tvl being calculated):

Data is fully reproducible using this: https://gitlab.com/0353F40E/anyhedge-stats

The repo contains scripts that do this:

  1. Using a blockchain indexer look up each individual contract's: value, open_timestamp, close_timestamp and fill the SQLite database. This gets us the data of all settled contracts that match the AnyHedge v0.11 redeem script template.
  2. Aggregate the data for each day, into total_opened and total_closed
  3. Calculate tvl_change = total_opened - total_closed
  4. Calculate cumulative tvl by adding up tvl_change
  5. Export the SQL's query result into .csv hosted on the repo

The adapter downloads the .csv and looks up the "current_date - 30d" row. The TVL data lags because of nature of these contracts. When they're created, their information will be hidden, they will look like any other P2SH BCH UTXO. We can only detect opened contracts that have been already closed. Fundamentally, these contracts are much similar to Lightning Network channels. When you open a LN channel, anyone looking at the blockchain can't tell it's a LN channel. Only when the channel closes is the HTLC contract revealed and can be detected and on-chain data scraped to produce stats.

@llamatester
Copy link

The adapter at projects/anyhedge exports TVL:

bitcoincash               0

total                    0 

@A60AB5450353F40E
Copy link
Contributor Author

Note: test.js seems to be bugged, it doesn't want to get USD data for bitcoincash so returns 0.

@llamatester
Copy link

The adapter at projects/anyhedge exports TVL:

bitcoincash               736.87 k

total                    736.87 k 

@g1nt0ki g1nt0ki merged commit 336c845 into DefiLlama:main Mar 3, 2023
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