Campaign

The Campaign Contract manages campaign information, reward information, and participation history. In addition, participation in the campaign and payment of rewards are also made in the Campaign Contract. Rewards are divided into participation rewards and referral rewards, and VKR is used for referral rewards by default.

To set participation conditions except deposit, you must use qualifier. For the implementation of Qualifier, refer to next document.

When instantiating a Campaign Contract, the CampaignManager's CampaignInstatntiateMsg is used

CampaignConfigMsg

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct CampaignConfigMsg {
    pub title: String,
    pub description: String,
    pub url: String,
    pub parameter_key: String,
    pub participation_reward_denom: Denom,
    pub participation_reward_amount: Uint128,
    pub referral_reward_amounts: Vec<Uint128>,
}

Key

Type

Description

title

String

Campaign title

description

String

Campaign description

url

String

Campaign site url

parameter_key

String

Query parameter key to contain referral information

participation_reward_denom

Denom

Participation reward denom

participation_reward_amount

Uint128

Participation reward quantity

referral_reward_amount

Vec<Uint128>

Referral reward scheme

ExecuteMsg

UpdateCampaignInfo

Updates the configuration for the Campaign information (title, url, description)

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    UpdateCampaignConfig {
        title: Option<String>,
        description: Option<String>,
        url: Option<String>,
        parameter_key: Option<String>,
        deposit_amount: Option<Uint128>,
        deposit_lock_period: Option<u64>,
        qualifier: Option<String>,
        qualification_description: Option<String>,        
        executions: Option<Vec<ExecutionMsg>>,
        admin: Option<String>,
    }
}

Key

Type

Description

title*

String

Campaign title

description*

String

Campaign description

url*

String

Campaign site url

parameter_key*

String

Query parameter key to contain referral information

deposit_amount*

Uint128

The amount of deposit required to participate in the campaign

deposit_lock_period*

u64

The period from participate in the campaign until withdraw

qualifier*

String

The qualifier contract address used for validation in the campaign

qualification_description

String

Campaign participation conditions text description

executions*

Vec<ExecutionMsg>

Messages to be executed when participating in the campaign

admin*

String

The admin address with the right to edit the settings for the campaign

* = optional

UpdateRewardConfig

One can configure the participation and referral rewards scheme

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    UpdateRewardConfig {
        participation_reward_amount: Option<Uint128>,
        referral_reward_amounts: Option<Vec<Uint128>>,
    }
}

Key

Type

Description

participation_reward_amount*

Uint128

Participation reward amount

referral_reward_amount*

Vec<Uint128>

Referral reward scheme

* = optional

UpdateActivation

..

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    UpdateActivation {
        active: bool,
    }
}

Key

Type

Description

active

bool

Campaign activation change

SetNoQulification

Set when there is no Qualification Contract

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    SetNoQualification {},
}

AddRewardPool

A message to add a reward to the campaign pool. a minimum Referral rewards ratio 20% must be maintained on the contract. **When executing the message, 1% of the total additional rewards (participation reward + shared reward) is used as a commission..**(Approximate value in UST)

CW20 executes AddRewardPool Message after granting permission with Allowance without sending with Send/Transfer.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
   AddRewardPool {
        participation_reward_amount: Uint128,
        referral_reward_amount: Uint128,
    }
}

Key

Type

Description

participation_reward_amount

Uint128

Participation reward amount

referral_reward_amount

Uint128

Referral reward amount

RemoveRewardPool

A message that subtracts the added reward with the AddRewardPool message. A fee of 10% is applied when removing

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    RemoveRewardPool {
        denom: Denom,
        amount: Option<Uint128>,
    },
}

Key

Type

Description

denom

Denom

The denomination of the token requesting withdrawal

amount*

Uint128

The withdrawal amount (default = [withdrawable_balance])

* = optional

RemoveIrregularRewardPool

Used when withdrawing deposit errors

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    RemoveIrregularRewardPool {
        denom: Denom,
    },
}

Key

Type

Description

denom

Denom

Destination address of withdrawing request

ClaimParticipationReward

When Users claim their participation reward

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
     ClaimParticipationReward {},
}

ClaimReferralReward

When Users claim their referral reward

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    ClaimReferralReward {}
}

Participate

Participation Message

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    Participate {
        actor: String,
        referrer: Option<Referrer>,
    },
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum Referrer {
    Address(String),
    Compressed(String),
}

Key

Type

Description

actor

String

User wallet address

referrer*

Referrer

Referrer's wallet address

* = optional

Deposit

When you deposit and participate in the tokens used to participate in the campaign, you are locked by lock_period.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    Deposit {},
}

Withdraw

Withdrawal (only unlocked amount)

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    Withdraw {
        amount: Uint128,
    },
}

Key

Type

Description

amount

Uint128

Withdrawal amount

Receive Hooks

Deposit

Message used to deposit when using CW20 tokens as deposit

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum Cw20HookMsg {
    Deposit {}
}

QueryMsg

CampaignConfig

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    CampaignConfig {}
}

Response

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
pub struct CampaignConfigResponse {
    pub governance: String,
    pub campaign_manager: String,
    pub title: String,
    pub description: String,
    pub url: String,
    pub parameter_key: String,
    pub deposit_denom: Option<Denom>,
    pub deposit_amount: Uint128,
    pub deposit_lock_period: u64,
    pub qualifier: Option<String>,
    pub qualification_description: Option<String>,
    pub executions: Vec<ExecutionMsg>,
    pub admin: String,
    pub creator: String,
    pub created_at: Timestamp,
}

Key

Type

Description

governance

String

Contract address of governance

campaign_manager

String

