-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Stroom: TVL on bitcoin via PoR oracle (getCombinedReserveValue) #17037
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
Open
AleksDemian
wants to merge
1
commit into
DefiLlama:main
Choose a base branch
from
AleksDemian:stroom-por-btc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+22
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| const sdk = require('@defillama/sdk') | ||
|
|
||
| const POR_ORACLE = '0x12DB8fcA6AAA29E922bFAD8a7771aE11F17a1811' | ||
| const abi = { | ||
| getCombinedReserveValue: 'function getCombinedReserveValue() view returns (uint256)', | ||
| } | ||
|
|
||
| async function tvl() { | ||
| const ethApi = new sdk.ChainApi({ chain: 'ethereum' }) | ||
| const satoshis = await ethApi.call({ | ||
| abi: abi.getCombinedReserveValue, | ||
| target: POR_ORACLE | ||
| }) | ||
| const btc = Number(satoshis) / 1e8 | ||
| return { 'coingecko:bitcoin': btc } | ||
| } | ||
|
|
||
| module.exports = { | ||
| timetravel: false, | ||
| methodology: 'TVL equals BTC reserves tracked on Bitcoin. We read the aggregated reserve value from Stroom\'s on-chain PoR oracle on Ethereum (denominated in satoshis), divide by 1e8 to get BTC, and report it as bitcoin (USD pricing from BTC).', | ||
| bitcoin: { tvl }, | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
projects/helper/bitcoin-book/index.jsand a list of bitcoin walletsUh oh!
There was an error while loading. Please reload this page.
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.
List of Bitcoin wallets is not possible to provide. Our solution is based on Lightning Network, which is off-chain L2. Bitcoins that we have locked in Stroom are storred inside Lightnign payment channels. We can try to provide a list of payment channels with corresponding multisig addresses, but that list will be changing frequently due to normal operations of Lightning Network node, moreover that list will not be representative, since inside the channel the balance distribution is constantly changing.
You can find the info about our Lightning node here: https://amboss.space/node/03fe47fdfea0f25fad0013498e8d6cec348ae3d673841ec25ee94f87c21af16ed8
You also can contact our oracle provider DIA (whitelisted on Defilama) about PoR calculation implementation
details. They have direct read-only access to Lightning Network node with BTC so they can query off-chain and on-chain balance of the node.
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.
@AleksDemian in your UI the available token to convert is WBTC, so things are happening on ETH
We need all the WBTC wallets on the ethereum side
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
@Define101 We have two converters that will store wBTC and cbBTC:
WBTCConverter - https://etherscan.io/address/0x56192f14c1d84e41db3d5d4c5d407efdb5cb1352
CBBTCConverter - https://etherscan.io/address/0xe7b4c44adb17147ad877eb8607eeb1e95adf2cd0
This is only part of the reserves; most of them are bitcoins stored in the Lightning Network Node.
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.
@Define101 Is it enough for you?
The addresses of the converters are also included in the documentation verifying oracle usage.