fn lot(env: soroban_sdk::Env, loan_id: u32, lot_id: u32) -> Lot
fn lots(env: soroban_sdk::Env, loan_id: u32) -> soroban_sdk::Vec
fn pause(env: soroban_sdk::Env, caller: soroban_sdk::Address)
Returns true if the contract is paused, and false otherwise.
e - Access to Soroban environment.fn paused(env: soroban_sdk::Env) -> bool
Pledges a new lot against loan_id. Requires the loan to exist and
not be Closed. Returns the assigned lot_id.
fn pledge(env: soroban_sdk::Env, loan_id: u32, lot: PledgeLot) -> u32
Attaches a supporting document reference to a lot (up to 16; no removal).
fn add_doc(
env: soroban_sdk::Env,
loan_id: u32,
lot_id: u32,
kind: DocKind,
sha256: soroban_sdk::BytesN<32>,
)
Releases qty of a lot back (payment, LC acceptance, substitution,
loss, ...). At zero remaining, the lot reaches its terminal stage.
fn release(
env: soroban_sdk::Env,
loan_id: u32,
lot_id: u32,
qty: i128,
reason: ReleaseReason,
ref_hash: soroban_sdk::BytesN<32>,
)
Sets a lot's valuation mark at the current ledger time. A zero mark (worthless collateral) is allowed; a negative one is not.
fn revalue(
env: soroban_sdk::Env,
loan_id: u32,
lot_id: u32,
value_per_unit: i128,
benchmark: soroban_sdk::Symbol,
report_hash: soroban_sdk::BytesN<32>,
)
fn unpause(env: soroban_sdk::Env, caller: soroban_sdk::Address)
fn upgrade(
env: soroban_sdk::Env,
new_wasm_hash: soroban_sdk::BytesN<32>,
operator: soroban_sdk::Address,
)
collateral_value / (outstanding + accrued_interest), in bps.
u32::MAX when the denominator is zero or the ratio overflows a u32.
fn coverage(env: soroban_sdk::Env, loan_id: u32) -> u32
Seconds since the oldest mark among the lots that count toward
coverage (control != None). u64::MAX if one of them has no mark
yet; 0 if none count.
fn mark_age(env: soroban_sdk::Env, loan_id: u32) -> u64
fn floor_bps(env: soroban_sdk::Env, loan_id: u32) -> u32
Returns Some(Address) if ownership is set, or None if ownership has
been renounced.
e - Access to the Soroban environment.fn get_owner(env: soroban_sdk::Env) -> Option
Forces a sale of qty of a lot on a Default loan. At zero
remaining, the lot reaches its terminal stage. The cash is booked
separately, by the minter's repay(sale_id) flow. Returns the
assigned sale_id.
fn liquidate(env: soroban_sdk::Env, loan_id: u32, lot_id: u32, qty: i128) -> u32
Sets a loan's minimum required coverage, in bps. Reverts for a loan the registry does not know (the coverage check reads it).
fn set_floor(env: soroban_sdk::Env, loan_id: u32, bps: u32)
Moves a lot to a non-terminal stage of its own kind, in any order.
Terminal stages (Delivered / Sold / Paid) are only reachable via
release / liquidate.
fn set_stage(
env: soroban_sdk::Env,
loan_id: u32,
lot_id: u32,
stage: LotStage,
location: Option,
)
Sets a lot's controlling document/possession state. Acknowledging a
receivable also moves it from Assigned to Acknowledged.
fn set_control(env: soroban_sdk::Env, loan_id: u32, lot_id: u32, control: Control)
Sets a lot's forced-sale haircut, in bps (≤ 10,000).
fn set_haircut(env: soroban_sdk::Env, loan_id: u32, lot_id: u32, bps: u32)
owner - Account granted ownership (intended to be the access-manager).loan_registry - The loan registry this contract reads (never writes to).fn __constructor(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
loan_registry: soroban_sdk::Address,
)
fn loan_registry(env: soroban_sdk::Env) -> soroban_sdk::Address
Sum of quantity across the loan's cargo lots (mirrored off-chain by
the CARGO token's supply).
fn cargo_quantity(env: soroban_sdk::Env, loan_id: u32) -> i128
Emits [event::MarginCall] if coverage(loan_id) is currently below
floor_bps. Callable by anyone; every state-mutating method above
runs this same check at its end.
fn check_coverage(env: soroban_sdk::Env, loan_id: u32)
Corrects a lot's quantity to new_qty (a physical/valuation
correction; use release for a normal drawdown).
fn adjust_quantity(
env: soroban_sdk::Env,
loan_id: u32,
lot_id: u32,
new_qty: i128,
reason: soroban_sdk::String,
sha256: soroban_sdk::BytesN<32>,
)
Accepts a pending ownership transfer.
e - Access to the Soroban environment.crate::role_transfer::RoleTransferError::NoPendingTransfer] - If
there is no pending transfer to accept.["ownership_transfer_completed"][new_owner: Address]fn accept_ownership(env: soroban_sdk::Env)
Sum, over lots with control != None, of
quantity * value_per_unit * (10_000 - haircut_bps), divided once at
the end by 10_000 * 1e7. A qualifying lot with no mark yet
contributes zero.
fn collateral_value(env: soroban_sdk::Env, loan_id: u32) -> i128
fn set_loan_registry(env: soroban_sdk::Env, new_loan_registry: soroban_sdk::Address)
Renounces ownership of the contract.
Permanently removes the owner, disabling all functions gated by
#[only_owner].
e - Access to the Soroban environment.OwnableError::TransferInProgress] - If there is a pending ownership
transfer.OwnableError::OwnerNotSet] - If the owner is not set.fn renounce_ownership(env: soroban_sdk::Env)
Initiates a 2-step ownership transfer to a new address.
Requires authorization from the current owner. The new owner must later
call accept_ownership() to complete the transfer.
e - Access to the Soroban environment.new_owner - The proposed new owner.live_until_ledger - Ledger number until which the new owner can
accept. A value of 0 cancels any pending transfer.OwnableError::OwnerNotSet] - If the owner is not set.crate::role_transfer::RoleTransferError::NoPendingTransfer] - If
trying to cancel a transfer that doesn't exist.crate::role_transfer::RoleTransferError::InvalidLiveUntilLedger] -
If the specified ledger is in the past.crate::role_transfer::RoleTransferError::InvalidPendingAccount] -
If the specified pending account is not the same as the provided new
address.fn transfer_ownership(
env: soroban_sdk::Env,
new_owner: soroban_sdk::Address,
live_until_ledger: u32,
)