Skip to main content
logo

base

Chain-agnostic logics for the rewards collector contract.

InstantiateMsg

json
rewards_collector.rs
Copy

_10
{
_10
"owner": "...",
_10
"address_provider": "...",
_10
"safety_tax_rate": "1.27",
_10
"safety_fund_denom": "...",
_10
"fee_collector_denom": "...",
_10
"channel_id": "...",
_10
"timeout_seconds": 123,
_10
"slippage_tolerance": "0.01"
_10
}

ParamsTypeDescription
ownerTThe contract's owner
address_providerTAddress provider returns addresses for all protocol contracts
safety_tax_rateDecimalPercentage of fees that are sent to the safety fund
safety_fund_denomStringThe asset to which the safety fund share is converted
fee_collector_denomStringThe asset to which the fee collector share is converted
channel_idStringThe channel ID of the mars hub
timeout_secondsu64Number of seconds after which an IBC transfer is to be considered failed, if no acknowledgement is received
slippage_toleranceDecimalMaximum percentage of price movement (minimum amount you accept to receive during swap)

ExecuteMsg

update_owner

Manages admin role state.

json
address_provider.rs
Copy

_7
{
_7
"update_owner": {
_7
"propose_new_owner": {
_7
"proposed": "..."
_7
}
_7
}
_7
}

update_config

Updates contract config.

json
rewards_collector.rs
Copy

_13
{
_13
"update_config": {
_13
"new_cfg": {
_13
"address_provider": "...",
_13
"safety_tax_rate": "1.27",
_13
"safety_fund_denom": "...",
_13
"fee_collector_denom": "...",
_13
"channel_id": "...",
_13
"timeout_seconds": 123,
_13
"slippage_tolerance": "0.01"
_13
}
_13
}
_13
}

ParamsTypeDescription
new_cfgCreateOrUpdateConfigNew config parameters

CreateOrUpdateConfig

json
rewards_collector.rs
Copy

_9
{
_9
"address_provider": "...",
_9
"safety_tax_rate": "1.27",
_9
"safety_fund_denom": "...",
_9
"fee_collector_denom": "...",
_9
"channel_id": "...",
_9
"timeout_seconds": 123,
_9
"slippage_tolerance": "0.01"
_9
}

ParamsTypeDescription
address_providerOption<String>Address provider returns addresses for all protocol contracts
safety_tax_rateOption<Decimal>Percentage of fees that are sent to the safety fund
safety_fund_denomOption<String>The asset to which the safety fund share is converted
fee_collector_denomOption<String>The asset to which the fee collector share is converted
channel_idOption<String>The channel id of the Mars Hub
timeout_secondsOption<u64>Number of seconds after which an IBC transfer is to be considered failed, if no acknowledgement is received
slippage_toleranceOption<Decimal>Maximum percentage of price movement (minimum amount you accept to receive during swap)

set_route

Configure the route for swapping an asset. This is chain-specific, and can include parameters such as slippage tolerance and the routes for multi-step swaps.

json
rewards_collector.rs
Copy

_9
{
_9
"set_route": {
_9
"denom_in": "...",
_9
"denom_out": "...",
_9
"route": [
_9
// Route (chain-specific)
_9
]
_9
}
_9
}

ParamsTypeDescription
denom_inOption<String>Denom of the asset going in
denom_outOption<String>Denom of the asset going out
routeRouteRoute for swapping an assets. See OsmosisRoute for an example of a chain specific integration.

withdraw_from_red_bank

Withdraw maTokens from the Red Bank.

json
rewards_collector.rs
Copy

_6
{
_6
"withdraw_from_red_bank": {
_6
"denom": "...",
_6
"amount": "100000"
_6
}
_6
}

ParamsTypeDescription
denomStringDenom of the asset
amountOption<Uint128>Amount to withdraw

distribute_rewards

Distribute the accrued protocol income between the safety fund and the fee modules on Mars Hub, according to the split set in config. Callable by any address.

json
rewards_collector.rs
Copy

_6
{
_6
"distribute_rewards": {
_6
"denom": "...",
_6
"amount": "100000"
_6
}
_6
}

ParamsTypeDescription
denomStringDenom of the asset
amountOption<Uint128>Amount of rewards to distribute

swap_asset

Swap any asset on the contract.

json
rewards_collector.rs
Copy

_6
{
_6
"swap_asset": {
_6
"denom": "...",
_6
"amount": "100000"
_6
}
_6
}

ParamsTypeDescription
denomStringDenom of the asset
amountOption<Uint128>Amount of assets to swap

QueryMsg

config

Queries config parameters.

json
rewards_collector.rs
Copy

_3
{
_3
"config": {}
_3
}

route

Get routes for swapping an input denom into an output denom.

NOTE

The response type of this query is chain-specific.

json
rewards_collector.rs
Copy

_6
{
_6
"route": {
_6
"denom_in": "...",
_6
"denom_out": "..."
_6
}
_6
}

ParamsTypeDescription
denom_inStringDenom of the asset going in
denom_outStringDenom of the asset going out

routes

Enumerate all swap routes.

NOTE

The response type of this query is chain-specific.

json
rewards_collector.rs
Copy

_5
{
_5
"routes": {
_5
_5
}
_5
}

ParamsTypeDescription
start_afterOption<(String, String)>Denom of the asset going in
limitOption<u32>Denom of the asset going out