fn mint(
env: soroban_sdk::Env,
to: soroban_sdk::Address,
amount: i128,
operator: soroban_sdk::Address,
)
Owner upgrades the contract WASM.
fn upgrade(env: soroban_sdk::Env, wasm_hash: soroban_sdk::BytesN<32>)
fn clawback(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
amount: i128,
operator: soroban_sdk::Address,
)
Returns current mint cap.
fn mint_cap(env: soroban_sdk::Env) -> i128
Owner updates the Soroswap V2 pool.
fn set_pool(env: soroban_sdk::Env, pool: soroban_sdk::Address, ljoule_is_token0: bool)
Owner withdraws any token from the contract.
fn withdraw(
env: soroban_sdk::Env,
token: soroban_sdk::Address,
to: soroban_sdk::Address,
amount: i128,
)
Returns (price_x7, ledger_when_set).
fn get_price(env: soroban_sdk::Env) -> (i128, u32)
Main rebalance logic. Compares pool price vs oracle, mints or buys+burns.
fn rebalance(env: soroban_sdk::Env) -> Result<(), RebalancerAdminError>
fn set_admin(
env: soroban_sdk::Env,
new_admin: soroban_sdk::Address,
operator: soroban_sdk::Address,
)
Fund the contract with quote token (USDC) for buyback operations.
fn fund_quote(env: soroban_sdk::Env, from: soroban_sdk::Address, amount: i128)
Returns all configuration values.
fn get_config(env: soroban_sdk::Env) -> Config
Returns pool price vs oracle price status.
fn get_status(env: soroban_sdk::Env) -> Result
Initialize with SAC address, pool, quote token, oracle, and owner.
fn initialize(
env: soroban_sdk::Env,
sac: soroban_sdk::Address,
pool: soroban_sdk::Address,
quote_token: soroban_sdk::Address,
oracle: soroban_sdk::Address,
owner: soroban_sdk::Address,
ljoule_is_token0: bool,
)
Owner changes the oracle address.
fn set_oracle(env: soroban_sdk::Env, oracle: soroban_sdk::Address)
Owner updates rebalancing parameters.
fn set_params(
env: soroban_sdk::Env,
upper_bps: u32,
lower_bps: u32,
max_mint: i128,
max_quote_spend: i128,
cooldown_ledgers: u32,
min_reserve: i128,
)
Returns current price bounds (floor, ceiling).
fn price_bounds(env: soroban_sdk::Env) -> (i128, i128)
Owner sets mint cap per oracle_mint call.
fn set_mint_cap(env: soroban_sdk::Env, cap: i128)
fn total_burned(env: soroban_sdk::Env) -> i128
fn total_minted(env: soroban_sdk::Env) -> i128
Oracle updates LJOULE/USD price. Stores directly (no forwarding needed). Validates: nonce > previous, bounds check, circuit breaker (20% max swing).
fn update_price(
env: soroban_sdk::Env,
price_scaled: i128,
nonce: u64,
) -> Result<(), RebalancerAdminError>
Owner updates max stale ledgers for oracle freshness.
fn set_max_stale(env: soroban_sdk::Env, max_stale_ledgers: u32)
fn set_authorized(
env: soroban_sdk::Env,
id: soroban_sdk::Address,
authorize: bool,
operator: soroban_sdk::Address,
)
Owner emergency price override (skips circuit breaker).
fn owner_set_price(
env: soroban_sdk::Env,
price_scaled: i128,
nonce: u64,
) -> Result<(), RebalancerAdminError>
Oracle sets quote token USD price (7-decimal fixed-point).
fn set_quote_price(
env: soroban_sdk::Env,
price: i128,
) -> Result<(), RebalancerAdminError>
Owner sets price bounds (floor, ceiling).
fn set_price_bounds(env: soroban_sdk::Env, floor: i128, ceiling: i128)
fn circulating_supply(env: soroban_sdk::Env) -> i128