Bridge Oracle
The Bridge Oracle contract is a critical component of the Orbit Protocol that provides reliable price feeds for stablecoins by mapping them to their corresponding fiat currencies. This price data is essential for the Blend pools to maintain accurate lending and borrowing operations.
Core Features
Initialization
The Bridge Oracle initializes with:
admin
: Address with administrative privilegesoracle
: Address of the external price oracle contract
During initialization, the contract:
Verifies it hasn't been previously initialized
Sets up the admin address
Configures the oracle address
Emits an initialization event
Asset Management
Adding Assets
Allows admin to create price mappings:
asset
: The stablecoin asset to be priced (e.g., oUSD token)to
: The reference asset for pricing (e.g., USD)
Oracle Configuration
Enables admin to update the price source:
Updates oracle contract address
Maintains existing asset mappings
Emits oracle update event
Requires admin authorization
Price Data Interface
Decimals Retrieval
Returns the decimal precision of price data:
Queries connected oracle
Price Fetching
Retrieves current price information:
Returns
PriceData
structureMaps stablecoin to reference asset
Handles price conversion
Returns None if price unavailable
Events
The contract emits events for:
Contract initialization
Asset mapping creation
Oracle address updates
Upgrade Mechanism
Supports contract upgrades:
Admin-controlled
Preserves existing mappings
Maintains system integrity
Error Conditions
The contract handles various error cases:
Invalid initialization
Unauthorized access attempts
Missing asset mappings
Oracle connection failures
Last updated