fn admin(env: soroban_sdk::Env) -> soroban_sdk::Address
Settle a completed sale: withdraw the sold amount from Blend and pay the seller. Called by the ZmokeAgent after confirming on-chain payment.
seller_amount is the principal the seller receives. Platform yield
(if any) remains in the Blend position; harvest it separately via
withdraw_yield.
Auth: admin only.
fn settle(
env: soroban_sdk::Env,
token: soroban_sdk::Address,
seller: soroban_sdk::Address,
seller_amount: i128,
)
Deposit USDC or XLM into the pool. Funds are immediately routed into the Blend yield pool so yield accrues from the moment of deposit.
Called by the ZmokeAgent after verifying the buyer's on-chain transaction.
Auth: caller.require_auth() is required. The caller must also have
authorized the token transfer in the same auth tree entry (handled by
the wallet or the Worker's feebump transaction construction).
fn deposit(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
token: soroban_sdk::Address,
amount: i128,
)
Rotate the treasury admin to a new address.
fn set_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)
Claim accrued BLND token emissions from the Blend backstop.
reserve_token_ids: Blend reserve IDs to claim for (e.g., [0] for XLM,
[1] for USDC, [0, 1] for both). The BLND tokens are sent to admin.
Auth: admin only.
fn claim_blnd(env: soroban_sdk::Env, reserve_token_ids: soroban_sdk::Vec)
Initialize the contract once. Addresses are runtime parameters so that testnet and mainnet deployments share identical WASM (no hardcoded values).
admin — Treasury address. Only this key can settle and harvest.blend_pool — Blend lending pool contract address.xlm_sac — XLM Stellar Asset Contract address for this network.usdc_sac — USDC token contract address for this network.fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
blend_pool: soroban_sdk::Address,
xlm_sac: soroban_sdk::Address,
usdc_sac: soroban_sdk::Address,
)
Withdraw accumulated yield from Blend directly to the treasury (admin).
The Worker calculates yield = (current Blend position) − (total deposited).
Only the yield-portion should be passed as amount to preserve principal.
Auth: admin only.
fn withdraw_yield(env: soroban_sdk::Env, token: soroban_sdk::Address, amount: i128)
fn blend_pool_addr(env: soroban_sdk::Env) -> soroban_sdk::Address
Return the total deposited principal for a token. Used by the Worker to compute: yield = blend_position − total_deposited.
fn get_total_deposited(env: soroban_sdk::Env, token: soroban_sdk::Address) -> i128