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
Rust JSON
Copy #[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 >,
}
Copy {
"title" : "..." ,
"description" : "..." ,
"url" : "..." ,
"parameter_key" : "..." ,
"participation_reward_denom" : {
"native" : ".." ,
"token" : "..." ,
} ,
"participation_reward_amount" :[ 1000 ]
"referral_reward_amounts" :[ 200 , 100 ]
}
Query parameter key to contain referral information
participation_reward_denom
Participation reward denom
participation_reward_amount
Participation reward quantity
ExecuteMsg
UpdateCampaignInfo
Updates the configuration for the Campaign information (title, url, description)
Rust JSON
Copy #[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 >,
}
}
Copy {
"update_campaign_info" : {
"title" : "..."
"description" : "..." ,
"url" : "https://...:" ,
"parameter_key" : "..." ,
"deposit_amount" : 100 ,
"deposit_lock_period" : 7 ,
"qualifier" : "terra1..." ,
"qualification_description" : "this is.." ,
"executions" : [ ] ,
"admin" : "terra1..."
}
}
Query parameter key to contain referral information
The amount of deposit required to participate in the campaign
The period from participate in the campaign until withdraw
The qualifier contract address used for validation in the campaign
qualification_description
Campaign participation conditions text description
Messages to be executed when participating in the campaign
The admin address with the right to edit the settings for the campaign
* = optional
UpdateRewardConfig
One can configure the participation and referral rewards scheme
Rust JSON
Copy #[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 >>,
}
}
Copy {
"update_reward_config" : {
"participation_reward_amount" : 1000 ,
"referral_reward_amounts" : [ 50 , 30 ]
}
}
participation_reward_amount*
Participation reward amount
* = optional
UpdateActivation
..
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum ExecuteMsg {
UpdateActivation {
active : bool ,
}
}
Copy {
"update_activation" : {
"active" : true
}
}
Campaign activation change
SetNoQulification
Set when there is no Qualification Contract
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum ExecuteMsg {
SetNoQualification {},
}
Copy {
"set_no_qualification" : {}
}
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.
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum ExecuteMsg {
AddRewardPool {
participation_reward_amount : Uint128 ,
referral_reward_amount : Uint128 ,
}
}
Copy {
"add_reward_pool" : {
"participation_reward_amount" : 1000 ,
"referral_reward_amounts" : 200
}
}
participation_reward_amount
Participation reward amount
RemoveRewardPool
A message that subtracts the added reward with the AddRewardPool message. A fee of 10% is applied when removing
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum ExecuteMsg {
RemoveRewardPool {
denom : Denom ,
amount : Option < Uint128 >,
},
}
Copy {
"remove_reward_pool" : {
"denom" : {
"native" : ".." ,
"token" : "..." ,
} ,
"amount" : 100
}
}
The denomination of the token requesting withdrawal
The withdrawal amount (default = [withdrawable_balance])
* = optional
RemoveIrregularRewardPool
Used when withdrawing deposit errors
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum ExecuteMsg {
RemoveIrregularRewardPool {
denom : Denom ,
},
}
Copy {
"remove_irregular_reward_pool" : {
"denom" : {
"native" : ".." ,
"token" : "..." ,
}
}
}
Destination address of withdrawing request
ClaimParticipationReward
When Users claim their participation reward
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum ExecuteMsg {
ClaimParticipationReward {},
}
Copy {
"claim_participation_reward" : {}
}
ClaimReferralReward
When Users claim their referral reward
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum ExecuteMsg {
ClaimReferralReward {}
}
Copy {
"claim_referral_reward" : {}
}
Participate
Participation Message
Rust JSON
Copy #[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 ),
}
Copy {
"participate" : {
"actor" : "terra1..."
"referrer" : {
"address" : "terra1..." ,
"compressed" : "..." ,
} ,
}
}
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.
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum ExecuteMsg {
Deposit {},
}
Withdraw
Withdrawal (only unlocked amount)
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum ExecuteMsg {
Withdraw {
amount : Uint128 ,
},
}
Copy {
"withdraw" : {
"amount" : 100
}
}
Receive Hooks
Deposit
Message used to deposit when using CW20 tokens as deposit
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum Cw20HookMsg {
Deposit {}
}
QueryMsg
CampaignConfig
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum QueryMsg {
CampaignConfig {}
}
Copy {
"campaign_config" : {}
}
Response
Rust JSON
Copy #[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 ,
}
Copy {
"config_response" : {
"governance" : "terra1..." ,
"campaign_manager" : "terra1" ,
"title" : "test" ,
"description" : "descripton" ,
"url" : "https://event.valkyrieprotocol.io" ,
"parameter_key" : "ref" ,
"deposit_denom" : {
"native" : ".." ,
"token" : "..." ,
} ,
"deposit_amount" : 100 ,
"deposit_lock_period" : 7 ,
"qualifier" : 10 ,
"qualification_description" : "This is..." ,
"executions" : [ "terra1..." ] ,
"admin" : "terra1...." ,
"creator" : "terra1...." ,
"created_at" : 231234512 ,
}
}
Contract address of governance
Contract address of campaign-manager
Query parameter key to contain referral information
Deposit required to participate in the campaign denom
The amount of amount required to participate in the campaign
The period from participate in the campaign until withdraw
The qualifier contract address used for validation in the campaign
qualification_description
Campaign participation conditions text description
Messages to be executed when participating in the campaign
The admin address with the right to edit the settings for the campaign
Wallet address where the campaign was created
RewardConfig
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum QueryMsg {
RewardConfig {}
}
Copy {
"reward_config" : {}
}
Response
Rust JSON
Copy #[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 >,
}
Copy {
"reward_config_response" : {
"participation_reward_denom" : {
"native" : ".." ,
"token" : "..." ,
} ,
"participation_reward_amount" : 1000 ,
"referral_reward_token" : "terra1...."
"referral_reward_amounts" : [ 100 , 50 ]
}
}
participation_reward_denom
Participation reward denom
participation_reward_amount
Participation reward amount
Referral reward token address
CampaignState
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum QueryMsg {
CampaignState {}
}
Copy {
"campaign_state" : {}
}
Response
Rust JSON
Copy #[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
Copy {
"campaign_state_response" : {
"actor_count" : 48 ,
"participation_count" : 100 ,
"cumulative_participation_reward_amount" : 10000 ,
"cumulative_referral_reward_amount" : 10000 ,
"locked_balances" : [(ust , 1000 ) , ( VKR , 100 )] ,
"balances" : [(ust , 1000 ) , ( VKR , 100 )] ,
"is_active" : "yes" ,
"is_pending" : "no"
}
}
cumulative_participation_reward_amount
Cumulative participation reward sum
cumulative_referral_reward_amount
Cumulative shared referral sum
Amount that cannot be withdrawn due to unrecoverable rewards, etc.
Contract balance deposited with normal addRewardPool message
Whether on standby
*Standby = never active
ShareUrl
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum QueryMsg {
ShareUrl {
address : String ,
}
}
Copy {
"share_url" : {
"address" : "terra1..."
}
}
Response
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , PartialEq , JsonSchema )]
pub struct ShareUrlResponse {
pub address : String ,
pub compressed : String ,
pub url : String ,
}
Copy {
"share_url_response" : {
"address" : "terra1..." ,
"compressed" : "...." ,
"url" : "https://..." ,
}
}
GetAddressFromReferrer
QueryMsg to get the original wallet address if not Referrer::Address
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum QueryMsg {
GetAddressFromReferrer {
referrer : Referrer ,
}
}
Copy {
"get_address_from_referrer" : {
"referrer" : {
"address" : "terra1..." ,
"compressed" : "..." ,
}
}
}
Response
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , PartialEq , JsonSchema )]
pub struct GetAddressFromReferrerResponse {
pub address : String ,
}
Copy {
"get_address_from_referrer_response" : {
"address" : "terra1..."
}
}
ReferralRewardLimitAmount
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum QueryMsg {
ReferralRewardLimitAmount {
address : String ,
},
}
Copy {
"referral_reward_limit_amount" : {
"address" : "terra1..."
}
}
Response
Rust JSON
Copy #[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 ,
}
Copy {
"referral_reward_limit_amount_response" : {
"address" : "terra1..." ,
"limit_amount" : 100 ,
"base_limit_amount" : 100 ,
"actor_limit_amount" : 1000 ,
}
}
Actor
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum QueryMsg {
Actor {
address : String ,
}
}
Copy {
"actor" : {
"address" : "terra1..."
}
}
Response
Rust JSON
Copy #[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 ,
}
Copy {
"actor_response" : {
"address" : "terra1..." ,
"referrer_address" : "terra1..." ,
"participation_reward_amount" : 74 ,
"referral_reward_amount" : 100 ,
"cumulative_participation_reward_amount" : 10000 ,
"cumulative_referral_reward_amount" : 10000 ,
"participation_count" : 7 ,
"referral_count" : 5 ,
"last_participated_at" : "" ,
}
}
Wallet address of Referrer
participation_reward_amount
Amount of recoverable rewards received by participating
Amount of recoverable rewards received through referrals
cumulative_participation_reward_amount
Cumulative Participation Rewards
cumulative_referral_reward_amount
Cumulative Referral Rewards
Actors
Rust JSON
Copy #[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 >,
}
}
Copy {
"actors" : {
"start_after" : {} ,
"limit" : 20 ,
"order_by" : "dec"
}
}
Wallet address to start query at
Maximum number of query entries
Response
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , PartialEq , JsonSchema )]
pub struct ActorsResponse {
pub actors : Vec < ActorResponse >,
}
Copy {
"actors" : [{
"address" : "terra1..." ,
"referrer_address" : "terra1..." ,
"participation_reward_amount" : 74 ,
"referral_reward_amount" : 100 ,
"cumulative_participation_reward_amount" : 10000 ,
"cumulative_referral_reward_amount" : 10000 ,
"participation_count" : 7 ,
"referral_count" : 5 ,
"last_participated_at" : "" ,
} ...
]
}
Deposit
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum QueryMsg {
Deposit {
address : String ,
},
}
Copy {
"deposit" : {
"address" : "terra1..."
}
}
Wallet address of deposit
Response
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
pub struct Deposit {
pub owner : Addr ,
pub deposit_amount : Uint128 ,
pub locked_amounts : Vec <( Uint128 , u64 )>,
}
Copy {
"deposit" : {
"owner" : "terra1..." ,
"deposit_amount" : 100 ,
"locked_amounts" : [ 100 , 12340 ]
}
}
Wallet address of campaign owner
Quantity that cannot be withdrawn due to campaign participation
(0: amount, 1: unlock_height)