HederaExchangeRateAdapter
Inherits: IHederaExchangeRateAdapter
Title: HederaExchangeRateAdapter
Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from hiero-ledger/hiero-contracts (https://github.com/hiero-ledger/hiero-contracts)
Diamond facet exposing Hedera's network USD/HBAR exchange rate (system contract 0x168).
Stateless delegator over HederaExchangeRateAdapterLib. Only meaningful on Hedera.
Notes:
- lattice-version: 0.1.0
- lattice-source: Hedera
Functions
tinycentsToTinybars
Converts USD tinycents to HBAR tinybars at the current network rate.
function tinycentsToTinybars(uint256 tinycents) external view virtual override returns (uint256 tinybars);Parameters
| Name | Type | Description |
|---|---|---|
| tinycents | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| tinybars | uint256 |
tinybarsToTinycents
Converts HBAR tinybars to USD tinycents at the current network rate.
function tinybarsToTinycents(uint256 tinybars) external view virtual override returns (uint256 tinycents);Parameters
| Name | Type | Description |
|---|---|---|
| tinybars | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| tinycents | uint256 |
usdCentsToWei
Converts whole USD cents to weibar (the msg.value unit) — e.g. to price a fee in USD.
function usdCentsToWei(uint256 cents) external view virtual override returns (uint256 weibar);Parameters
| Name | Type | Description |
|---|---|---|
| cents | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| weibar | uint256 |
hbarUsdWad
Current HBAR/USD rate scaled to 18 decimals (USD per 1 HBAR, WAD), matching latestAnswer
conventions of the other oracle adapters.
function hbarUsdWad() external view virtual override returns (uint256 priceWad);Returns
| Name | Type | Description |
|---|---|---|
| priceWad | uint256 |
exportSelectors
ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).
Excludes exportSelectors() itself (0x0ef22643). Order matches forge inspect HederaExchangeRateAdapter methodIdentifiers (alphabetical by signature); kept in exact parity by ExportSelectorsParityTest. Chunks:
hbarUsdWad() 0xa26c8e04
tinybarsToTinycents(uint256) 0x43a88229
tinycentsToTinybars(uint256) 0x2e3cff6a
usdCentsToWei(uint256) 0x8f66af92
function exportSelectors() external pure virtual returns (bytes memory selectors);Returns
| Name | Type | Description |
|---|---|---|
| selectors | bytes |