fn get_sale(env: soroban_sdk::Env, receivable_id: u128) -> SaleListing
Investor sends stablecoin proportional to their share.
amount_cents — how much of the face value they want to buy.
Investor pays amount_cents * (1 - discount_bps/10000).
KYC enforcement: The receivable token asset is issued with AUTH_REQUIRED flag on the Stellar issuer account. The Stellar protocol prevents any non-authorized trustline from receiving tokens — so KYC is enforced at the protocol layer automatically.
fn buy_share(
env: soroban_sdk::Env,
investor: soroban_sdk::Address,
receivable_id: u128,
amount_cents: i128,
)
Closes the sale window and releases discounted proceeds to the exporter. Can be called by the exporter once enough is subscribed, or auto-called when face value is fully subscribed.
fn close_sale(env: soroban_sdk::Env, caller: soroban_sdk::Address, receivable_id: u128)
fn initialize(env: soroban_sdk::Env, admin: soroban_sdk::Address)
Called by the exporter after their receivable has been attested.
discount_bps — discount in basis points (100 bps = 1%).
A 500 bps discount on a $10,000 receivable means investors pay $9,500.
min_share_cents — smallest tranche an investor can buy (e.g. $100 = 10000).
max_share_cents — 0 means no upper limit per investor.
fn list_for_sale(
env: soroban_sdk::Env,
exporter: soroban_sdk::Address,
receivable_id: u128,
face_value_cents: i128,
discount_bps: u32,
min_share_cents: i128,
max_share_cents: i128,
stablecoin_address: soroban_sdk::Address,
)
Called by the exporter (or admin) to adjust the discount rate while the sale is still open. Investors who have already bought shares are NOT retroactively affected; only future purchases use the new rate.
new_discount_bps — new discount in basis points (1 to 2000).
fn update_discount(
env: soroban_sdk::Env,
exporter: soroban_sdk::Address,
receivable_id: u128,
new_discount_bps: u32,
)
fn get_investor_share(
env: soroban_sdk::Env,
receivable_id: u128,
investor: soroban_sdk::Address,
) -> i128