Specialized Strategy Modules (Legacy)
Overview
A strategy must define a set of functions and structs to operate on a vault. It interacts with satay::base_strategy and Structured Prodocts.
Identifier
StrategyType is used to identify a strategy and verify its authenticity in function calls via the witnessing pattern.
struct StrategyType has drop {}Initialize
Initialize the Vault referenced by vault_id with debt_ratio by calling base_strategy::initialize function with the StrategyType identifier.
public fun initialize(
manager: &signer,
vault_id: u64,
debt_ratio: u64
)Harvest
Calls structured_product::reinvest_returns and deposits StrategyCoin to vault. Rebalances the debt position given the strategy's balance and debt_ratio. Only called if harvest_trigger returns true.
public entry fun harvest(
manager: &signer,
vault_id: u64
)Harvest Trigger
Returns a boolean regarding whether or not the vault manager should call harvest for StrategyType.
public entry fun harvest_trigger(
manager: &signer,
vault_id: u64
): boolTend
Calls structured_product::reinvest_returns and deposits farmed StrategyCoin to the Vault
public entry fun harvest(
manager: &signer,
vault_id: u64
)Withdraw for User
Called by user when there is not enough BaseCoin in the vault, and the user wants to liquidate the respective amount of StrategyCoin for a given share_amount of VaultCoin<BaseCoin>.
public entry fun withdraw_for_user(
user: &signer,
manager_addr: address,
vault_id: u64,
share_amount: u64
)Admin Functions
Implement all of the Admin Functions of the Base Strategy Module using the specialized strategy Identifier.
Last updated