fn bump_ttl(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
) -> Result<(), ProtocolError>
fn get_loan(env: soroban_sdk::Env, loan_id: u64) -> Result
fn set_admin(
env: soroban_sdk::Env,
current_admin: soroban_sdk::Address,
new_admin: soroban_sdk::Address,
) -> Result<(), ProtocolError>
Wire the settlement engine reference. One-shot; callable only by the admin bound at construction.
fn initialize(
env: soroban_sdk::Env,
settlement_engine: soroban_sdk::Address,
) -> Result<(), ProtocolError>
fn is_matured(env: soroban_sdk::Env, loan_id: u64) -> Result
fn create_loan(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
request_id: u64,
borrower: soroban_sdk::Address,
lender: soroban_sdk::Address,
principal_amount: i128,
collateral_amount: i128,
interest_rate_schedule: soroban_sdk::Vec,
maturity_time: u64,
collateral_policy: CollateralPolicy,
oracle_liquidation: Option,
) -> Result
fn mark_repaid(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
loan_id: u64,
interest_amount: i128,
) -> Result<(), LoanError>
Bind the admin to the deploying identity atomically with deployment (HAL-01).
Runs in the same operation as deploy, eliminating the deploy→configure window
an attacker could otherwise front-run.
fn __constructor(env: soroban_sdk::Env, admin: soroban_sdk::Address)
Refresh the TTL on a single Loan(loan_id) persistent entry. Long-lived loans
(term > the default Soroban persistent TTL window) need this called on a schedule
so the loan record doesn't get archived mid-life — mark_repaid / mark_default
/ mark_liquidated would otherwise revert with LoanNotFound until the entry is
restored off-chain.
Admin-gated. Settlement-engine writes (create_loan, status transitions) already
bump TTL automatically; this entrypoint covers loans that are idle between
writes (e.g., a 6-month note with no oracle liquidations).
fn bump_loan_ttl(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
loan_id: u64,
) -> Result<(), LoanError>
Cancel a pending upgrade proposal.
fn cancel_upgrade(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
) -> Result<(), ProtocolError>
fn mark_defaulted(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
loan_id: u64,
) -> Result<(), LoanError>
Execute a previously proposed upgrade once the timelock has elapsed.
fn execute_upgrade(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
) -> Result<(), ProtocolError>
fn mark_bought_out(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
loan_id: u64,
) -> Result<(), LoanError>
fn mark_liquidated(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
loan_id: u64,
) -> Result<(), LoanError>
Stage an upgrade to be executed after the timelock period (48 h).
fn propose_upgrade(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
new_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), ProtocolError>
fn get_next_loan_id(env: soroban_sdk::Env) -> u64
fn set_liquidation_trigger(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
loan_id: u64,
trigger: LiquidationTrigger,
) -> Result<(), LoanError>