Skip to main content

AlchemistStrategyClassifier

Description​

This contract defines risk classes and their caps, and maps each strategy to a risk level.

Note: This is currently not used, but will be referenced by the AlchemistAllocator in it's allocate/deallocate calls to resrict how much can be allocated/deallocated to/from a specific strategy to adhere to DAO defined boundaries around risk management.

Risk Class​

A struct that defines a risk class

globalCap
  • Description - Max combined allocation across all strategies of this risk class.
  • Type - uint256
  • Used By
    • getGlobalCap()
localCap
  • Description - Max combined allocation across all strategies of this risk class.
  • Type - uint256
  • Used By
    • getIndividualCap()

Variables​

admin
  • Description - The current admin. Only this address can modify caps and assignments.
  • Type - address
  • Updated By
  • Read By
    • admin()
pendingAdmin
  • Description - The first step in a two-step process of setting a new administrator. The pendingAdmin is set by the current admin, then the pendingAdmin must accept the responsibility to lock in the change of admin.
  • Type - address
  • Updated By
  • Read By
    • pendingAdmin()
riskClasses
strategyRiskLevel

Functions​

Admin Actions​

Functions that can only be called by the current admin. Attempts to call using other addresses will revert with a message of PD.

transferOwnership(address _newAdmin)
  • Description - Sets the pending admin. First part of a two-step process to change the admin. The second step is the pendingAdmin accepting the role by calling acceptOwnership.
    • @param _newAdmin - Address of the new pendingAdmin.
  • Visibility Specifier - external
  • State Mutability Specifier - nonpayable
  • Reverts - none
  • Emits - none
acceptOwnership()
  • Description - Can only be called by the current pendingAdmin. Used to accept the admin role.
  • Visibility Specifier - external
  • State Mutability Specifier - nonpayable
  • Reverts - none
  • Emits
setRiskClass(uint8 classId, uint256 globalCap, uint256 localCap)
  • Description - Sets caps for a given risk class.
    • @param classId - The risk class ID.
    • @param globalCap - Max combined allocation for all strategies in this class.
    • @param localCap - Max allocation for a single strategy in this class.
  • Visibility Specifier - external
  • State Mutability Specifier - nonpayable
  • Reverts - none
  • Emits
assignStrategyRiskLevel(uint256 strategyId, uint8 riskLevel)
  • Description - Assigns a risk level to a strategy.
    • @param strategyId - The strategy ID.
    • @param riskLevel - Risk level to assign.
  • Visibility Specifier - external
  • State Mutability Specifier - nonpayable
  • Reverts - none
  • Emits - none

Reading State​

Reads derived, calculated, or internal state.

getIndividualCap(uint256 strategyId)
  • Description - Returns the local cap for the strategy’s assigned risk class. The local cap is the max allocation for a single strategy in the risk class.
    • @param strategyId - The strategy identifier.
  • Visibility Specifier - external
  • State Mutability Specifier - view
getGlobalCap(uint8 riskLevel)
  • Description - Returns the global cap for the specified risk class. The global cap is the max combined allocations for strategies in a risk calss.
    • @param riskLevel - Risk class ID.
  • Visibility Specifier - external
  • State Mutability Specifier - view
getStrategyRiskLevel(uint256 strategyId)
  • Description - Returns the risk level currently assigned to a strategy.
    • @param strategyId - The strategy identifier.
  • Visibility Specifier - external
  • State Mutability Specifier - view

Events​

  • AdminChanged(address indexed admin) - emitted when admin is updated via acceptOwnership.
  • RiskClassModified(uint8 indexed classId, uint256 globalCap, uint256 localCap) - emitted when a risk class’s caps are updated.