Contract 5280a71c35ca3ed71bfb0984c03eb899ed63450e95f4cce69e0eeabc39b4d830

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.8#f46e9e0610213bbb72285566f9dd960ff96d03d8
rsver 1.89.0

Instances

  • CBPZ2E3EATGFCYIDKJHUJU4CSL3RGF36TQ25LPQWO4URDTDUMUNS7JHO

Interface

Constructor - Initialize the contract with an admin address

fn __constructor(env: soroban_sdk::Env, admin: soroban_sdk::Address)

Get the next policy ID that will be assigned on create_policy

fn get_next_policy_id(env: soroban_sdk::Env) -> u64

Create a new policy

fn create_policy(
    env: soroban_sdk::Env,
    institution_id: u64,
    contract_id: soroban_sdk::Address,
    amount: i128,
    interest_rate: u64,
    liquidation_threshold: u64,
) -> u64

Update policy fields

fn update_policy(
    env: soroban_sdk::Env,
    policy_id: u64,
    amount: Option,
    interest_rate: Option,
    liquidation_threshold: Option,
)

Set active status

fn set_active(env: soroban_sdk::Env, policy_id: u64, active: bool)

Get policy by ID

fn get_policy(env: soroban_sdk::Env, policy_id: u64) -> Policy

Get all policies for an institution

fn get_institution_policies(
    env: soroban_sdk::Env,
    institution_id: u64,
) -> soroban_sdk::Vec

Get all policies (for all institutions/contracts)

fn get_all_policies(env: soroban_sdk::Env) -> soroban_sdk::Vec

Get active policy for institution (returns first active policy found)

fn get_active_policy(env: soroban_sdk::Env, institution_id: u64) -> Option

Update remaining amount (called by loan contract)

fn update_remaining_amount(env: soroban_sdk::Env, policy_id: u64, delta: i128)

Imports

WebAssembly Text (WAT) ▶