Echelon Block
Last updated
Last updated
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 to interact with an underlying protocol, instead of interacting with it directly.
SUPPLY_MARKET_TYPE: u64 = 200
- Type identifier for supply market operations
BORROW_MARKET_TYPE: u64 = 201
- Type identifier for borrow 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_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.
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.