CentralizedOracle
CentralizedOracle
Testnet oracle feed
Simple, IOracle-compliant centralized oracle for use with PriceFeed
Addresses
Chain | Address |
---|---|
Arbitrum Sepolia | 0x599F8D0af53DB733541309d7421b6Dd3FbdAFF95 |
Zircuit | 0x1e8597614009412e48D8523A7E064Bee6eB9C2f3 |
Functions
setValue
Update the oracle price for productId
.
function setValue(bytes32 productId, FPUnsigned value, uint64 timestamp) external
Parameters
Name | Type | Description |
---|---|---|
productId | bytes32 | Product to update |
value | FPUnsigned | New price for product |
timestamp | uint64 | Timestamp at which this price was generated. Must increase |
setValues
Set oracle price for multiple products. See setValue()
function setValues(bytes32[] productIds, FPUnsigned[] values, uint64[] timestamps) external
Dev note
Reverts if any timestamp is <= previous timestamp
notifyPriceFeed
Notify PriceFeed, if registered, of all price updates
function notifyPriceFeed(bytes32 productId, FPUnsigned value, uint64 timestamp) internal
Dev note
No-op if unregistered, so oracles can set up before PriceFeed or be used for other things
Parameters
Name | Type | Description |
---|---|---|
productId | bytes32 | product being updated |
value | FPUnsigned | new value |
timestamp | uint64 | time new value was generated |
getValue
Get latest price for productId
. Reverts if unavailable
function getValue(bytes32 productId) external view returns (FPUnsigned value, uint64 timestamp)
Return Values
Name | Type | Description |
---|---|---|
value | FPUnsigned | Latest price set by setValue/setValues |
timestamp | uint64 | Timestamp of last update |
setPriceFeed
function setPriceFeed(contract IPriceFeed newPriceFeed) external
setOracle
Allow an EOA to update prices
function setOracle(address oracle, bool status) external
Parameters
Name | Type | Description |
---|---|---|
oracle | address | Address whose permissions should be modified |
status | bool | Whether this address is allowed to update prices |
Modifiers
onlyOracle
modifier onlyOracle()
Errors
OracleValueUnset
error OracleValueUnset()
InvalidTimestamp
One of the submitted timestamps was invalid
error InvalidTimestamp(uint256 timestampIndex)
Parameters
Name | Type | Description |
---|---|---|
timestampIndex | uint256 | index of the submitted timestamp |
OracleOnly
error OracleOnly()
Variables
priceFeed
isOracle
feeds
Types
PriceFeed
struct PriceFeed {
FPUnsigned value;
uint64 timestamp;
}