Arithmetic mean of the last min(records, stored) ring prices. This is
a simple mean over stored ROUNDS, not a time-weighted average —
adequate for a consumer's median-of-last-k / smoothing eligibility
checks, not for interval-exact TWAP accounting. None when the asset
has no history or records is 0.
fn twap(
env: soroban_sdk::Env,
asset: soroban_sdk::BytesN<8>,
records: u32,
) -> Option
The last records rounds from the asset's history ring, latest-first.
Returns up to min(records, stored) entries; None when the asset has
no history at all (a records of 0 with history is an empty page).
fn prices(
env: soroban_sdk::Env,
asset: soroban_sdk::BytesN<8>,
records: u32,
) -> Option>
Swap the running contract's WASM for an already-uploaded blob.
Admin-authenticated (same gate as set_publishers). Shipping this is
deliberately the LAST forced redeploy: every future contract change
can land through upgrade instead of a fresh deploy + init ceremony +
consumer repoint (shim / router / keeper env).
fn upgrade(
env: soroban_sdk::Env,
new_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), soroban_sdk::Error>
fn get_price(
env: soroban_sdk::Env,
asset: soroban_sdk::BytesN<8>,
) -> Option
Current quorum threshold (1 when never configured).
fn get_quorum(env: soroban_sdk::Env) -> u32
Set the minimum number of distinct registered publishers whose signed
rounds update_quorum_ed25519_persistent must carry. Admin-
authenticated. Must satisfy 1 <= quorum <= publishers.len() at set
time; an unset quorum behaves as 1, so existing single-publisher
deployments are unchanged until the admin raises the bar. (A later
set_publishers may shrink the key set below this threshold — the
quorum path then cannot meet quorum until the admin re-syncs.)
fn set_quorum(env: soroban_sdk::Env, quorum: u32) -> Result<(), soroban_sdk::Error>
Deploy-time setup: record the admin Address and the initial publisher
Ed25519 key set. Runs atomically inside the deploy transaction, so a
fresh instance can never be claimed by a third party (ALX-1: the
former separate init entrypoint left a front-run window between
deploy and initialization; it has been removed outright). The admin
must still authorize, so a deployer cannot install someone ELSE as
admin without their signature.
fn __constructor(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
publishers: soroban_sdk::Vec>,
)
fn get_price_pers(
env: soroban_sdk::Env,
asset: soroban_sdk::BytesN<8>,
) -> Option
Replace the publisher Ed25519 key set. Admin-authenticated.
fn set_publishers(
env: soroban_sdk::Env,
publishers: soroban_sdk::Vec>,
) -> Result<(), soroban_sdk::Error>
fn update_batch_ed25519_args(
env: soroban_sdk::Env,
assets: soroban_sdk::Vec>,
prices: soroban_sdk::Vec,
timestamp: u64,
round_id: u64,
pubkey: soroban_sdk::BytesN<32>,
sigs: soroban_sdk::Vec>,
) -> Result<(), soroban_sdk::Error>
fn update_batch_ed25519_persistent(
env: soroban_sdk::Env,
assets: soroban_sdk::Vec>,
prices: soroban_sdk::Vec,
timestamp: u64,
round_id: u64,
pubkey: soroban_sdk::BytesN<32>,
sigs: soroban_sdk::Vec>,
) -> Result<(), soroban_sdk::Error>
fn update_quorum_ed25519_persistent(
env: soroban_sdk::Env,
assets: soroban_sdk::Vec>,
timestamp: u64,
round_id: u64,
rounds: soroban_sdk::Vec,
) -> Result<(), soroban_sdk::Error>