Canopy
  • About Canopy
    • What is Canopy?
  • Canopy's Four Layers
    • Application Layer
    • Rewards Layer
    • Strategy Layer
      • Single Sided Liquidity
      • Simple Lending Strategy
        • Echelon Simple Lend
        • MovePosition Lend
        • Layerbank Lend
      • Vault Rebalancing Strategies
        • Ascend Strategy
    • Protocol Layer
      • Echelon Integration
      • MovePosition Integration
      • Layerbank Integration
  • Audits
    • Audit Reports
  • Tutorials
    • Cornucopia Campaign
    • Depositing on Canopy
    • Withdrawing from Cornucopia and Earning Rewards
    • Withdrawing from Cornucopia
    • MoveDrop Stake to Earn Rewards
  • Operations
    • Terms of Service
    • Canopy Smart Contracts
    • Fee Structure
      • FAQ
Powered by GitBook
On this page
  • Overview
  • Constants
  • Public Functions
  • Market Operations
  • Account Information
  • Reward Operations
  1. Canopy's Four Layers
  2. Protocol Layer

Echelon Integration

Overview

The echelon_block::echelon_block module contains the block implementation for Echelon. Modules in the blocks package are modules that contain convenience functions that interface with an underlying protocol(e.g. echelon, moveposition, etc). These block functions are used by concrete strategy implementations to interact with an underlying protocol, instead of interacting with it directly.

Constants

  • SUPPLY_MARKET_TYPE: u64 = 200 - Type identifier for supply market operations

  • BORROW_MARKET_TYPE: u64 = 201 - Type identifier for borrow market operations

Public Functions

Market Operations

  • supply<CoinType>(account: &signer, market: Object<Market>, coin: Coin<CoinType>): Supplies coins to the specified market.

  • supply_fa(account: &signer, market: Object<Market>, asset: FungibleAsset): Supplies fungible assets to the specified market.

  • borrow<CoinType>(account: &signer, market: Object<Market>, amount: u64): Coin<CoinType>: Borrows coins from the specified market.

  • withdraw<CoinType>(account: &signer, market: Object<Market>, shares: u64): Coin<CoinType>: Withdraws coins from the specified market based on shares.

  • withdraw_fa(account: &signer, market: Object<Market>, shares: u64): FungibleAsset: Withdraws fungible assets from the specified market based on shares.

Account Information

  • account_coins(account: address, market: Object<Market>): u64: Returns the number of coins an account has in a market.

  • account_shares(account: address, market: Object<Market>): u64: Returns the number of shares an account has in a market.

  • amount_borrowable<CoinType>(account: address, market: Object<Market>): u64: Returns the amount of coins an account can borrow from a market.

  • amount_withdrawable<CoinType>(account: address, market: Object<Market>): u64: Returns the amount of coins an account can withdraw from a market.

  • coins_to_shares(market: Object<Market>, coins: u64): u64: Converts coin amount to share amount for a given market.

Reward Operations

  • get_supply_reward<CoinType>(account: address, market: address): u64: Returns the claimable supply reward amount for a specific coin type.

  • get_supply_reward_fa(account: address, market: address, metadata: Object<Metadata>): u64: Returns the claimable supply reward amount for a fungible asset.

  • get_borrow_reward<CoinType>(account: address, market: address): u64: Returns the claimable borrow reward amount for a specific coin type.

  • get_borrow_reward_fa(account: address, market: address, metadata: Object<Metadata>): u64: Returns the claimable borrow reward amount for a fungible asset.

  • claim_supply_reward<CoinType>(account: &signer, market: address): Coin<CoinType>: Claims supply rewards for a specific coin type.

  • claim_supply_reward_fa(account: &signer, metadata: Object<Metadata>, market: address): FungibleAsset: Claims supply rewards for a fungible asset.

PreviousProtocol LayerNextMovePosition Integration

Last updated 2 months ago