Satay Module
Overview
The satay::satay
module acts as the entry point for users to interact with vaults. The satay
module is a friend
module of satay::vault
, and thus can access its mutating functions.
The ManagerAccount
struct holds a manager's VaultInfo
structs in a table keyed by vault_id
, and controls the vault_id
of the next vault.
The VaultInfo
struct holds a vault's VaultCapability
, providing access to mutating functions. The field is an Option
such that the VaultCapability
can be lent to strategies for operations.
Manager Functions
initialize
creates a new ManagerAccount
for the signer
. Access is restricted to only the Satay DAO address.
new_vault
creates a new Vault
for BaseCoin
under the signer's ManagerAccount
. Initializes management_fee
and performance_fee
.
update_vault_fee
sets vault.management_fee
and vault.performance_fee
for the vault referenced by (manager, vault_id)
.
User Functions
deposit
allows user
to deposit amount
of BaseCoin
into the Vault
referenced by the (manager_addr, vault_id)
pair.
withdraw
allows user
to withdraw amount
of BaseCoin
into the Vault
referenced by the (manager_addr, vault_id)
pair.
Strategy Functions
approve_strategy
creates a VaultStrategy<StrategyType>
resource on to operate on the Vault
referenced by the (manager, vault_id)
pair. debt_ratio
indicates the percentage of BaseCoin
the StrategyType
can allocate at any given time.
Returns the VaultCapability
and VaultCapLock
for StrategyType
to perform operations on the Vault
referenced by the (manager_addr, vault_id)
pair. _witness
guarantees that the caller is the module that defines StrategyType
. VaultStrategy<StrategyType>
must exist in the vault. Paired with a subsequent unlock_vault
.
Unlocks the Vault
referenced by the (manager_addr, vault_id)
pair. Must be preceded by a call to lock_vault
.
update_strategy_debt_ratio
updates the the strategy.debt_ratio
value of VaultStrategy<StrategyType>
for the Vault
referenced by (manager_addr, vault_id)
.
update_strategy_max_report
updates the the strategy.max_report_delay
value of VaultStrategy<StrategyType>
for the Vault
referenced by (manager_addr, vault_id)
.
update_strategy_credit_threshold
updates the the strategy.credit_threshold
value of VaultStrategy<StrategyType>
for the Vault
referenced by (manager_addr, vault_id)
.
set_strategy_force_harvest_trigger_once
sets the strategy.force_harvest_once
to true
on VaultStrategy<StrategyType>
for the Vault
referenced by (manager_addr, vault_id)
.
Last updated