Contract 0ab013dd9f4373f3052ad39dbb4f60def9495b77d301a3aab08405ac2b1052d8

← Back to Index 📥 Download WASM

Meta

rssdkver 23.5.1#59fcef437260ed4da42d1efb357137a5c166c02e
rsver 1.92.0

Instances

  • CCC2V3YONPLSMUSUMVJHQ5ASVEGNKKFZR6CKJCM5OLTJNZIMU45VFRG7

Interface

Owner updates the V3 pool, router, and fee tier.

fn set_pool(
    env: soroban_sdk::Env,
    pool: soroban_sdk::Address,
    joule_is_token0: bool,
    router: soroban_sdk::Address,
    pool_fee: u32,
)

Owner withdraws any token from the contract.

fn withdraw(
    env: soroban_sdk::Env,
    token: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
)

Main rebalance logic. Compares pool price vs oracle, mints or buys+burns.

fn rebalance(env: soroban_sdk::Env) -> Result<(), RebalancerError>

Fund the contract with quote token (e.g. 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 the rebalancer with all config. quote_token is the pool's quote asset (e.g. USDC SAC address).

fn initialize(
    env: soroban_sdk::Env,
    joule_token: soroban_sdk::Address,
    pool: soroban_sdk::Address,
    quote_token: soroban_sdk::Address,
    oracle: soroban_sdk::Address,
    owner: soroban_sdk::Address,
    joule_is_token0: bool,
    router: soroban_sdk::Address,
    pool_fee: u32,
)

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,
)

Oracle forwards a JOULE/USD price update to the JOULE token contract.

fn update_price(
    env: soroban_sdk::Env,
    price_scaled: i128,
    nonce: u64,
) -> Result<(), RebalancerError>

Owner updates max stale ledgers for oracle freshness.

fn set_max_stale(env: soroban_sdk::Env, max_stale_ledgers: u32)

Oracle sets quote token USD price (7-decimal fixed-point).

fn set_quote_price(env: soroban_sdk::Env, price: i128) -> Result<(), RebalancerError>

Imports

WebAssembly Text (WAT) ▶