Returns the factory admin address.
fn get_admin(env: soroban_sdk::Env) -> soroban_sdk::Address
Bumps instance TTL. Anyone can call this to keep the contract alive.
fn extend_ttl(env: soroban_sdk::Env)
Returns the full MarketConfig for a given market_id.
fn get_market(env: soroban_sdk::Env, market_id: u32) -> MarketConfig
Called once at deployment.
insurance_market_wasm_hash: the WASM hash returned by stellar contract upload
for the insurance-market contract. Factory uses this to deploy fresh instances.
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
insurance_market_wasm_hash: soroban_sdk::BytesN<32>,
anchor_stake_contract: soroban_sdk::Address,
)
Returns all market IDs that have been created.
fn list_markets(env: soroban_sdk::Env) -> soroban_sdk::Vec
Creates a new insurance market by deploying a fresh insurance-market contract instance and initializing it with the provided parameters.
Only the factory admin can call this. Returns the new market_id (increments monotonically from 0).
Deployment uses a deterministic salt based on market_id, so each market has a predictable contract address.
fn create_market(
env: soroban_sdk::Env,
label: soroban_sdk::String,
collateral_token: soroban_sdk::Address,
covered_asset: Asset,
oracle_contract: soroban_sdk::Address,
depeg_threshold: i128,
breach_duration_seconds: u64,
expiry_timestamp: u64,
anchor_id: Option,
) -> u32
Allows admin to remove a market from the factory registry.
fn delete_market(env: soroban_sdk::Env, market_id: u32)
Allows admin to update the WASM hash (e.g., for contract upgrades). All subsequent markets will use the new WASM. Existing markets are unaffected.
fn update_wasm_hash(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
Returns just the contract address for a given market_id.
fn get_market_contract(env: soroban_sdk::Env, market_id: u32) -> soroban_sdk::Address
Returns the anchor-stake contract address.
fn get_anchor_stake_contract(env: soroban_sdk::Env) -> soroban_sdk::Address