fn migrate(
env: soroban_sdk::Env,
migration_data: MigrationData,
operator: soroban_sdk::Address,
)
Recovers tokens held by the contract to a specified address
caller - Address calling the function (must be governor)tokens - Array of token addresses to recoverto - Address that will receive the recovered tokensincrease_token_balancefn recover(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
tokens: soroban_sdk::Vec,
to: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
fn upgrade(
env: soroban_sdk::Env,
new_wasm_hash: soroban_sdk::BytesN<32>,
operator: soroban_sdk::Address,
)
Updates the default fee rate applied to campaign creation
caller - Address calling the function (must be governor or guardian)default_fees - New default fee rate in base 10^9fn set_fees(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
default_fees: i128,
) -> Result<(), soroban_sdk::Error>
Returns the terms and conditions message
Option<String> - The message, or None if not setfn get_message(env: soroban_sdk::Env) -> Option
Updates the terms and conditions that users must accept before creating campaigns
caller - Address calling the function (must be governor or guardian)message - New terms and conditions message textfn set_message(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
message: soroban_sdk::String,
) -> Result<(), soroban_sdk::Error>
Returns the original parameters of a campaign
campaign_id - ID of the campaign to retrieveCampaignParameters - Campaign parameters as originally createdfn get_campaign(
env: soroban_sdk::Env,
campaign_id: soroban_sdk::BytesN<32>,
) -> Result
Initializes the contract with access control, distributor, and default fees
access_control_manager - Address of the access control manager contractdistributor - Address of the Distributor contractdefault_fees - Default fee rate in base 10^9 (must be less than BASE_9)fn __constructor(
env: soroban_sdk::Env,
access_control_manager: soroban_sdk::Address,
distributor: soroban_sdk::Address,
default_fees: i128,
) -> Result<(), soroban_sdk::Error>
Returns the fee rebate for a specific user
user - The user address to queryi128 - The fee rebate percentage for the user in base 10^9fn get_fee_rebate(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128
Returns the array index of a campaign in the campaign list
campaign_id - ID of the campaign to look upu32 - Zero-based index of the campaign in the campaignList arrayfn campaign_lookup(
env: soroban_sdk::Env,
campaign_id: soroban_sdk::BytesN<32>,
) -> Result
Creates a new reward distribution campaign
caller - Address creating the campaignnew_campaign - Parameters defining the campaign structure and rewardsBytesN<32> - Unique identifier for the newly created campaignfn create_campaign(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
new_campaign: CampaignParameters,
) -> Result, soroban_sdk::Error>
Returns the Distributor contract address
Address - The Distributor contract addressfn get_distributor(env: soroban_sdk::Env) -> soroban_sdk::Address
Creates multiple reward distribution campaigns in a single transaction
caller - Address creating the campaignscampaigns - Array of campaign parameters to createVec<BytesN<32>> - Array of campaign IDs for all newly created campaignsfn create_campaigns(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
campaigns: soroban_sdk::Vec,
) -> Result>, soroban_sdk::Error>
Returns the default fee rate
i128 - The default fee rate in base 10^9fn get_default_fees(env: soroban_sdk::Env) -> i128
Returns the hash of the terms and conditions
Option<BytesN<32>> - The message hash, or None if not setfn get_message_hash(env: soroban_sdk::Env) -> Option>
Allows a user to accept Merkl's terms and conditions to enable campaign creation
caller - User accepting the conditionsfn accept_conditions(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Returns a campaign from the campaign list by its array index
array_index - The zero-based index in the campaign listCampaignParameters - The campaign at the specified indexfn get_campaign_list(
env: soroban_sdk::Env,
array_index: u32,
) -> Result
Returns the fee recipient address
Option<Address> - The fee recipient address, or None if not setfn get_fee_recipient(env: soroban_sdk::Env) -> Option
Returns the complete list of all reward tokens (including those no longer whitelisted)
Vec<Address> - Array of all reward token addressesfn get_reward_tokens(env: soroban_sdk::Env) -> soroban_sdk::Vec
Updates parameters of an existing campaign while preserving core immutable fields
caller - Address requesting the override (must be creator or authorized operator)campaign_id - ID of the campaign to overridenew_campaign - New campaign parameters (some fields will be ignored or validated)fn override_campaign(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
campaign_id: soroban_sdk::BytesN<32>,
new_campaign: CampaignParameters,
) -> Result<(), soroban_sdk::Error>
Sets campaign-type-specific fee rates that override the default fee
caller - Address calling the function (must be governor or guardian)campaign_type - Type identifier for the campaignfees - Fee rate for this campaign type in base 10^9fn set_campaign_fees(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
campaign_type: u32,
fees: i128,
) -> Result<(), soroban_sdk::Error>
Updates the address that receives protocol fees from campaign creation
caller - Address calling the function (must be governor)fee_recipient - New fee recipient addressfn set_fee_recipient(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
fee_recipient: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Returns the total number of campaigns in the campaign list
u32 - The total count of campaignsfn get_campaign_count(env: soroban_sdk::Env) -> u32
Returns the hash of the conditions a user has accepted
user - The user address to queryOption<BytesN<32>> - The hash of accepted conditions, or None if user hasn't signedfn get_user_signature(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
) -> Option>
Computes the unique campaign ID for a given set of campaign parameters
campaign - Campaign parameters to hashBytesN<32> - Unique campaign ID derived from hashing key parametersfn compute_campaign_id(
env: soroban_sdk::Env,
campaign: CampaignParameters,
) -> soroban_sdk::BytesN<32>
Extends the TTL of the contract instance, code, and key persistent entries
fn extend_contract_ttl(env: soroban_sdk::Env)
Returns the predeposited balance for a creator and reward token
creator - The creator address to querytoken - The reward token address to queryi128 - The predeposited balance amountfn get_creator_balance(
env: soroban_sdk::Env,
creator: soroban_sdk::Address,
token: soroban_sdk::Address,
) -> i128
Updates the Distributor contract address that receives and distributes rewards
caller - Address calling the function (must be governor)distributor - New Distributor contract addressfn set_new_distributor(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
distributor: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Sets a fee rebate for a specific user
caller - Address calling the function (must be governor or guardian)user - User address receiving the fee rebateuser_fee_rebate - Rebate amount in base 10^9fn set_user_fee_rebate(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
user: soroban_sdk::Address,
user_fee_rebate: i128,
) -> Result<(), soroban_sdk::Error>
Returns whether an operator is authorized to create campaigns on behalf of a user
user - The user address to queryoperator - The operator address to querybool - True if operator is authorized, false otherwisefn get_campaign_operator(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
operator: soroban_sdk::Address,
) -> bool
Returns the override parameters for a campaign
campaign_id - The campaign ID to queryOption<CampaignParameters> - The override parameters, or None if no override existsfn get_campaign_override(
env: soroban_sdk::Env,
campaign_id: soroban_sdk::BytesN<32>,
) -> Option
Returns the allowance for an operator to spend a creator's predeposited tokens
creator - The creator address to queryoperator - The operator address to querytoken - The reward token address to queryi128 - The allowance amountfn get_creator_allowance(
env: soroban_sdk::Env,
creator: soroban_sdk::Address,
operator: soroban_sdk::Address,
token: soroban_sdk::Address,
) -> i128
Permanently disables contract upgradeability
fn revoke_upgradeability(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Decreases a user's predeposited token balance and transfers tokens out
caller - Address requesting the withdrawal (must be user or governor)user - Address whose balance will be decreasedreward_token - Token to withdrawto - Address that will receive the withdrawn tokensamount - Amount to withdrawfn decrease_token_balance(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
user: soroban_sdk::Address,
reward_token: soroban_sdk::Address,
to: soroban_sdk::Address,
amount: i128,
) -> Result<(), soroban_sdk::Error>
Increases a user's predeposited token balance for campaign funding
caller - Address initiating the deposituser - Address whose balance will be increasedreward_token - Token to depositamount - Amount to depositfn increase_token_balance(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
user: soroban_sdk::Address,
reward_token: soroban_sdk::Address,
amount: i128,
) -> Result<(), soroban_sdk::Error>
Returns the persisted storage schema version (0 if unversioned legacy state).
fn contract_schema_version(env: soroban_sdk::Env) -> u32
Returns all whitelisted reward tokens and their minimum required amounts
Vec<RewardTokenAmount> - Array of reward tokens with their minimum amounts per epochfn get_valid_reward_tokens(
env: soroban_sdk::Env,
) -> Result, soroban_sdk::Error>
Decreases an operator's allowance to spend a user's predeposited tokens
caller - Address reducing the allowance (must be user or governor)user - User reducing the allowanceoperator - Operator whose allowance is being reducedreward_token - Token for which allowance is reducedamount - Amount to decrease the allowance byfn decrease_token_allowance(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
user: soroban_sdk::Address,
operator: soroban_sdk::Address,
reward_token: soroban_sdk::Address,
amount: i128,
) -> Result<(), soroban_sdk::Error>
Increases an operator's allowance to spend a user's predeposited tokens
caller - Address granting the allowance (must be user or governor)user - User granting the allowanceoperator - Operator receiving spending permissionreward_token - Token for which allowance is grantedamount - Amount to increase the allowance byfn increase_token_allowance(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
user: soroban_sdk::Address,
operator: soroban_sdk::Address,
reward_token: soroban_sdk::Address,
amount: i128,
) -> Result<(), soroban_sdk::Error>
Toggles an operator's authorization to create and manage campaigns on behalf of a user
caller - Address toggling the authorization (must be user or governor)user - User granting or revoking operator accessoperator - Operator whose authorization is being toggledfn toggle_campaign_operator(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
user: soroban_sdk::Address,
operator: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Toggles whether a user must sign the terms message before creating campaigns
caller - Address calling the function (must be governor or guardian)user - User address whose whitelist status is being toggledfn toggle_signing_whitelist(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
user: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Extends TTL for a batch of campaign entries
start - Start index (inclusive)end - End index (exclusive)fn extend_campaign_ttl_batch(env: soroban_sdk::Env, start: u32, end: u32)
Returns the reallocation target for a specific address within a campaign
campaign_id - The campaign ID to queryfrom - The address whose rewards were reallocatedOption<Address> - The target address receiving the reallocated rewards, or None if no reallocation existsfn get_campaign_reallocation(
env: soroban_sdk::Env,
campaign_id: soroban_sdk::BytesN<32>,
from: soroban_sdk::Address,
) -> Option
Returns the AccessControlManager contract address
Address - The AccessControlManager contract addressfn get_access_control_manager(env: soroban_sdk::Env) -> soroban_sdk::Address
Returns the specific fee rate for a campaign type
campaign_type - The campaign type identifierOption<i128> - The fee rate for this campaign type, or None if using default feesfn get_campaign_specific_fees(
env: soroban_sdk::Env,
campaign_type: u32,
) -> Option
Returns the most up-to-date campaign parameters, including any override.
campaign_id - ID of the campaign to retrieveCampaignParameters - The override if one exists, otherwise the originaloverride_campaign (validates nested overrides against the
latest state) and reallocate_campaign_rewards (gates reallocation on the
effective end timestamp).fn get_latest_campaign_params(
env: soroban_sdk::Env,
campaign_id: soroban_sdk::BytesN<32>,
) -> Result
Points this contract at a new AccessControlManager (ACM).
caller - Address calling the function (must be a governor in both ACMs)new_access_control_manager - Address of the ACM to trust going forwardnew_access_control_manager.set_access_control_manager(...) first, then call this setter.fn set_access_control_manager(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
new_access_control_manager: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Returns the minimum required amount for a reward token
token - The reward token address to queryi128 - The minimum amount required per epoch, or 0 if token is not whitelistedfn get_reward_token_min_amount(
env: soroban_sdk::Env,
token: soroban_sdk::Address,
) -> i128
Reallocates unclaimed rewards from specific addresses to a new recipient after campaign ends
caller - Address requesting the reallocation (must be creator or authorized operator)campaign_id - ID of the completed campaign to reallocate fromfroms - Array of addresses whose unclaimed rewards should be reallocatedto - Address that will receive the reallocated rewardsstart_timestamp + duration is used as the effective end.fn reallocate_campaign_rewards(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
campaign_id: soroban_sdk::BytesN<32>,
froms: soroban_sdk::Vec,
to: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Returns whether a user is whitelisted from signature requirements
user - The user address to querybool - True if user is whitelisted, false otherwisefn get_user_signature_whitelist(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
) -> bool
Configures minimum reward amounts per epoch for whitelisted tokens
caller - Address calling the function (must be governor or guardian)tokens - Array of reward token addressesamounts - Array of minimum amounts (0 = remove from whitelist, >0 = add/update)fn set_reward_token_min_amounts(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
tokens: soroban_sdk::Vec,
amounts: soroban_sdk::Vec,
) -> Result<(), soroban_sdk::Error>
Returns a paginated list of whitelisted reward tokens
skip - Number of tokens to skipfirst - Maximum number of tokens to returnVec<RewardTokenAmount> - Array of reward tokens and their minimum amountsfn get_valid_reward_tokens_paged(
env: soroban_sdk::Env,
skip: u32,
first: u32,
) -> Result, soroban_sdk::Error>
Returns all addresses from which rewards were reallocated for a campaign
campaign_id - ID of the campaignVec<Address> - Array of addresses that had rewards reallocated away from themfn get_campaign_list_reallocation(
env: soroban_sdk::Env,
campaign_id: soroban_sdk::BytesN<32>,
) -> Result, soroban_sdk::Error>
Returns whether upgradeability is deactivated
bool - True if upgradeability is deactivated, false otherwisefn get_upgradeability_deactivated(env: soroban_sdk::Env) -> bool
Returns all timestamps when a campaign was overridden
campaign_id - ID of the campaignVec<u64> - Array of block timestamps when overrides occurredfn get_campaign_overrides_timestamp(
env: soroban_sdk::Env,
campaign_id: soroban_sdk::BytesN<32>,
) -> Result, soroban_sdk::Error>