Repay borrowed XLM.
fn repay(env: soroban_sdk::Env, user: soroban_sdk::Address, xlm_amount: i128)
fn vault(env: soroban_sdk::Env) -> soroban_sdk::Address
Borrow XLM against deposited sXLM collateral.
fn borrow(env: soroban_sdk::Env, user: soroban_sdk::Address, xlm_amount: i128)
Upgrade the contract WASM. Only callable by admin.
fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
Liquidate an unhealthy position. Liquidator repays debt and receives collateral + bonus.
fn liquidate(
env: soroban_sdk::Env,
liquidator: soroban_sdk::Address,
borrower: soroban_sdk::Address,
)
Apply a governance-approved parameter change.
fn set_param(env: soroban_sdk::Env, key: soroban_sdk::Symbol, value: i128)
Point this contract at the vault, once.
Needed only to migrate a contract deployed before the rate was read cross-contract. It can be set exactly once: naming the source is a different power from setting the price, and freezing it after the first write keeps an admin from later swapping in a vault that lies.
fn set_vault(env: soroban_sdk::Env, vault: soroban_sdk::Address)
fn governance(env: soroban_sdk::Env) -> soroban_sdk::Address
Initialize the lending contract.
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
sxlm_token: soroban_sdk::Address,
native_token: soroban_sdk::Address,
collateral_factor_bps: u32,
liquidation_threshold_bps: u32,
borrow_rate_bps: u32,
vault: soroban_sdk::Address,
)
Returns (collateral, borrowed) for a user.
fn get_position(env: soroban_sdk::Env, user: soroban_sdk::Address) -> (i128, i128)
Bump instance TTL — can be called by anyone to keep contract alive.
fn bump_instance(env: soroban_sdk::Env)
Returns health factor scaled by RATE_PRECISION (1e7 = 1.0). Uses liquidation threshold (not collateral factor) to match what liquidate() checks.
fn health_factor(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128
Hand parameter control to the governance contract, once.
fn set_governance(env: soroban_sdk::Env, governance: soroban_sdk::Address)
fn total_borrowed(env: soroban_sdk::Env) -> i128
fn get_borrow_rate(env: soroban_sdk::Env) -> i128
Pass accrued interest to the vault, raising the sXLM exchange rate.
Callable by anyone — it moves money in one direction only, from this contract to holders, so there is nothing to gain by calling it and nothing to lose by letting anyone.
The vault takes its own protocol fee out of what arrives, so this split
is on top of that one: VaultShareBps reaches holders and the remainder
stays here as protocol revenue.
fn settle_interest(env: soroban_sdk::Env) -> i128
fn get_borrow_index(env: soroban_sdk::Env) -> i128
fn get_pool_balance(env: soroban_sdk::Env) -> i128
fn total_collateral(env: soroban_sdk::Env) -> i128
fn get_exchange_rate(env: soroban_sdk::Env) -> i128
Deposit sXLM as collateral.
fn deposit_collateral(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
sxlm_amount: i128,
)
Update the borrow rate. Only callable by admin.
fn update_borrow_rate(env: soroban_sdk::Env, new_rate_bps: u32)
fn get_max_utilization(env: soroban_sdk::Env) -> i128
fn get_vault_share_bps(env: soroban_sdk::Env) -> i128
Withdraw sXLM collateral if health factor stays above 1.0.
fn withdraw_collateral(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
sxlm_amount: i128,
)
fn get_collateral_factor(env: soroban_sdk::Env) -> i128
fn get_liquidation_bonus(env: soroban_sdk::Env) -> i128
Interest charged to borrowers and not yet passed to the vault.
fn total_accrued_interest(env: soroban_sdk::Env) -> i128
Update the recursion cap. Only callable by admin.
fn update_max_utilization(env: soroban_sdk::Env, new_bps: u32)
fn get_liquidation_fee_bps(env: soroban_sdk::Env) -> i128
Update the collateral factor. Only callable by admin.
fn update_collateral_factor(env: soroban_sdk::Env, new_cf_bps: u32)
fn get_liquidation_threshold(env: soroban_sdk::Env) -> i128
Update the liquidation threshold. Only callable by admin.
fn update_liquidation_threshold(env: soroban_sdk::Env, new_lt_bps: u32)