Contract address of campaign-manager

title

String

Campaign title

description

String

Campaign description

url

String

Campaign site url

parameter_key

String

Query parameter key to contain referral information

deposit_denom*

Denom

Deposit required to participate in the campaign denom

deposit_amount

Uint128

The amount of amount required to participate in the campaign

deposit_lock_period

u64

The period from participate in the campaign until withdraw

qualifier

String

The qualifier contract address used for validation in the campaign

qualification_description

String

Campaign participation conditions text description

executions

Vec<ExecutionMsg>

Messages to be executed when participating in the campaign

admin

String

The admin address with the right to edit the settings for the campaign

creator

String

Wallet address where the campaign was created

created_at

Timestamp

Campaign creation time

RewardConfig

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    RewardConfig {}
}

Response

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
pub struct RewardConfigResponse {
    pub participation_reward_denom: Denom,
    pub participation_reward_amount: Uint128,
    pub referral_reward_token: String,
    pub referral_reward_amounts: Vec<Uint128>,
}

Key

Type

Description

participation_reward_denom

Denom

Participation reward denom

participation_reward_amount

Uint128

Participation reward amount

referral_reward_token

String

Referral reward token address

referral_reward_amount

Vec<Uint128>

Referral reward scheme

CampaignState

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    CampaignState {}
}

Response

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
pub struct CampaignStateResponse {
    pub actor_count: u64,
    pub participation_count: u64,
    pub cumulative_participation_reward_amount: Uint128,
    pub cumulative_referral_reward_amount: Uint128,
    pub locked_balances: Vec<(Denom, Uint128)>,
    pub balances: Vec<(Denom, Uint128)>,
    pub is_active: bool,
    pub is_pending: bool,
}R

Key

Type

Description

actor_count

u64

Participant count

participation_count

u64

Participation count

cumulative_participation_reward_amount

Uint128

Cumulative participation reward sum

cumulative_referral_reward_amount

Uint128

Cumulative shared referral sum

locked_balances

Vec<(Denom, Uint128)>

Amount that cannot be withdrawn due to unrecoverable rewards, etc.

balances

Vec<(Denom, Uint128)>

Contract balance deposited with normal addRewardPool message

is_active

bool

Active state

is_pending

bool

Whether on standby

*Standby = never active

ShareUrl

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    ShareUrl {
        address: String,
    }
}

Key

Type

Description

address

String

Wallet address of actor

Response

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
pub struct ShareUrlResponse {
    pub address: String,
    pub compressed: String,
    pub url: String,
}

Key

Type

Description

address

String

Wallet address

compressed

String

Compressed user address

url

Uint128

Share url

GetAddressFromReferrer

QueryMsg to get the original wallet address if not Referrer::Address

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    GetAddressFromReferrer {
        referrer: Referrer,
    }
}

Key

Type

Description

referrer

Referrer

Referrer

Response

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
pub struct GetAddressFromReferrerResponse {
    pub address: String,
}

Key

Type

Description

address

String

Wallet address of User

ReferralRewardLimitAmount

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    ReferralRewardLimitAmount {
        address: String,
    },
}

Key

Type

Description

address

String

Wallet address of User

Response

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
pub struct ReferralRewardLimitAmount {
    pub address: String,
    pub limit_amount: Uint128,
    pub base_limit_amount: Uint128,
    pub actor_limit_amount: Uint128,
}

Key

Type

Description

address

String

Wallet address

limit_amount

Uint128

Applied limit

base_limit_amount

Uint128

Minimum limit

actor_limit_amount

Uint128

Original limit

Actor

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    Actor {
        address: String,
    }
}

Key

Type

Description

address

String

Wallet address of actor

Response

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
pub struct ActorResponse {
    pub address: String,
    pub referrer_address: Option<String>,
    pub participation_reward_amount: Uint128,
    pub referral_reward_amount: Uint128,
    pub cumulative_participation_reward_amount: Uint128,
    pub cumulative_referral_reward_amount: Uint128,    
    pub participation_count: u64,
    pub referral_count: u64,
    pub last_participated_at: Timestamp,
}

Key

Type

Description

address

String

Wallet address of actor

referrer_address*

String

Wallet address of Referrer

participation_reward_amount

Uint128

Amount of recoverable rewards received by participating

referral_reward_amount

Uint128

Amount of recoverable rewards received through referrals

cumulative_participation_reward_amount

Uint128

Cumulative Participation Rewards

cumulative_referral_reward_amount

Uint128

Cumulative Referral Rewards

participation_count

u64

Participation count

referral_count

u64

Number of referrals

last_participated_at

Timestamp

Last participation time

Actors

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    Actors {
        start_after: Option<String>,
        limit: Option<u32>,
        order_by: Option<OrderBy>,
    }
}

Key

Type

Description

start_after*

String

Wallet address to start query at

limit*

u32

Maximum number of query entries

order_by*

OrderBy

Order to make query

Response

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
pub struct ActorsResponse {
    pub actors: Vec<ActorResponse>,
}

Key

Type

Description

actors

Vec<ActorResponse>

List of actor

Deposit

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    Deposit {
        address: String,
    },
}

Key

Type

Description

address

String

Wallet address of deposit

Response

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct Deposit {
    pub owner: Addr,
    pub deposit_amount: Uint128,
    pub locked_amounts: Vec<(Uint128, u64)>,
}

Key

Type

Description

owner

String

Wallet address of campaign owner

deposit_amount

Uint128

Deposit amount

locked_amounts

Vec<(Uint128, u64)>

Quantity that cannot be withdrawn due to campaign participation

(0: amount, 1: unlock_height)

Last updated