Proof of Reserve Oracle
DIA oracles helped to deliver Lightning Network node balance data to Ethereum, enabling strBTC holders to verify their Bitcoin backing on-chain.
1. Oracle Details
1.1. Reserve Feeds
The reserve feeds are consumable via the adapter contract tracking on-chain & off-chain reserves.
1.2. Contracts
The DIAOracleV2 contract calculates the off-chain reserves.
Ethereum Mainnet
1.3. Oracle Configuration
Settings that dictate how the oracle computes and updates data.
Deviation (%) & Refresh Frequency
0.5% and 120 seconds
Heartbeat
24h
1.4. Oracle Configuration
1.4.1. On-chain Sources
wBTC <-> strBTC converter
cbBTC <-> strBTC converter
1.4.2. Off-chain Sources
Return total_balance
Return the sum of local_balance, unsettled_local_balance,& pending_open_local_balance
Return total_limbo_balance
2. How the Oracle Works
The DIA adapter (DIAStroomAdapter) calculates the total BTC reserves by combining two data sources:
On-chain reserves: the sum of WBTC and cbBTC balances from Stroom converter contract addresses on Ethereum.
Off-chain reserves: the sum of WalletBalance API (total_balance) and ChannelBalance API (local_balance + unsettled_local_balance + pending_open_local_balance) with 8-decimal satoshi precision. The DIA oracle (DIAOracleV2) pushes the aggregated off-chain reserves value on-chain when they deviate by 0.5% or every 24 hours, as configured.
3. How to Access Data
3.1. DIAStroomAdapter (Solidity)
The following is the list of available methods on the DIAStroomAdapter contract.
3.1.1. getOnchainReserve()
function getOnchainReserve() public view returns (uint256)
Calculates the total on-chain BTC reserves by aggregating WBTC and cbBTC balances from Stroom converter contract addresses on Ethereum.
Return Value (uint256): The total on-chain BTC reserves in 8 decimals.
3.1.2. getOffchainReserve()
function getOffchainReserve() public view returns (uint256)
Makes a `getValue()` call to the DIA oracle, which in turn aggregates off-chain BTC reserves by querying Lightning API services. The DIA oracle's methodology combines `total_balance` from WalletBalance API with the sum of `local_balance`, `unsettled_local_balance`, and `pending_open_local_balance` from ChannelBalance API.
Return Value (uint256): The total off-chain BTC reserves in 8 decimals.
3.1.3. getCombinedReserveValue()
function getCombinedReserveValue() public view returns (uint256)
Returns the sum of both on-chain and off-chain BTC reserves.
Return Value (uint256): The total combined BTC reserves in 8 decimals.
3.2. Adapter contracts
To consume price data from the oracle, you can use the adapter smart contract for the reserve feed. This will allow you to access the same methods on the `AggregatorV3Interface` such as `latestAnswer` & `latestRoundData`. You can learn more here.
4. Glossary
Deviation
The percentage threshold that triggers a price update when exceeded
Refresh frequency
A time interval for checking and updating prices if certain conditions are met
Heartbeat
A forced price update at a fixed interval
Last updated