Mars Protocol
Search…
🏧
Protocol Rewards Collector
The Protocol Rewards Collector contract receives and distributes protocol fees.

Links

Config

Key
Type
Description
owner
CanonicalAddr
Contract owner
address_provider_address
CanonicalAddr
Address provider returns addresses for all protocol contracts
safety_fund_fee_share
Decimal
Percentage of fees that are sent to the safety fund
treasury_fee_share
Decimal
Percentage of fees that are sent to the treasury
astroport_factory_address
CanonicalAddr
Astroport factory contract address
astroport_max_spread
StdDecimal
Astroport max spread

InstantiateMsg

Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct InstantiateMsg {
3
pub config: CreateOrUpdateConfig
4
}
Copied!
1
{
2
"config": {
3
"owner": "terra...",
4
"address_provider_address": "terra",
5
"safety_fund_fee_share": 0.01,
6
"treasury_fee_share": 0.01,
7
"astroport_factory_address": "terra...",
8
"astroport_max_spread": 0.01
9
}
10
}
Copied!

CreateOrUpdateConfig

1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct CreateOrUpdateConfig {
3
pub owner: Option<String>,
4
pub address_provider_address: Option<String>,
5
pub safety_fund_fee_share: Option<Decimal>,
6
pub treasury_fee_share: Option<Decimal>,
7
pub astroport_factory_address: Option<String>,
8
pub astroport_max_spread: Option<StdDecimal>
9
}
Copied!
Key
Type
Description
owner*
String
Contract owner
address_provider_address*
String
Address provider returns addresses for all protocol contracts
safety_fund_fee_share*
Decimal
Percentage of fees that are sent to the safety fund
treasury_fee_share*
Decimal
Percentage of fees that are sent to the treasury
astroport_factory_address*
String
Astroport factory contract address
astroport_max_spread*
StdDecimal
Astroport max spread
* = optional

ExecuteMsg

UpdateConfig

Update contract config.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum ExecuteMsg {
4
UpdateConfig {
5
config: CreateOrUpdateConfig
6
}
7
}
Copied!
1
{
2
"update_config": {
3
"config": {
4
"owner": "terra...",
5
"address_provider_address": "terra",
6
"safety_fund_fee_share": 0.01,
7
"treasury_fee_share": 0.01,
8
"astroport_factory_address": "terra...",
9
"astroport_max_spread": 0.01
10
}
11
}
12
}
Copied!

UpdateAssetConfig

Update asset config.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum ExecuteMsg {
4
UpdateAssetConfig {
5
asset: Asset,
6
enabled: bool
7
}
8
}
Copied!
1
{
2
"update_asset_config": {
3
"asset": {},
4
"enabled": true
5
}
6
}
Copied!
Key
Type
Description
asset
String
Asset address
enabled
Bool
Enabled status

WithdrawFromRedBank

Withdraw maTokens from the red bank.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum ExecuteMsg {
4
WithdrawFromRedBank {
5
asset: Asset,
6
amount: Option<Uint128>
7
}
8
}
Copied!
1
{
2
"withdraw_from_red_bank": {
3
"asset": {},
4
"amount": 100000
5
}
6
}
Copied!
Key
Type
Description
asset
String
Asset address
amount*
Uint128
Amount to withdraw
* = optional

DistributeProtocolRewards

Distribute the accrued protocol income to the safety fund, treasury, and staking contracts, according to the split set in config. Callable by any address.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum ExecuteMsg {
4
DistributeProtocolRewards {
5
asset: Asset,
6
amount: Option<Uint128>
7
}
8
}
Copied!
1
{
2
"distribute_protocol_rewards": {
3
"asset": {},
4
"amount": 100000
5
}
6
}
Copied!
Key
Type
Description
asset
String
Asset market fees to distribute
amount*
Uint128
Amount to distribute to protocol contracts, defaults to contract balance if not specified
* = optional

SwapAssetToUusd

Swap any asset on the contract to uusd.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum ExecuteMsg {
4
SwapAssetToUusd {
5
offer_asset_info: AssetInfo,
6
amount: Otional<Uint128>
7
}
8
}
Copied!
1
{
2
"swap_asset_to_uusd": {
3
"offer_asset_info": "terra...",
4
"amount": 100000
5
}
6
}
Copied!
Key
Type
Description
offer_asset_info
String
Offer asset being swapped for uusd
amount*
Uint128
Amount being swapped
* = optional

ExecuteCosmosMsg

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

QueryMsg

Config

Get config parameters.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
Config {}
5
}
Copied!
1
{
2
"config": {}
3
}
Copied!

AssetConfig

Get asset config parameters.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
AssetConfig {
5
asset: Asset
6
}
7
}
Copied!
1
{
2
"asset_config": {
3
"asset": {}
4
}
5
}
Copied!
Key
Type
Description
asset
String
Asset