Cures a defaulted loan back to WatchList. The pocket stays open:
every later repayment of this loan still goes to it.
fn cure(env: soroban_sdk::Env, loan_id: u32)
Returns the token collection name.
e - Access to the Soroban environment.fn name(env: soroban_sdk::Env) -> soroban_sdk::String
fn pause(env: soroban_sdk::Env, caller: soroban_sdk::Address)
fn minter(env: soroban_sdk::Env) -> 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
fn pocket(env: soroban_sdk::Env) -> soroban_sdk::Address
fn status(env: soroban_sdk::Env, loan_id: u32) -> LoanStatus
Returns the token collection symbol.
e - Access to the Soroban environment.fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String
fn approve(
env: soroban_sdk::Env,
approver: soroban_sdk::Address,
approved: soroban_sdk::Address,
token_id: u32,
live_until_ledger: u32,
)
Returns the number of tokens owned by account.
e - Access to the Soroban environment.account - The address for which the balance is being queried.fn balance(env: soroban_sdk::Env, account: soroban_sdk::Address) -> u32
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,
)
Draws amount against the senior tranche. The first call on a loan
opens interest epoch 0 and moves it Approved -> Performing;
subsequent calls close and reopen the current epoch.
fn disburse(env: soroban_sdk::Env, loan_id: u32, amount: u128)
Returns the owner of the token with token_id.
e - Access to the Soroban environment.token_id - Token ID as a number.NonFungibleTokenError::NonExistentToken] - If the token does not
exist.fn owner_of(env: soroban_sdk::Env, token_id: u32) -> soroban_sdk::Address
Rolls a matured, non-defaulted loan onto new terms. Status is unchanged.
fn rollover(
env: soroban_sdk::Env,
loan_id: u32,
new_rate: u32,
new_maturity_timestamp: u64,
)
fn transfer(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
token_id: u32,
)
Draws a new loan in Approved status: validates economics, records
origination state (no epoch opened yet), and mints the soulbound loan
token to the configured capital_wallet. Returns the new loan ID.
fn draw_loan(
env: soroban_sdk::Env,
metadata_uri: soroban_sdk::String,
economics: ImmutableLoanData,
) -> 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
fn token_uri(env: soroban_sdk::Env, token_id: u32) -> soroban_sdk::String
Closes a performing (or never-disbursed) loan. Cancelled requires
net disbursed to be zero; ScheduledMaturity/EarlyRepayment require
outstanding to be zero. Any residual accrued interest up to
max_residual is waived.
fn close_loan(env: soroban_sdk::Env, loan_id: u32, reason: ClosureReason)
fn loan_money(env: soroban_sdk::Env, loan_id: u32) -> LoanMoney
fn set_minter(env: soroban_sdk::Env, new_minter: soroban_sdk::Address)
Reverses amount of disbursed principal. Status is unchanged. Refused
once the loan is carved out: the pocket holds PLUSD for the outstanding
at default, which could then never be released or burned.
fn undisburse(env: soroban_sdk::Env, loan_id: u32, amount: u128)
Writes down amount of a defaulted loan's outstanding balance,
burning it from the loan's pocket. What the pocket does not hold (the
vault could not cover it at default) is added to unabsorbed_total.
No cash moves.
fn write_down(env: soroban_sdk::Env, loan_id: u32, amount: u128)
fn max_fee_bps(env: soroban_sdk::Env) -> u32
fn outstanding(env: soroban_sdk::Env, loan_id: u32) -> u128
Moves a Performing/WatchList loan into Default. The first time
only, carves the loan's outstanding out of the vault into its pocket
(owned by the share holders at the end of this ledger). What the vault
cannot cover is not a loss yet (it may still be recovered): it reaches
unabsorbed_total only if written down. A cured loan defaulted again
keeps its original pocket.
fn set_default(env: soroban_sdk::Env, loan_id: u32)
Returns the account approved for the token with token_id.
e - Access to the Soroban environment.token_id - Token ID as a number.NonFungibleTokenError::NonExistentToken] - If the token does not
exist.fn get_approved(env: soroban_sdk::Env, token_id: u32) -> Option
fn max_residual(env: soroban_sdk::Env) -> u128
fn next_loan_id(env: soroban_sdk::Env) -> u32
fn staked_plusd(env: soroban_sdk::Env) -> soroban_sdk::Address
Initializes the collection metadata, the contract owner, and the vault and pocket the registry reports defaults and write-downs to.
owner - Account granted ownership (intended to be the access-manager).name / symbol - NFT collection metadata.staked_plusd / pocket - The sPLUSD vault and the pocket.fn __constructor(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
name: soroban_sdk::String,
symbol: soroban_sdk::String,
staked_plusd: soroban_sdk::Address,
pocket: soroban_sdk::Address,
)
fn transfer_from(
env: soroban_sdk::Env,
spender: soroban_sdk::Address,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
token_id: u32,
)
fn capital_wallet(env: soroban_sdk::Env) -> soroban_sdk::Address
Records a repayment against a loan (recoveries included, on
Default), capitalizing interest accrued so far. Returns the
repayment ID and whether the loan is carved out.
fn record_payment(
env: soroban_sdk::Env,
loan_id: u32,
repayment: RepaymentData,
) -> (u32, bool)
fn repayment_data(
env: soroban_sdk::Env,
loan_id: u32,
repayment_id: u32,
) -> RepaymentData
Updates a loan's off-chain-reported metadata and, within limits, its
status. On Approved/Default, status must equal the current
status (metadata-only update); on Performing/WatchList, status
may only stay put or toggle between the two.
fn update_mutable(
env: soroban_sdk::Env,
loan_id: u32,
status: LoanStatus,
metadata_uri: soroban_sdk::String,
)
Adds a signed adjustment (a waiver is negative) to a loan's accrued interest.
fn adjust_interest(
env: soroban_sdk::Env,
loan_id: u32,
delta: i128,
reason_hash: soroban_sdk::BytesN<32>,
)
Amends a non-closed loan's rate and maturity. Status is unchanged;
allowed even while Approved (before any epoch exists) or Default.
fn amend_economics(
env: soroban_sdk::Env,
loan_id: u32,
new_rate: u32,
new_maturity_timestamp: u64,
)
fn approve_for_all(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
operator: soroban_sdk::Address,
live_until_ledger: u32,
)
Closes a defaulted loan once its outstanding balance has been brought to zero, waiving any residual interest.
fn close_defaulted(env: soroban_sdk::Env, loan_id: u32, reason: ClosureReason)
fn economics_epoch(
env: soroban_sdk::Env,
loan_id: u32,
epoch_id: u32,
) -> EconomicsEpoch
fn set_max_fee_bps(env: soroban_sdk::Env, new_max_fee_bps: u32)
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)
Total senior interest currently owed on the loan. Zero on Approved
and Closed.
fn accrued_interest(env: soroban_sdk::Env, loan_id: u32) -> u128
fn set_max_residual(env: soroban_sdk::Env, new_max_residual: u128)
fn unabsorbed_total(env: soroban_sdk::Env) -> u128
Reverses a previously recorded repayment (once only). Returns the
reversed [RepaymentData].
fn unrecord_payment(env: soroban_sdk::Env, loan_id: u32, id: u32) -> RepaymentData
fn mutable_loan_data(env: soroban_sdk::Env, loan_id: u32) -> MutableLoanData
fn outstanding_total(env: soroban_sdk::Env) -> u128
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)
fn set_capital_wallet(env: soroban_sdk::Env, new_capital_wallet: soroban_sdk::Address)
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,
)
fn immutable_loan_data(env: soroban_sdk::Env, loan_id: u32) -> ImmutableLoanData
Returns whether the operator is allowed to manage all the assets of
owner.
e - Access to the Soroban environment.owner - Account of the token's owner.operator - Account to be checked.fn is_approved_for_all(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
operator: soroban_sdk::Address,
) -> bool
fn is_repayment_reversed(
env: soroban_sdk::Env,
loan_id: u32,
repayment_id: u32,
) -> bool
fn cumulative_repayment_data(env: soroban_sdk::Env, loan_id: u32) -> RepaymentData