Get the admin address.
fn get_admin(env: soroban_sdk::Env) -> soroban_sdk::Address
Get the current nonce (number of reports sent).
fn get_nonce(env: soroban_sdk::Env) -> u64
Check if the contract is paused.
fn is_paused(env: soroban_sdk::Env) -> bool
Get the spoke configuration.
fn get_config(env: soroban_sdk::Env) -> SpokeConfig
Get a specific report by nonce.
fn get_report(env: soroban_sdk::Env, nonce: u64) -> ReportRecord
Initialize the SpokeReporter contract.
admin — Admin address (controls configuration)spoke_id — Unique spoke identifier (e.g., "stellar-main")chain_id — Chain identifier (e.g., "stellar")position_registry — Address of the PositionRegistry contract (WS2)gateway — Address of the Axelar Gateway contracthub_chain — Destination chain name for Axelar (e.g., "near")hub_address — Destination contract address on NEAR hubaccount — The vault account whose NAV is computedfn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
spoke_id: soroban_sdk::String,
chain_id: soroban_sdk::String,
position_registry: soroban_sdk::Address,
gateway: soroban_sdk::Address,
hub_chain: soroban_sdk::String,
hub_address: soroban_sdk::String,
account: soroban_sdk::Address,
)
Pause or unpause the contract. Admin only.
fn set_paused(env: soroban_sdk::Env, paused: bool)
Compute NAV via PositionRegistry and send it to the NEAR Hub via Axelar GMP.
Anyone can call this (permissionless — heartbeat keeper script calls it). Enforces minimum interval between reports. Returns the nonce.
fn send_report(env: soroban_sdk::Env) -> u64
Update the Axelar gateway address. Admin only.
fn set_gateway(env: soroban_sdk::Env, new_gateway: soroban_sdk::Address)
Accept a pending admin proposal (step 2 of two-step transfer).
Must be called by the pending_admin address. Overwrites the current admin
with pending_admin and clears the pending slot.
fn accept_admin(env: soroban_sdk::Env)
Propose a new admin (step 1 of two-step transfer). Admin only. (MEDIUM-01)
Writes the PendingAdmin storage key without overwriting the current admin.
The new admin must call accept_admin() to complete the transfer.
This prevents permanent lock-out from a typo or misrouted address.
fn propose_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)
Extend the persistent storage TTL for a specific report record. Admin only.
nonce — The report nonce identifying the recordmin_ttl — Minimum TTL in ledgers; only extends if current TTL is at or below thismax_ttl — Target TTL in ledgers to set when extension triggersfn extend_report_ttl(env: soroban_sdk::Env, nonce: u64, min_ttl: u32, max_ttl: u32)
Get the latest report.
fn get_latest_report(env: soroban_sdk::Env) -> ReportRecord
Get NAV staleness — seconds since the last NAV was reported.
Returns u64::MAX if no NAV has ever been reported (always stale).
fn get_nav_staleness(env: soroban_sdk::Env) -> u64
Get the report configuration (min interval, accounting token).
fn get_report_config(env: soroban_sdk::Env) -> ReportConfig
Set the report configuration. Admin only.
fn set_report_config(
env: soroban_sdk::Env,
min_interval_secs: u64,
accounting_token: soroban_sdk::String,
)
Get report history (up to limit most recent reports).
fn get_report_history(
env: soroban_sdk::Env,
limit: u32,
) -> soroban_sdk::Vec
Extend the instance storage TTL. Admin only.
min_ttl — Minimum TTL in ledgers; only extends if current TTL is at or below thismax_ttl — Target TTL in ledgers to set when extension triggersfn extend_instance_ttl(env: soroban_sdk::Env, min_ttl: u32, max_ttl: u32)
Update the hub destination (chain + address). Admin only.
fn set_hub_destination(
env: soroban_sdk::Env,
hub_chain: soroban_sdk::String,
hub_address: soroban_sdk::String,
)
Get the timestamp of the last report sent. Returns 0 if no report has been sent yet.
fn get_last_report_time(env: soroban_sdk::Env) -> u64
Update the PositionRegistry address. Admin only. (B6)
Allows replacing PositionRegistry without redeploying SpokeReporter. Emits a RegistryChanged event with old and new addresses for on-chain auditability.
fn set_position_registry(
env: soroban_sdk::Env,
new_position_registry: soroban_sdk::Address,
)