Contract d501d20cfea6676b51ff341b408bbe4e406a17e4a21516064d8ea9663994088e

← Back to Index 📥 Download WASM

Meta

cliver 27.0.0#5a7c5fe76530bf4248477ac812fc757146b98cc4
rssdk_spec_shaking 2
rssdkver 27.0.6#60926a20d1f9f0a669d5fe551636f42a1302f0c0
rsver 1.98.1
source_repo github:zenith-protocols/zenex-util-contracts

Instances

  • CDOAKNTCQZSBQJY7FFQI7RUURJKY37KYI6GV464H2YHTDJ7DBI27F4J5

Interface

Collects fee_amount of fee_token from user to fee_recipient, then calls target_contract.target_fn(target_args) and returns its result. A failing target also reverts the fee.

user authorizes (fee_token, max_fee_amount, expiration_ledger, fee_recipient, target_contract, target_fn, target_args).

Arguments

  • e - Access to the Soroban environment.
  • fee_token - The token the fee is paid in.
  • fee_amount - The fee, above zero and at most max_fee_amount.
  • max_fee_amount - The fee cap the user signs.
  • expiration_ledger - The fee allowance's live-until ledger, at or after execution.
  • target_contract, target_fn, target_args - The call to make.
  • user - The fee payer.
  • fee_recipient - The fee payee.

Errors and events: see README.md.

fn forward(
    env: soroban_sdk::Env,
    fee_token: soroban_sdk::Address,
    fee_amount: i128,
    max_fee_amount: i128,
    expiration_ledger: u32,
    target_contract: soroban_sdk::Address,
    target_fn: soroban_sdk::Symbol,
    target_args: soroban_sdk::Vec,
    user: soroban_sdk::Address,
    fee_recipient: soroban_sdk::Address,
) -> soroban_sdk::Val

Acts as [Self::forward], but the user's authorization leaves out target_args, so the relayer can refresh them after signing.

Arguments

  • Refer to [Self::forward].

Errors and events

  • See README.md, the same as [Self::forward].

Notes

  • Authorization for user is required over (fee_token, max_fee_amount, expiration_ledger, fee_recipient, target_contract, target_fn).
  • The target flow must require the user's own authorization on every call that moves the user's funds. Otherwise a relayer can supply arbitrary target_args and still collect the fee.
fn forward_dynamic(
    env: soroban_sdk::Env,
    fee_token: soroban_sdk::Address,
    fee_amount: i128,
    max_fee_amount: i128,
    expiration_ledger: u32,
    target_contract: soroban_sdk::Address,
    target_fn: soroban_sdk::Symbol,
    target_args: soroban_sdk::Vec,
    user: soroban_sdk::Address,
    fee_recipient: soroban_sdk::Address,
) -> soroban_sdk::Val

Imports

WebAssembly Text (WAT) ▶