fn pause(env: soroban_sdk::Env)
Repay borrowed XLM (principal + accrued interest).
fn repay(env: soroban_sdk::Env, user: soroban_sdk::Address, xlm_amount: i128)
Borrow XLM against deposited sXLM collateral.
fn borrow(env: soroban_sdk::Env, user: soroban_sdk::Address, xlm_amount: i128)
fn unpause(env: soroban_sdk::Env)
Upgrade the contract WASM. Only callable by admin.
fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
fn is_paused(env: soroban_sdk::Env) -> bool
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,
)
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,
)
Returns (collateral, borrowed_including_accrued_interest) 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
fn total_borrowed(env: soroban_sdk::Env) -> i128
fn get_borrow_rate(env: soroban_sdk::Env) -> i128
fn get_pool_balance(env: soroban_sdk::Env) -> i128
Transfer all accrued interest out of the pool to admin. Admin then calls staking.add_rewards() with this amount to raise exchange rate. Returns the amount harvested in XLM stroops.
fn harvest_interest(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)
Withdraw sXLM collateral if health factor stays above 1.0.
fn withdraw_collateral(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
sxlm_amount: i128,
)
Update the sXLM → XLM exchange rate. Only callable by admin.
fn update_exchange_rate(env: soroban_sdk::Env, rate: i128)
fn get_collateral_factor(env: soroban_sdk::Env) -> i128
fn get_liquidation_bonus(env: soroban_sdk::Env) -> i128
fn total_accrued_interest(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)