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)