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
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct InstantiateMsg {
pub config: CreateOrUpdateConfig
}
{
"config": {
"owner": "terra...",
"address_provider_address": "terra",
"safety_fund_fee_share": 0.01,
"treasury_fee_share": 0.01,
"astroport_factory_address": "terra...",
"astroport_max_spread": 0.01
}
}

CreateOrUpdateConfig

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct CreateOrUpdateConfig {
pub owner: Option<String>,
pub address_provider_address: Option<String>,
pub safety_fund_fee_share: Option<Decimal>,
pub treasury_fee_share: Option<Decimal>,
pub astroport_factory_address: Option<String>,
pub astroport_max_spread: Option<StdDecimal>
}
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
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
UpdateConfig {
config: CreateOrUpdateConfig
}
}
{
"update_config": {
"config": {
"owner": "terra...",
"address_provider_address": "terra",
"safety_fund_fee_share": 0.01,
"treasury_fee_share": 0.01,
"astroport_factory_address": "terra...",
"astroport_max_spread": 0.01
}
}
}

UpdateAssetConfig

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

WithdrawFromRedBank

Withdraw maTokens from the red bank.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
WithdrawFromRedBank {
asset: Asset,
amount: Option<Uint128>
}
}
{
"withdraw_from_red_bank": {
"asset": {},
"amount": 100000
}
}
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
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
DistributeProtocolRewards {
asset: Asset,
amount: Option<Uint128>
}
}
{
"distribute_protocol_rewards": {
"asset": {},
"amount": 100000
}
}
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
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
SwapAssetToUusd {
offer_asset_info: AssetInfo,
amount: Otional<Uint128>
}
}
{
"swap_asset_to_uusd": {
"offer_asset_info": "terra...",
"amount": 100000
}
}
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
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
ExecuteCosmosMsg(CosmosMsg)
}
{
"execute_cosmos_msg": {}
}

QueryMsg

Config

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

AssetConfig

Get asset config parameters.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
AssetConfig {
asset: Asset
}
}
{
"asset_config": {
"asset": {}
}
}
Key
Type
Description
asset
String
Asset
Copy link
On this page
Links
Config
InstantiateMsg
CreateOrUpdateConfig
ExecuteMsg
UpdateConfig
UpdateAssetConfig
WithdrawFromRedBank
DistributeProtocolRewards
SwapAssetToUusd
ExecuteCosmosMsg
QueryMsg
Config
AssetConfig