Skip to main content
logo

incentives

Manage MARS incentives for depositors.

InstantiateMsg

Instantiates the Incentives contract.

json
incentives.rs
Copy

_5
{
_5
"owner": "...",
_5
"address_provider": "...",
_5
"mars_denom": "..."
_5
}

ParamsTypeDescription
ownerStringContract owner
address_providerStringAddress provider
mars_denomStringMars token denom

ExecuteMsg

set_asset_incentive

Set emission per second for an asset to its depositor at Red Bank.

json
incentives.rs
Copy

_8
{
_8
"set_asset_incentive": {
_8
"denom": "...",
_8
"emission_per_second": "123",
_8
"start_time": 123,
_8
"duration": 123
_8
}
_8
}

ParamsTypeDescription
denomStringAsset denom associated with the incentives
emission_per_secondOption<Uint128>How many MARS will be assigned per second to be distributed among all Red Bank depositors
start_timeOption<u64>Start time of the incentive (in seconds) since the UNIX epoch (00:00:00 on 1970-01-01 UTC)
durationOption<u64>How many seconds the incentives last

balance_change

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

json
incentives.rs
Copy

_8
{
_8
"balance_change": {
_8
"user_addr": "mars...",
_8
"denom": "...",
_8
"user_amount_scaled_before": 123,
_8
"total_amount_scaled_before": 123
_8
}
_8
}

ParamsTypeDescription
user_addrAddrUser address. Address is trusted as it must be validated by the Red Bank contract before calling this method
denomStringDenom of the asset of which deposited balance is changed
user_amount_scaled_beforeUint128The user's scaled collateral amount up to the instant before the change
total_amount_scaled_beforeUint128The market's total scaled collateral amount up to the instant before the change

claim_rewards

Claim rewards. MARS rewards accrued by the user will be staked before being sent.

json
incentives.rs
Copy

_3
{
_3
"claim_rewards": {}
_3
}

update_config

Update contract config (only callable by owner).

json
incentives.rs
Copy

_6
{
_6
"update_config": {
_6
"address_provider": "...",
_6
"mars_denom": "..."
_6
}
_6
}

ParamsTypeDescription
address_providerOption<String>Address provider
mars_denomOption<String>Mars token denom

update_owner

Manages admin role state.

json
address_provider.rs
Copy

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

QueryMsg

config

Get contract config.

json
incentives.rs
Copy

_3
{
_3
"config": {}
_3
}

ConfigResponse

json
incentives.rs
Copy

_6
{
_6
"owner": "...",
_6
"proposed_new_owner": "...",
_6
"address_provider": "...",
_6
"mars_denom": "...",
_6
}

ParamsTypeDescription
ownerOption<String>Contract owner
proposed_new_ownerOption<String>The contract's proposed owner
address_providerAddrAddress provider
mars_denomStringMars Token Denom

asset_incentive

Get info about asset incentive for a given denom.

json
incentives.rs
Copy

_5
{
_5
"asset_incentive": {
_5
"denom": "..."
_5
}
_5
}

ParamsTypeDescription
denomStringDenom of the asset

AssetIncentiveResponse

json
incentives.rs
Copy

_8
{
_8
"denom": "...",
_8
"emission_per_second": "123",
_8
"start_time": 123,
_8
"duration": 123,
_8
"index": "0.123",
_8
"last_updated": 123
_8
}

ParamsTypeDescription
denomStringAsset denom
emission_per_secondUint128How much MARS per second is emitted to be then distributed to all Red Bank depositors
start_timeu64Start time of the incentive (in seconds) since the UNIX epoch (00:00:00 on 1970-01-01 UTC)
durationu64How many seconds the incentives last
indexu64Total MARS assigned for distribution since the start of the incentive
last_updatedu64Last time (in seconds) index was updated

asset_incentives

Enumerate asset incentives with pagination

json
incentives.rs
Copy

_6
{
_6
"asset_incentives": {
_6
"start_after": "...",
_6
"limit": 5
_6
}
_6
}

ParamsTypeDescription
start_afterStringDenom of asset to start after
limitStringNumber of asset incentives to list

asset_incentives returns a vector of the AssetIncentiveResponse response struct defined above.

user_unclaimed_rewards

Get user current unclaimed rewards.

json
incentives.rs
Copy

_5
{
_5
"user_unclaimed_rewards": {
_5
"user": "mars..."
_5
}
_5
}

ParamsTypeDescription
userStringUser address

Returns Uint128