MovePosition Simple
Overview
The moveposition_simple::strategy
module implements a lending strategy for the MovePosition protocol. It manages lending positions using packets (serialized tickets) for position validation and state management.
Terminology
Packet
A signed binary packet containing a serialized ticket that authorizes the deposit. The packet is verified using Hocket and must contain valid ticket data
Strategy Module
Structs
MovePositionStrategy
Core strategy struct storing vault and authorization references.
Witness
Internal witness type for strategy creation.
Events
StrategyCreated: Event emitted when a new strategy is created.
Error Codes
EINVALID_AMOUNT
: Invalid amount specifiedEINSUFFICIENT_BALANCE
: Insufficient balance to perform the operationEVAULT_MISMATCH
: Invalid vault specifiedEWITHDRAWAL_ACCOUNT_MISMATCH
: Invalid withdrawal account specifiedECANNOT_EXCEED_DEBT
: Cannot exceed the strategy debt
Public Functions
create<CoinType>(account: &signer, vault: Object<Vault>, debt_limit: u64)
: Creates a new instance of the strategy for the specified vault. Only callable by governance account.tend_coin<CoinType>(account: &signer, strategy: Object<BaseStrategy>, packet: vector<u8>)
: Deposits idle coins into the MovePosition market.
Internal Functions
borrow_strategy(strategy: Object<BaseStrategy>): &MovePositionStrategy
: Returns a reference to the strategy data.deposit_internal<CoinType>(strategy: &MovePositionStrategy, packet: vector<u8>, coin: Coin<CoinType>): FungibleAsset
: Internal function for Coin deposits.prepare_withdrawal_internal(account: &signer, strategy: Object<BaseStrategy>, amount: u64): FungibleAsset
: Internal function for preparing withdrawals. Withdraws and returns strategy shares from the signers account.get_collateral_for_shares<CoinType>(strategy_ref: &MovePositionStrategy, amount: u64): u64
: Calculates collateral value for given amount of shares. Retrieves the collateral balance and total shares to calculate the collateral value for a given amount using the function below:
Last updated