Mars Protocol
Search…
πŸ’°
Incentives
The Incentives contract manages MARS incentives for maToken holders (depositors).

Links

Config

Key
Type
Description
owner
CanonicalAddr
Contract owner
address_provider_address
String
Address provider returns addresses for all protocol contracts

InstantiateMsg

Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct InstantiateMsg {
pub owner: String,
pub address_provider_address: String,
}
{
"owner": "terra...",
"address_provider_address": "...",
}
Key
Type
Description
owner
String
Contract owner
address_provider_address
String
Address provider returns addresses for all protocol contracts

ExecuteMsg

UpdateConfig

Updates contract config. Only callable by owner.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
Config {
owner: Option<String>,
address_provider_address: Option<String>
}
}
{
"config": {
"owner": "terra...",
"address_provider_address": "terra..."
}
}
Key
Type
Description
owner*
String
Owner contract address
address_provider_address*
String
Address Provider address
* = optional

SetAssetIncentive

Sets emission per second for an asset to holders of its maToken.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
SetAssetIncentive {
ma_token_address: String,
emission_per_second: Uint128,
}
}
{
"set_asset_incentive": {
"ma_token_address": "terra...",
"emission_per_second":
}
}
Key
Type
Description
ma_token_address
String
maToken address associated with the incentives
emission_per_second
Uint128
How many MARS will be assigned per second to be distributed among all maToken holders

BalanceChange

Handle balance change updating user and asset rewards. Sent from an external contract, triggered on user balance changes. Will return an empty response if no incentive is applied for the asset.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
BalanceChange {
user_address: Addr,
user_balance_before: Uint128,
total_supply_before: Uint128
}
}
{
"balance_change": {
"user_address": "terra...",
"user_balance_before":,
"total_supply_before":
}
}
Key
Type
Description
user_address
String
User address. Address is trusted as it must be validated by the maToken contract before calling this method
user_balance_before
Uint128
User maToken balance up to the instant before the change
total_supply_before
Uint128
Total maToken supply up to the instant before the change

ClaimRewards

Claim rewards. MARS rewards accrued by the user will be staked into xMARS before being sent.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
ClaimRewards {}
}
{
"claim_rewards": {}
}

ExecuteCosmosMsg

Execute Cosmos msg (only callable by owner).
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
ExecuteCosmosMsg(CosmosMsg)
}
{
"execute_cosmos_msg": {}
}

QueryMsg

Config

Query contract config.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
Config {}
}
{
"config": {}
}

AssetIncentive

Query info about asset incentive for a given maToken.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
AssetIncentive {
ma_token_address: String
}
}
{
"asset_incentive": {
"ma_token_address": "terra..."
}
}
Key
Type
Description
ma_token_address
String
maToken contract address

UserUnclaimedRewards

Query user current unclaimed rewards.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
UserUnclaimedRewards {
user_address: String
}
}
{
"user_unclaimed_rewards": {
"user_address": "terra..."
}
}
Key
Type
Description
user_address
String
User address to query unclaimed rewards

Structs

AssetIncentive

Incentive Metadata for a given incentive.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct AssetIncentive {
pub emission_per_second: Uint128,
pub index: Decimal,
pub last_updated: u64,
}
Key
Type
Description
emission_per_second
Uint128
How much MARS per second is emitted to be then distributed to all maToken holders
index
Decimal
Total MARS assigned for distribution since the start of the incentive
last_updated
u64
Last time (in seconds) index was updated

AssetIncentiveResponse

Response to AssetIncentive query.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct AssetIncentiveResponse {
pub asset_incentive: Option<AssetIncentive>,
}
Copy link
On this page
Links
Config
InstantiateMsg
ExecuteMsg
UpdateConfig
SetAssetIncentive
BalanceChange
ClaimRewards
ExecuteCosmosMsg
QueryMsg
Config
AssetIncentive
UserUnclaimedRewards
Structs
AssetIncentive
AssetIncentiveResponse