Contract b772487fffd3713d277d03185b214b87e5082d87ee4520ffc138462c84dcca8b

← Back to Index 📥 Download WASM

Meta

rssdkver 21.7.4#f67b4bf2d2de04d87d28225a99027fd40b7da914
rsver 1.80.0

Instances

  • CC75MCVNIVBMA4KDLVSO2DNTNXFODLO6KPEJ25QH6DJEWHUSVLUICTQI

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>

Deploys a new contract using the provided Wasm hash and initialization parameters. After deployment, invokes the contract's init function with the specified arguments.

Parameters

  • deployer: The address initiating the deployment, required for authorization.
  • wasm_hash: The hash of the Wasm code for the new contract.
  • salt: A salt value used to derive a unique contract address.
  • init_fn: The name of the init function to call on the newly deployed contract.
  • init_args: A vector of arguments for the init function.
  • token_address: The address of the token used to pay the fee.
  • fee_recipient: The address receiving the deployment fee.
  • fee_amount: The amount of tokens to transfer as a fee.

Returns

  • Ok(Address) with the address of the deployed contract if successful.
  • Err(ContractError) if an error occurs during deployment.

Errors

  • AddressNotWhitelisted: Thrown if the sender is not whitelisted and whitelisting is enabled.
  • InsufficientTokenBalance: Thrown if the sender’s
fn deploy(
    env: soroban_sdk::Env,
    deployer: soroban_sdk::Address,
    wasm_hash: soroban_sdk::BytesN<32>,
    salt: soroban_sdk::BytesN<32>,
    init_fn: soroban_sdk::Symbol,
    init_args: soroban_sdk::Vec,
    token_address: soroban_sdk::Address,
    fee_recipient: soroban_sdk::Address,
    fee_amount: i128,
) -> Result

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, granting it any special permissions associated with whitelisted addresses.

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