Initialize the adapter with admin and configuration
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
decimals: u32,
max_price_age: u64,
) -> Result<(), RedStoneAdapterError>
Map asset to RedStone feed ID
fn set_asset_feed_mapping(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
asset: Asset,
feed_id: soroban_sdk::String,
) -> Result<(), RedStoneAdapterError>
Remove asset to feed ID mapping
fn remove_asset_feed_mapping(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
asset: Asset,
) -> Result<(), RedStoneAdapterError>
Process RedStone payload with cryptographic verification Returns the list of successfully updated feed IDs and their package timestamp
fn process_payload(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
payload: soroban_sdk::Bytes,
feed_ids: soroban_sdk::Vec,
) -> Result
Write prices from a RedStone signed payload (RedStone SDK compatible)
This function matches the signature expected by RedStone's Stellar connector. It verifies the cryptographic signatures before storing prices.
updater - Address submitting the price update (must authorize)feed_ids - List of feed IDs to update (e.g., ["XLM", "USDC"])payload - RedStone signed payload containing price datafn write_prices(
env: soroban_sdk::Env,
updater: soroban_sdk::Address,
feed_ids: soroban_sdk::Vec,
payload: soroban_sdk::Bytes,
) -> Result
Read stored prices
fn read_prices(
env: soroban_sdk::Env,
feed_ids: soroban_sdk::Vec,
) -> Result, RedStoneAdapterError>
Get detailed price data including both timestamps This allows callers to verify package timestamp vs write timestamp
fn get_price_details(
env: soroban_sdk::Env,
feed_id: soroban_sdk::String,
) -> Result
fn lastprice(env: soroban_sdk::Env, asset: Asset) -> Option
fn decimals(env: soroban_sdk::Env) -> u32
Get base currency (USD for RedStone)
fn base(env: soroban_sdk::Env) -> Asset
Get admin address
fn get_admin(
env: soroban_sdk::Env,
) -> Result
Propose a new admin address (two-step transfer, step 1).
Only the current admin can propose a new admin.
The proposed admin must call accept_admin to complete the transfer.
fn propose_admin(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
pending_admin: soroban_sdk::Address,
) -> Result<(), RedStoneAdapterError>
Accept admin role (two-step transfer, step 2). Only the pending admin can call this to finalize the transfer.
fn accept_admin(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
) -> Result<(), RedStoneAdapterError>
Cancel a pending admin proposal. Only the current admin can cancel a pending proposal.
fn cancel_admin_proposal(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
) -> Result<(), RedStoneAdapterError>
Get the pending admin address, if any.
fn get_pending_admin(env: soroban_sdk::Env) -> Option
Set maximum price age
fn set_max_price_age(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
max_age: u64,
) -> Result<(), RedStoneAdapterError>
Get feed ID for asset
fn get_feed_id(env: soroban_sdk::Env, asset: Asset) -> Option
Add a trusted RedStone signer (20-byte Ethereum address) Only callable by admin
fn add_signer(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
signer: soroban_sdk::BytesN<20>,
) -> Result<(), RedStoneAdapterError>
Remove a trusted RedStone signer Only callable by admin Will fail if removal would leave fewer signers than the current threshold
fn remove_signer(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
signer: soroban_sdk::BytesN<20>,
) -> Result<(), RedStoneAdapterError>
Set minimum required signer threshold (1-255) Only callable by admin
fn set_signer_threshold(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
threshold: u32,
) -> Result<(), RedStoneAdapterError>
Get list of all configured signers
fn get_signers(
env: soroban_sdk::Env,
) -> Result>, RedStoneAdapterError>
Get current signer threshold
fn get_signer_threshold(env: soroban_sdk::Env) -> u32