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 usedRust
JSON
#[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>,
}
{
"title": "...",
"description": "...",
"url": "...",
"parameter_key": "...",
"participation_reward_denom": {
"native":"..",
"token":"...",
},
"participation_reward_amount":[1000]
"referral_reward_amounts":[200,100]
}
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 |
Updates the configuration for the Campaign information (title, url, description)
Rust
JSON
#[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>,
}
}
{
"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..."
}
}
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
One can configure the participation and referral rewards scheme
Rust
JSON
#[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>>,
}
}
{
"update_reward_config": {
"participation_reward_amount": 1000,
"referral_reward_amounts":[50,30]
}
}
Key | Type | Description |
participation_reward_amount* | Uint128 | Participation reward amount |
referral_reward_amount* | Vec<Uint128> | Referral reward scheme |
* = optional
..
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
UpdateActivation {
active: bool,
}
}
{
"update_activation": {
"active": true
}
}
Key | Type | Description |
active | bool | Campaign activation change |
Set when there is no Qualification Contract
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
SetNoQualification {},
}
{
"set_no_qualification": {}
}
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
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
AddRewardPool {
participation_reward_amount: Uint128,
referral_reward_amount: Uint128,
}
}
{
"add_reward_pool": {
"participation_reward_amount": 1000,
"referral_reward_amounts":200
}
}
Key | Type | Description |
participation_reward_amount | Uint128 | Participation reward amount |
referral_reward_amount | Uint128 | Referral reward amount |
A message that subtracts the added reward with the AddRewardPool message. A fee of 10% is applied when removing
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
RemoveRewardPool {
denom: Denom,
amount: Option<Uint128>,
},
}
{
"remove_reward_pool": {
"denom": {
"native":"..",
"token":"...",
},
"amount": 100
}
}
Key | Type | Description |
denom | Denom | The denomination of the token requesting withdrawal |
amount* | Uint128 | The withdrawal amount (default = [withdrawable_balance]) |
* = optional
Used when withdrawing deposit errors
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
RemoveIrregularRewardPool {
denom: Denom,
},
}
{
"remove_irregular_reward_pool": {
"denom": {
"native":"..",
"token":"...",
}
}
}
Key | Type | Description |
denom | Denom | Destination address of withdrawing request |
When Users claim their participation reward
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
ClaimParticipationReward {},
}
{
"claim_participation_reward": {}
}
When Users claim their referral reward
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
ClaimReferralReward {}
}
{
"claim_referral_reward": {}
}
Participation Message
Rust
JSON
#[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),
}
{
"participate": {
"actor":"terra1..."
"referrer": {
"address":"terra1...",
"compressed":"...",
},
}
}
Key | Type | Description |
actor | String | User wallet address |
referrer* | Referrer | Referrer's wallet address |
* = optional
When you deposit and participate in the tokens used to participate in the campaign, you are locked by lock_period.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
Deposit {},
}
{
"deposit": {}
}
Withdrawal (only unlocked amount)
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
Withdraw {
amount: Uint128,
},
}
{
"withdraw": {
"amount" : 100
}
}
Key | Type | Description |
amount | Uint128 | Withdrawal amount |
Message used to deposit when using CW20 tokens as deposit
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum Cw20HookMsg {
Deposit {}
}
{
"deposit": {}
}
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
CampaignConfig {}
}
{
"campaign_config": {}
}
Rust
JSON
#[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,
}
{
"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,
}
}
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 |
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
RewardConfig {}
}
{
"reward_config": {}
}
Rust
JSON
#[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>,
}
{
"reward_config_response": {
"participation_reward_denom":{
"native":"..",
"token":"...",
},
"participation_reward_amount":1000,
"referral_reward_token": "terra1...."
"referral_reward_amounts": [100,50]
}
}
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 |
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
CampaignState {}
}
{
"campaign_state": {}
}
Rust
JSON
#[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
{
"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"
}
}
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 |
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
ShareUrl {
address: String,
}
}
{
"share_url": {
"address" : "terra1..."
}
}
Key | Type | Description |
address | String | Wallet address of actor |
Rust
JSON
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
pub struct ShareUrlResponse {
pub address: String,
pub compressed: String,
pub url: String,
}
{
"share_url_response": {
"address":"terra1...",
"compressed":"....",
"url": "https://...",
}
}
Key | Type | Description |
address | String | Wallet address |
compressed | String | Compressed user address |
url | Uint128 | Share url |
QueryMsg to get the original wallet address if not Referrer::Address
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
GetAddressFromReferrer {
referrer: Referrer,
}
}
{
"get_address_from_referrer": {
"referrer" : {
"address":"terra1...",
"compressed":"...",
}
}
}