Contract 953c4960f1ce068e184bedbeaa1967049d37d4428d1d33a309c9b1aad08cf852

← Back to Index 📥 Download WASM

Meta

rssdkver 27.0.5#ea54f95d3f2f49e0487b29fd1a9f469638f09aba
rsver 1.96.0

Instances

  • CBZ4MM6J2FHRASHGWMEEDGGERBNELE4TDUAXTFG6NOF3FSUQWFHOZRBT

Interface

fn caps(env: soroban_sdk::Env) -> AdapterCaps

The address that administers this adapter's allowlist.

A view, added in Phase 11 alongside caller() and for the same reason (ADR-037): scripts/verify_deployment.sh has to read the owner off the chain rather than trust the deploy script's variable. The value was always stored — initialize takes it — but nothing exposed it, so the one check that would catch an adapter initialized by the wrong key was the one check that could not be made.

fn owner(env: soroban_sdk::Env) -> Result

The one contract permitted to invoke this adapter.

A view, added in Phase 11 for scripts/verify_deployment.sh. The binding is the single most error-prone fact in a deployment — a venue reachable from three contracts needs three adapter instances, and one bound to the wrong caller passes every other check and fails on the first user call. A deployment invariant that cannot be read cannot be verified.

fn caller(env: soroban_sdk::Env) -> Result

Verification

The adapter receives the output itself, measures its own balance delta across the router call, then sweeps that exact amount to the beneficiary. Measuring before the sweep rather than on the beneficiary is deliberate: the beneficiary may hold the output token already, and a delta on their balance would also capture anything else that moved in the same transaction.

min_out is enforced twice over — once by the router, which takes amount_out_min natively, and once here against the measurement. The second is the one that counts (ADR-007).

fn execute(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    action: Action,
    token_in: soroban_sdk::Address,
    amount: i128,
    beneficiary: soroban_sdk::Address,
    min_out: i128,
    params: AdapterParams,
) -> Result
fn routers(env: soroban_sdk::Env) -> soroban_sdk::Vec

caller is the vault, swap router or executor this adapter serves; owner administers the router allowlist.

fn initialize(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    caller: soroban_sdk::Address,
) -> Result<(), AdapterError>

Owner-gated. Permits swap_exact_tokens_for_tokens on router.

Only that entry point. A router exposes liquidity management and admin functions too, and none of them is something this adapter should be able to reach.

No auth_owner call here: allowlist::allow authorizes the owner itself. Soroban permits require_auth for an address at most once per frame, so doing both raises Error(Auth, ExistingValue) — ADR-017. One owner-gated primitive per entry point, and this is it.

fn allow_router(
    env: soroban_sdk::Env,
    router: soroban_sdk::Address,
) -> Result<(), AdapterError>

Owner-gated. allowlist::revoke_target authorizes the owner itself — see [Self::allow_router].

fn revoke_router(
    env: soroban_sdk::Env,
    router: soroban_sdk::Address,
) -> Result<(), AdapterError>

Whether router may be called for a swap.

fn router_allowed(env: soroban_sdk::Env, router: soroban_sdk::Address) -> bool
fn authorized_caller(
    env: soroban_sdk::Env,
) -> Result

Imports

WebAssembly Text (WAT) ▶