Skip to main content

Pool oracle

Collects operator rates for each expired position and records one agreed rate: the average of at least 2 fresh submissions within 1% of each other. Any disagreement clears the round. Each round is keyed by the position id.

Stellar (testnet) · CBOXFJTK5DGVKOEMEYMHMLYKXUHL2ZETWZY3HEF3FO7PO3GD42YH4G5Q · View on explorer · View on GitHub

Operators​

submit_rate​

WRITE
submit_rate(oracle: Address, event_id: u32, price: u64, event_expiry: u64) -> Option<u64>

Who can call: registered oracle

Submits a rate (6 decimals) at or after expiry. When enough fresh submissions agree, records (average, expiry) as consensus and returns it; when they disagree beyond tolerance, clears every submission.

Errors: OracleNotRegistered, TooEarly, InvalidPrice, AlreadyResolved, CooldownActive, InvalidEvent

maintain_event_storage​

WRITE
maintain_event_storage(event_id: u32)

Who can call: anyone

Extends a round's storage time-to-live.

Reads​

get_consensus​

READ
get_consensus(event_id: u32) -> Option<(u64, u64)>

The agreed rate and the expiry it was agreed for.

get_submission​

READ
get_submission(event_id: u32, oracle: Address) -> Option<Submission>

One operator's submission: price, submitted_at.

get_oracles​

READ
get_oracles() -> Vec<Address>

Registered operators.

get_configuration​

READ
get_configuration() -> (Address, u32, u32, u64, u64)

Owner, required signers, tolerance in bps, freshness and cooldown in seconds.

Admin​

add_oracle​

ADMIN
add_oracle(oracle: Address) / remove_oracle(oracle: Address)

Who can call: owner

Registers or removes an operator. Removal may not leave fewer operators than the quorum.

Errors: OracleAlreadyRegistered, InvalidOracleSet

set_quorum​

ADMIN
set_quorum(required_signers: u32)

Who can call: owner

At least 2 and at most the number of operators.

Errors: InvalidQuorum

set_tolerance​

ADMIN
set_tolerance(tolerance_bps: u32)

Who can call: owner

The largest spread accepted. Pools refuse an oracle above 100 bps.

Errors: InvalidTolerance

upgrade​

ADMIN
upgrade(new_wasm_hash: BytesN<32>)

Who can call: owner

Replaces the contract code in place.

Events​

EventTopicsData
RateSubmittedevent_id, oracleprice
ConsensusDisagreedevent_idspread_bps
ConsensusReachedevent_idprice, valid_signers