Contract add458751ca624f37c929495ef6e55845a5120f67f4bef386c18690949236dbd

← Back to Index 📥 Download WASM

Meta

rssdkver 21.7.4#f67b4bf2d2de04d87d28225a99027fd40b7da914
rsver 1.80.0

Instances

  • CAY3YW2UGOWYUBA7YMTR7Q3IWHOOEIUO5C2N72TL56O5K6J42CQF2VII

Interface

Initializes the contract by setting the administrator address if it has not been set previously.

Parameters

  • admin: The address to be set as the administrator of the contract.

Returns

  • Ok(()) if the contract is successfully initialized with the specified administrator.
  • Err(ContractError) if an error occurs during initialization.

Errors

  • AlreadyInitialized: Thrown if the administrator has already been set, indicating the contract is already initialized.
fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
) -> Result<(), ContractError>

Performs multiple token transfers from the sender to specified addresses, with optional messages for each transfer and an optional transfer fee.

Parameters

  • sender: The address initiating the transfers.
  • addresses: A vector of recipient addresses for each transfer.
  • amounts: A vector of token amounts to transfer to each corresponding recipient.
  • messages: A vector of optional messages for each transfer.
  • token_address: The address of the token being transferred.
  • fee_token_address: The address of the token used for the transfer fee.
  • fee_recipient: The address that will receive the transfer fee.
  • fee_amount: The amount of fee tokens to be transferred to the fee recipient.

Returns

  • Ok(()) if all transfers are completed successfully.
  • Err(ContractError) if an error occurs during the multi-transfer process.

Events

Emits a message event for each recipient with topics ["message", recipient: Address], and data [message: String].

Errors

  • AddressNotWhitelisted: Throw
fn multi_transfer(
    env: soroban_sdk::Env,
    sender: soroban_sdk::Address,
    addresses: soroban_sdk::Vec,
    amounts: soroban_sdk::Vec,
    messages: soroban_sdk::Vec,
    token_address: soroban_sdk::Address,
    fee_token_address: soroban_sdk::Address,
    fee_recipient: soroban_sdk::Address,
    fee_amount: i128,
) -> Result<(), ContractError>

Checks if a specific address is on the whitelist.

Parameters

  • address: The address to check for whitelisting status.

Returns

  • bool: true if the address is whitelisted, false otherwise.
fn is_whitelisted(env: soroban_sdk::Env, address: soroban_sdk::Address) -> bool

Checks if the whitelist feature is enabled in the contract.

Returns

  • bool: true if whitelisting is enabled, false otherwise.
fn is_whitelist_enabled(env: soroban_sdk::Env) -> bool

Enables the whitelist feature in the contract, allowing addresses to be whitelisted for special permissions.

Returns

  • Ok(()) if the whitelist is successfully enabled.
  • Err(ContractError) if an error occurs during the enabling process.

Events

Emits a whitelist_enabled event with topics ["whitelist_enabled"].

Errors

  • WhitelistAlreadyEnabled: Thrown if the whitelist is already enabled.
fn enable_whitelist(env: soroban_sdk::Env) -> Result<(), ContractError>

Disables the whitelist feature in the contract, revoking special permissions for whitelisted addresses.

Returns

  • Ok(()) if the whitelist is successfully disabled.
  • Err(ContractError) if an error occurs during the disabling process.

Events

Emits a whitelist_disabled event with topics ["whitelist_disabled"].

Errors

  • WhitelistAlreadyDisabled: Thrown if the whitelist is already disabled.
fn disable_whitelist(env: soroban_sdk::Env) -> Result<(), ContractError>

Adds an address to the whitelist.

Parameters

  • address: The address to be added to the whitelist.

Returns

  • Ok(()) if the address is successfully whitelisted.
  • Err(ContractError) if an error occurs during the whitelisting process.

Events

Emits a user_whitelisted event with topics ["user_whitelisted"], data = address: Address.

Errors

  • WhitelistNotEnabled: Thrown if the whitelist feature is not enabled in the contract.
  • AddrAlreadyWhitelisted: Thrown if the address is already on the whitelist.
fn whitelist(
    env: soroban_sdk::Env,
    address: soroban_sdk::Address,
) -> Result<(), ContractError>

Removes an address from the whitelist, revoking any special permissions associated with whitelisted addresses.

Parameters

  • address: The address to be removed from the whitelist.

Returns

  • Ok(()) if the address is successfully removed from the whitelist.
  • Err(ContractError) if an error occurs during the removal process.

Events

Emits a user_unwhitelisted event with topics ["user_unwhitelisted"], data = address: Address.

Errors

  • WhitelistNotEnabled: Thrown if the whitelist feature is not enabled in the contract.
  • AddrAlreadyUnwhitelisted: Thrown if the address is not currently on the whitelist.
fn remove_from_whitelist(
    env: soroban_sdk::Env,
    address: soroban_sdk::Address,
) -> Result<(), ContractError>

Imports

WebAssembly Text (WAT) ▶