fn bump_ttl(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
) -> Result<(), ProtocolError>
fn is_locked(env: soroban_sdk::Env, loan_id: u64) -> bool
fn set_admin(
env: soroban_sdk::Env,
current_admin: soroban_sdk::Address,
new_admin: soroban_sdk::Address,
) -> Result<(), ProtocolError>
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
settlement_engine: soroban_sdk::Address,
) -> Result<(), ProtocolError>
Refresh the TTL on the three persistent keys backing a single loan's collateral
escrow (CollateralToken / CollateralAmount / CollateralReleased). Long-lived
loans (term > the default Soroban persistent TTL window) need this to be called
on a schedule, otherwise the keys can be archived and the matching claim_collateral
/ release_collateral flow will revert with CollateralNotFound until a
RestoreFootprint is performed off-chain.
Admin-gated. The settlement engine already bumps these keys automatically on every
write (lock / migrate / release / claim), so this entrypoint is the explicit
operator handle for loans that have been idle for a long time. Errors with
CollateralNotFound if the loan was never recorded here.
fn bump_loan_ttl(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
loan_id: u64,
) -> Result<(), CollateralVaultError>
Cancel a pending upgrade proposal.
fn cancel_upgrade(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
) -> Result<(), ProtocolError>
Execute a previously proposed upgrade once the timelock has elapsed.
fn execute_upgrade(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
) -> Result<(), ProtocolError>
fn lock_collateral(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
loan_id: u64,
borrower: soroban_sdk::Address,
token: soroban_sdk::Address,
amount: i128,
) -> Result<(), CollateralVaultError>
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>
Refresh the TTL on the three persistent keys backing a single pre-match request's
pledged collateral (RequestToken / RequestAmount / RequestReleased). Same
rationale as bump_loan_ttl but for the pre-match escrow tracked under
request_id rather than loan_id.
Admin-gated. Errors with RequestCollateralNotFound if no such request escrow
exists (either never pledged or already migrated to a loan via match_request).
fn bump_request_ttl(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
request_id: u64,
) -> Result<(), CollateralVaultError>
fn claim_collateral(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
loan_id: u64,
recipient: soroban_sdk::Address,
) -> Result<(soroban_sdk::Address, i128), CollateralVaultError>
Lock collateral for an unfunded borrow request (request_id). Only settlement engine.
fn lock_for_request(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
request_id: u64,
borrower: soroban_sdk::Address,
token: soroban_sdk::Address,
amount: i128,
) -> Result<(), CollateralVaultError>
fn is_request_locked(env: soroban_sdk::Env, request_id: u64) -> bool
fn release_collateral(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
loan_id: u64,
recipient: soroban_sdk::Address,
) -> Result<(), CollateralVaultError>
Release request escrow back to borrower (cancel). Only settlement engine.
fn release_for_request(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
request_id: u64,
recipient: soroban_sdk::Address,
) -> Result<(), CollateralVaultError>
fn get_collateral_token(
env: soroban_sdk::Env,
loan_id: u64,
) -> Result
fn get_collateral_amount(
env: soroban_sdk::Env,
loan_id: u64,
) -> Result
fn get_request_collateral(
env: soroban_sdk::Env,
request_id: u64,
) -> Result<(soroban_sdk::Address, i128), CollateralVaultError>
Move request escrow to loan_id storage (no token movement). Only settlement engine.
fn migrate_request_to_loan(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
request_id: u64,
loan_id: u64,
) -> Result<(), CollateralVaultError>