🌅
Sunrise / Gluon Docs
  • Home
    • 👋Sunrise
  • 📜Learn
    • 🌆Sunrise
      • Proof of Liquidity
      • Fee Abstraction
      • Data Availability
      • Gauges Voting
      • Liquidity Pool
      • Liquidity Incentive
      • Swap
      • TokenConverter
      • Fee
      • Lockup Account
      • Bribes
    • 💴$RISE
      • Allocations
    • 🏦Gluon
    • 💴$GLU
    • 🎓Thesis
      • App chain thesis
      • Interoperability
  • 🛠️Build
    • 🚀Quick Start
    • Client
    • L2 Blockchains
      • Rollkit
        • Sunrise Data
        • Rollkit L2 Chain
      • OP Stack
        • Sunrise Data
        • OP Stack L2 Chain
    • Validators
      • Proof of Data Availability
      • Self Delegation
  • 🏗️Run a Sunrise Node
    • Networks
    • Types of Nodes
      • Consensus
        • Full Consensus Node
        • Validator Node (Genesis)
        • Validator Node
        • Setup Cosmovisor
      • IBC Relayers
    • Resources
      • Upgrade
      • Environment
  • 🏗️Run a Gluon Node
    • Networks
    • Node
      • Validator Node
  • 🔗Links
    • GitHub
    • Discord
    • X (Twitter)
    • Medium
    • dev.to
  • 📓Deprecated (UnUniFi)
    • IBC Channels
    • Security
    • CosmWasm
      • Tutorial
      • Create Project
    • IYA Strategy
      • Interface
      • External CosmWasm chain with IBCHooks
      • External EVM chain with Axelar
    • Frontend
      • Cosmos Client TS
    • Resources
    • Setup ununifid
    • ununifid
      • Basic Commands
      • Module Commands
        • wasm
    • Build a Node
    • Build a Validator Node
    • Setup Cosmovisor
    • Mainnet Upgrades
    • IBC Relayer
Powered by GitBook
On this page
  • ExecuteMsg
  • ExecuteMsg::Stake
  • ExecuteMsg::Unstake
  • ExecuteMsg::ExecuteEpoch
  • QueryMsg
  • QueryMsg::Bonded
  • Unbonding
  • QueryMsg::Fee
  • Source codes
  1. Deprecated (UnUniFi)
  2. IYA Strategy

Interface

Strategy contracts satisfies the specific interface described below.

ExecuteMsg

#[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 {}

ExecuteMsg::Stake

On ExecuteMsg::Stake, staking amount is configured on info.funds.

ExecuteMsg::Unstake

On ExecuteMsg::Unstake, unstaking amount is put as Uint128 variable on UnstakeMsg.

ExecuteMsg::ExecuteEpoch

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.

QueryMsg

#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(BondedResp)]
    Bonded { addr: String },
    #[returns(UnbondingResp)]
    Unbonding { addr: String },
    #[returns(FeeResp)]
    Fee {},
}

QueryMsg::Bonded

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.

Unbonding

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

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.

Source codes

PreviousIYA StrategyNextExternal CosmWasm chain with IBCHooks

Last updated 1 year ago

📓
https://github.com/UnUniFi/contracts/blob/main/packages/strategy/src/v0/msgs.rs