Contract 18f37c4e1d980e53d8ec8fb7bcc28b0c6ed7eb5beea95c4af76c762c95f61332

← Back to Index 📥 Download WASM

Meta

rssdkver 23.0.2#a97daf8b07cdf24e9bd45e344db51a21b9ea77d3
rsver 1.90.0

Instances

  • CBXSFE56CARDFIZLD6YBMP6VZBBYTRRMU5FYFTTDRVXEBBFGMQ66UTXW

Interface

Extends the time-to-live (TTL) of the contract instance and its data

fn extend_ttl(env: soroban_sdk::Env)

Initializes a new campaign with the provided data

Arguments

  • e - The environment
  • sender - The address of the sender who must be authorized
  • campaign_data - The campaign configuration data

Panics

  • If the campaign is already initialized
  • If the start date is in the past
fn init(
    env: soroban_sdk::Env,
    sender: soroban_sdk::Address,
    campaign_data: CampaignData,
) -> ()

Claims a reward for completing a task

Arguments

  • e - The environment
  • influencer - The address of the influencer claiming the reward
  • task_id - The ID of the completed task
  • reward - The amount of reward to claim

Panics

  • If the campaign hasn't started
  • If the task ID is invalid
  • If the total reward would exceed campaign limit
  • If the reward amount is invalid
fn claim_reward(
    env: soroban_sdk::Env,
    influencer: soroban_sdk::Address,
    task_id: soroban_sdk::String,
    reward: i128,
) -> ()

Gets the reward claimed for a specific task

fn get_task_reward(env: soroban_sdk::Env, task_id: soroban_sdk::String) -> i128

Gets the remaining reward that can still be claimed

fn get_remaining_reward(env: soroban_sdk::Env) -> i128

Gets the campaign data

fn campaign_data(env: soroban_sdk::Env) -> CampaignData

Transfers remaining funds from the contract to the admin after campaign ends or immediately if the campaign is frozen

Arguments

  • e - The environment
  • admin - The admin address who must be authorized

Panics

  • If the campaign hasn't ended yet
  • If the admin is not authorized
fn transfer_remaining_funds(env: soroban_sdk::Env, admin: soroban_sdk::Address) -> ()

Extends the campaign duration (admin only)

Arguments

  • e - The environment
  • admin - The admin address who must be authorized
  • additional_duration - Additional duration in seconds to add

Panics

  • If the admin is not authorized
  • If the campaign is frozen
fn extend_duration(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    additional_duration: u64,
) -> ()

Toggles the campaign frozen state (admin only)

Arguments

  • e - The environment
  • admin - The admin address who must be authorized
  • frozen - The desired frozen state (true to freeze, false to unfreeze)

Panics

  • If the admin is not authorized
fn toggle_freeze(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    frozen: bool,
) -> ()

Claims collected fees (admin only)

Arguments

  • e - The environment
  • admin - The admin address who must be authorized

Panics

  • If the admin is not authorized
fn claim_fees(env: soroban_sdk::Env, admin: soroban_sdk::Address) -> ()

Sets the fee percentage (admin only)

Arguments

  • e - The environment
  • admin - The admin address who must be authorized
  • fee_percentage - The fee percentage in basis points (e.g., 100 = 1%)

Panics

  • If the admin is not authorized
  • If the fee percentage exceeds 2000 (20%)
fn set_fee_percentage(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    fee_percentage: u32,
) -> ()

Gets the total collected fees

fn get_collected_fees_public(env: soroban_sdk::Env) -> i128

Adds more rewards to an existing campaign (admin only)

Arguments

  • e - The environment
  • admin - The admin address who must be authorized
  • additional_reward - The amount of additional reward to add

Panics

  • If the admin is not authorized
  • If the campaign is frozen
  • If the additional reward amount is invalid
fn add_rewards(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    additional_reward: i128,
) -> ()

Imports

WebAssembly Text (WAT) ▶