Skip to main content

CentralizedOracle

CentralizedOracle

Testnet oracle feed

Simple, IOracle-compliant centralized oracle for use with PriceFeed

Addresses

ChainAddress
Arbitrum Sepolia0x599F8D0af53DB733541309d7421b6Dd3FbdAFF95

Functions

setValue

Update the oracle price for productId.

function setValue(bytes32 productId, FPUnsigned value, uint64 timestamp) external

Parameters

NameTypeDescription
productIdbytes32Product to update
valueFPUnsignedNew price for product
timestampuint64Timestamp 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

NameTypeDescription
productIdbytes32product being updated
valueFPUnsignednew value
timestampuint64time 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

NameTypeDescription
valueFPUnsignedLatest price set by setValue/setValues
timestampuint64Timestamp 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

NameTypeDescription
oracleaddressAddress whose permissions should be modified
statusboolWhether 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

NameTypeDescription
timestampIndexuint256index of the submitted timestamp

OracleOnly

error OracleOnly()

Variables

priceFeed

isOracle

feeds

Types

PriceFeed

struct PriceFeed {
FPUnsigned value;
uint64 timestamp;
}