Global Configuration

Overview

The global_config module handles access control for vaults and strategies.

satay is a friend of global_config, and can access its friend-only functions.

Global Config

The GlobalConfig struct stores information about the dao_admin and governor accounts.

struct GlobalConfig has key {
    dao_admin_address: address,
    governance_address: address,
    new_dao_admin_address: address,
    new_governance_address: address,
}

The initialize function is called by satay::initialize and creates the GlobalConfig object with @satay as dao_admin_address and new_governance_address. The function asserts that signer::address_of(satay_admin) == @satay.

public(friend) fun initialize(satay_admin: &signer)

The governance_address account - the governor - has the ability to call initialize_vault, initialize_strategy, and set_governance on the global_config module. On the satay module, the governor can call new_vault, update_vault_fee, and approve_strategy. Additionally, the governor has access to all of the functions of the vault_manager, strategist, and the keeper detailed later.

The dao_admin_address account - the dao_admin - has the ability to withdraw CoinType from satay::dao_storage::Storage<CoinType> storage and update the dao_admin_address.

Vault Config

The VaultConfig struct stores information about the vault_manager of Vault<BaseCoin>

struct VaultConfig<phantom BaseCoin> has key {    
    vault_manager_address: address,    
    new_vault_manager_address: address
}

The initialize_vault<BaseCoin> function is called by satay::new_vault<BaseCoin> to create the VaultConfig<BaseCoin> resource, which can only be called by the governor.

public(friend) fun initialize_vault<BaseCoin>(governance: &signer)

The vault_manager can call set_vault_manager function on the global_config module, as well as base_strategy:update_debt_ratio, base_strategy::update_credit_threshold, and base_strategy::force_harvest_trigger_once. Additionally, the vault_manager has access to all of the functions of the strategist and keeper.

StrategyConfig

The StrategyConfig struct stores information about the strategist and keeper for StrategyType on Vault<BaseCoin>. The BaseCoin type is required as multiple vaults with a different BaseCoin may utilize the same strategy.

struct StrategyConfig<phantom StrategyType, BaseCoin phantom> has key {
    strategist_address: address,
    keeper_address: address,
    new_strategist_address: address,
    new_keeper_address: address,
}

The initialize_strategy<StrategyType, BaseCoin> function is called by satay::approve_strategy<StrategyType, BaseCoin> to create the StrategyConfig<StrategyType, BaseCoin> resource, and can only be called by the governor.

public(friend) fun initialize_strategy<StrategyType: drop, BaseCoin>(
    governance: &signer
)

The strategist can call set_strategist on the global_config module, as well as base_strategy::update_max_report_delay. Additionally, the strategies has access to all of the functions of the keeper.

The keeper function can call the set_keeper function on the global_config module, as well as harvest and tend on strategies.

Assertions

assert_dao_admin passes if the signer is dao_admin, aborts otherwise. Called by dao_storage::withdraw.

public fun assert_dao_admin(dao_admin: &signer)

assert_governance passes if the signer is the governor, aborts otherwise.

public fun assert_governance(governance: &signer)

assert_vault_manager passes if the signer is the governor or vault_manager of the Vault for BaseCoin, aborts otherwise.

public fun assert_vault_manager<BaseCoin>(vault_manager: &signer)

assert_strategist passes if the signer is the governor, vault_manager, or strategist, aborts otherwise.

public fun assert_strategist<StrategyType: drop, BaseCoin>(strategist: &signer)

assert_keeper passes if the signer is the governor, vault_manager, strategist, or keeper, aborts otherwise.

public fun assert_keeper<StrategyType: drop, BaseCoin>(keeper: &signer)

Last updated