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
WRITEsubmit_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
WRITEmaintain_event_storage(event_id: u32)
Who can call: anyone
Extends a round's storage time-to-live.
Reads
get_consensus
READget_consensus(event_id: u32) -> Option<(u64, u64)>
The agreed rate and the expiry it was agreed for.
get_submission
READget_submission(event_id: u32, oracle: Address) -> Option<Submission>
One operator's submission: price, submitted_at.
get_oracles
READget_oracles() -> Vec<Address>
Registered operators.
get_configuration
READget_configuration() -> (Address, u32, u32, u64, u64)
Owner, required signers, tolerance in bps, freshness and cooldown in seconds.
Admin
add_oracle
ADMINadd_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
ADMINset_quorum(required_signers: u32)
Who can call: owner
At least 2 and at most the number of operators.
Errors: InvalidQuorum
set_tolerance
ADMINset_tolerance(tolerance_bps: u32)
Who can call: owner
The largest spread accepted. Pools refuse an oracle above 100 bps.
Errors: InvalidTolerance
upgrade
ADMINupgrade(new_wasm_hash: BytesN<32>)
Who can call: owner
Replaces the contract code in place.
Events
| Event | Topics | Data |
|---|---|---|
RateSubmitted | event_id, oracle | price |
ConsensusDisagreed | event_id | spread_bps |
ConsensusReached | event_id | price, valid_signers |