Strategy contracts satisfies the specific interface described below.
#[cw_serde]
pub enum ExecuteMsg {
Stake(StakeMsg),
Unstake(UnstakeMsg),
ExecuteEpoch(ExecuteEpochMsg),
}
#[cw_serde]
pub struct StakeMsg {}
#[cw_serde]
pub struct UnstakeMsg {
pub amount: Uint128,
}
#[cw_serde]
pub struct ExecuteEpochMsg {}
On ExecuteMsg::Stake
, staking amount is configured on info.funds
.
On ExecuteMsg::Unstake
, unstaking amount is put as Uint128
variable on UnstakeMsg
.
On ExecuteMsg::ExecuteEpoch
, the strategy contract has to execute the periodical process of the strategy. For example, auto compounding.
This Msg is called by yieldaggregator
module periodically.
However, this Msg can be called by anyone (because this is not SudoMsg
), so the strategy contract must not implement logics that can be abused by malicious users.
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
#[returns(BondedResp)]
Bonded { addr: String },
#[returns(UnbondingResp)]
Unbonding { addr: String },
#[returns(FeeResp)]
Fee {},
}
QueryMsg::Bonded
needs following info for querying:
addr
: address of the Vault that deposit funds to the strategy.
This query returns the amount of bonded tokens of the address.
QueryMsg::Unbonding
needs following info for querying:
addr
: address of the Vault that deposit funds to the strategy.
This query returns the amount unbonding tokens of the address.
QueryMsg::Fee
needs no info for querying.
This query returns FeeResp
object that contains information of fees.
pub struct FeeResp {
pub deposit_fee_rate: Decimal,
pub withdraw_fee_rate: Decimal,
pub interest_fee_rate: Decimal,
}
Developers who developed strategy contracts have to implement this query properly, to show how much fees are charged on the strategy to users. Otherwise, the proposal for registering the strategy will be rejected.