Initializes the contract by setting the administrator address if it has not been set previously.
admin: The address to be set as the administrator of the contract.Ok(()) if the contract is successfully initialized with the specified administrator.Err(ContractError) if an error occurs during initialization.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.
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.Ok(Address) with the address of the deployed contract if successful.Err(ContractError) if an error occurs during deployment.AddressNotWhitelisted: Thrown if the sender is not whitelisted and whitelisting is enabled.InsufficientTokenBalance: Thrown if the sender’sfn 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.
address: The address to check for whitelisting status.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.
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.
Ok(()) if the whitelist is successfully enabled.Err(ContractError) if an error occurs during the enabling process.Emits a whitelist_enabled event with topics ["whitelist_enabled"].
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.
Ok(()) if the whitelist is successfully disabled.Err(ContractError) if an error occurs during the disabling process.Emits a whitelist_disabled event with topics ["whitelist_disabled"].
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.
address: The address to be added to the whitelist.Ok(()) if the address is successfully whitelisted.Err(ContractError) if an error occurs during the whitelisting process.Emits a user_whitelisted event with topics ["user_whitelisted"], data = address: Address.
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.
address: The address to be removed from the whitelist.Ok(()) if the address is successfully removed from the whitelist.Err(ContractError) if an error occurs during the removal process.Emits a user_unwhitelisted event with topics ["user_unwhitelisted"], data = address: Address.
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>