Contract 0b368a2c4cadd957895913b996856ec8068e81c0e3623553c744aca6bb764e8a

← Back to Index 📥 Download WASM

Meta

rssdkver 23.5.3#d3e1ab2424388b10893b796b0c8e405c5edd03d2
rsver 1.94.0

Instances

  • CDCU4JFL5ZPFCFZQA2FHROM5MVTWSOODTOUN2R5ZVB47CG6EVTBJ4H3K

Interface

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.

Arguments

  • 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 contract
  • hub_chain — Destination chain name for Axelar (e.g., "near")
  • hub_address — Destination contract address on NEAR hub
  • account — The vault account whose NAV is computed
fn 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.

Flow

  1. Check not paused
  2. Check minimum interval since last report
  3. Call PositionRegistry.compute_nav(account)
  4. Increment nonce
  5. Build JSON payload matching CrossChainMessage format (WS4/WS5)
  6. Send via Axelar gateway.call_contract(hub_chain, hub_address, payload)
  7. Store ReportRecord in history
  8. Return 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.

Arguments

  • nonce — The report nonce identifying the record
  • min_ttl — Minimum TTL in ledgers; only extends if current TTL is at or below this
  • max_ttl — Target TTL in ledgers to set when extension triggers
fn 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.

Arguments

  • min_ttl — Minimum TTL in ledgers; only extends if current TTL is at or below this
  • max_ttl — Target TTL in ledgers to set when extension triggers
fn 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,
)

Imports

WebAssembly Text (WAT) ▶