AlchemistAllocator
Description​
AlchemistCurator is the governance and configuration contract for MYT vaults. It allows admins and operators to register or remove strategy adapters for a given MYT and to adjust their absolute and relative caps. In short, it defines which strategies exist within the MYT and how much capital each can hold.
Note: AlchemistCurator inherits from PermissionedProxy, which provides it's access control system for operator roles, and the deny-list used to restrict certain calls. The admin role is set using the same pending/admin admin system as the Alchemist and is handled in this child contract. For details on the operator role and logic, see PermissionedProxy.
Variables​
adapterToMYT
- Description - A mapping that associates each MYT strategy adapter address with the specific MYT vault address it is a part of. This is how the curator knows which vault to target when adding, removing, or adjusting caps for a given strategy.
- Type -
mapping(address => address) - Used By
- Updated By
setStrategy(address adapter, address myt, bool remove)- cannot use the zero address for the adapter or myt
- Read By
adapterToMYT(address)
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()
- Notified By - none
Functions​
Admin Actions​
transferAdminOwnerShip(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 acceptAdmin.
@param _newAdmin- The address proposed to become the new admin.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
- With
"PD"ifmsg.senderis not the current admin.
- With
- Emits - none
acceptAdminOwnership()
- Description - Finalizes an admin ownership transfer by assigning
pendingAdminas the new active admin. Afterwards thependingAdminis reset to the zero address. TODO - this is currently only callable by admin, but should probably be callable by pendingAdmin and be a user action - Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
- With
"PD"ifmsg.senderis not the current admin.
- With
- Emits
decreaseAbsoluteCap(address adapter, uint256 amount)
- Description - Delegates to the internal
_decreaseAbsoluteCap(adapter, id, amount)to immediately lowers the absolute cap for a given strategy on its MYT vault. The absolute cap is the maximum quanitity of underlying assets that may be allocated to the strategy.@param adapter- The strategy adapter address.@param amount- The amount denominated in underlying assets to decrease the absolute cap by.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
AbsoluteCapNotDecreasing()- if the new cap is higher than the previous. Propgated from the MorphoV2 vault call.
- Emits
submitDecreaseAbsoluteCap(address adapter, uint256 amount)
- Description - Queues up a decrease of a strategy’s absolute cap on the MYT vault via the vault’s timelock, to be executed at a later date.
@param adapter- The strategy adapter address.@param amount- The amount denominated in underlying asset to decrease the absolute cap by.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
AbsoluteCapNotDecreasing()- if the new cap is higher than the previous. Propgated from the MorphoV2 vault call.- Emits
decreaseRelativeCap(address adapter, uint256 amount)
- Description - Immediately decreases the relative cap for a given strategy on its MYT vault. The relative cap represents the strategy’s maximum allowed proportion of the vault’s total assets.
Gets the ID from the adapter address, and calls the internal_decreaseRelativeCap(adapter, id, amount)to immediately decrease the cap.@param adapter- The strategy adapter address.@param amount- The new percentage, expressed as an 18 decimal scaled number, (1e18 = 100%) to set as the relative cap. Must be lower than the previous relative cap.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
RelativeCapNotDecreasing()- if the new cap is higher than the previous. Propgated from the MorphoV2 vault call.
- Emits
submitDecreaseRelativeCap(address adapter, uint256 amount)
- Description - Queues a decrease of the strategy’s relative cap on the MYT vault through the vault’s timelock mechanism, to be executed at a later time.
Calls the internal_submitDecreaseRelativeCap(adapter, id, amount)to queue the decrease.@param adapter- The strategy adapter address.@param amount- The new percentage to set the relative cap to, expressed as a uint256 scaled by 1e18. (1e18 = 100%) Must be lower than the previous relative cap.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
RelativeCapNotDecreasing()- if the new cap is higher than the previous. Propgated from the MorphoV2 vault call.
- Emits
increaseAbsoluteCap(address adapter, uint256 amount)
- Description - Delegates to the internal
_increaseAbsoluteCap(adapter, id, amount)to raise the absolute cap for a given strategy on its MYT vault.
The absolute cap is the maximum quantity of underlying assets that may be allocated to the strategy.@param adapter- The strategy adapter address.@param amount- The amount denominated in underlying asset units to increase the absolute cap by.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
AbsoluteCapNotIncreasing()- if the new cap is lower than the previous. Propagated from the MorphoV2 vault call.
- Emits
increaseRelativeCap(address adapter, uint256 amount)
- Description - Immediately raises the relative cap for a given strategy on its MYT vault.
The relative cap defines the maximum percentage of the vault’s total assets that the strategy can hold.
Gets the ID from the adapter address and calls the internal_increaseRelativeCap(adapter, id, amount)to raise the cap.@param adapter- The strategy adapter address.@param amount- The new percentage, expressed as an 18-decimal scaled number (1e18 = 100%), to set as the relative cap. Must be higher than the previous relative cap.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
RelativeCapNotIncreasing()- if the new cap is lower than the previous. Propagated from the MorphoV2 vault call.
- Emits
submitIncreaseAbsoluteCap(address adapter, uint256 amount)
- Description - Queues up an increase of a strategy’s absolute cap on the MYT vault via the vault’s timelock, to be executed at a later date.
Calls the internal_submitIncreaseAbsoluteCap(adapter, id, amount)to queue the change.@param adapter- The strategy adapter address.@param amount- The amount denominated in underlying asset units to increase the absolute cap by.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
AbsoluteCapNotIncreasing()- if the new cap is lower than the previous. Propagated from the MorphoV2 vault call.
- Emits
submitIncreaseRelativeCap(address adapter, uint256 amount)
- Description - Queues an increase of the strategy’s relative cap on the MYT vault through the vault’s timelock mechanism, to be executed at a later time.
Calls the internal_submitIncreaseRelativeCap(adapter, id, amount)to enqueue the update.@param adapter- The strategy adapter address.@param amount- The new percentage to set the relative cap to, expressed as a uint256 scaled by 1e18 (1e18 = 100%). Must be higher than the previous relative cap.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
RelativeCapNotIncreasing()- if the new cap is lower than the previous. Propagated from the MorphoV2 vault call.
- Emits
Operator Actions​
Functions guarded by the onlyOperator modifier.
setStrategy(address adapter, address myt)
- Description - Registers a MYT strategy adapter with the specified MYT vault.
First runs address validity checks, then offloads to the internal_setStrategy(adapter, myt, false)to register the MYT strategy with the vault as an active strategy.@param adapter- The address of the MYT strategy adapter to register.@param myt- The address of the MYT vault that the adapter belongs to.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
- With
"INVALID_ADDRESS"if eitheradapterormytis the zero address.
- With
- Emits
StrategySet(address adapter, address myt)- emitted in the internal _setStrategy() call.
removeStrategy(address adapter, address myt)
- Description - Deregisters a MYT strategy adapter from the specified MYT vault.
First runs address validity checkts, then offloads to the internal_setStrategy(adapter, myt, true)to deregister the MYT strategy from the vault as an active strategy.@param adapter- The address of the MYT strategy adapter to remove.@param myt- The address of the MYT vault that the adapter is currently linked to.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
- With
"INVALID_ADDRESS"if eitheradapterormytis the zero address.
- With
- Emits
StrategySet(address adapter, address myt)- emitted in the internal _setStrategy() call.
submitSetStrategy(address adapter, address myt)
- Description - Queues the addition of a MYT strategy adapter to a specific MYT vault via the vault’s timelock mechanism to be executed at a later time.
Validates that passedadapterandmytare valid addresses, delegates to the internal_submitSetStrategy(adapter, myt), which encodesIVaultV2.addAdapter(adapter)and callsvault.submit(data), which enqueues the strategy to be added after the timelock period.@param adapter- The address of the strategy adapter to be registered.@param myt- The MYT vault address to add the adapter to.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
- With
"INVALID_ADDRESS"ifadapter == address(0)ormyt == address(0).
- With
- Emits
SubmitSetStrategy(address adapter, address myt)- from the internal _submitSetStrategy call
Internal Operations​
_setStrategy(address adapter, address myt, bool remove)
- Description - Internal helper function used to add or remove a MYT strategy adapter from the specified MYT vault. Called by both
setStrategy(address, myt)andremoveStrategy(address, myt).
First updates theadapterToMYTmapping to associate the adapter with the provided MYT vault. Then retrieves the vault reference using the internal_vault(adapter)function, and finally calls eithervault.removeAdapter(adapter)to deregister the adapter, orvault.addAdapter(adapter)to register it.@param adapter- The address of the MYT strategy adapter being added or removed.@param myt- The address of the MYT vault that the adapter is associated with.@param remove- True/false flag indicating whether to remove or add the adapter.
- Visibility Specifier - internal
- State Mutability Specifier - nonpayable
- Reverts - none
- Emits
_submitSetStrategy(address adapter, address myt)
- Description - Internal helper that calls the MorphoV2 Vault submit() function, which enqueues the adding of an adapter to the target MYT vault to the vault's timelock queue to be executed at a later time.
@param adapter- The address of the strategy adapter to be added.@param myt- The address of the MYT vault to add the strategy to.
- Visibility Specifier - internal
- State Mutability Specifier - nonpayable
- Reverts - none
- Emits
_decreaseAbsoluteCap(address adapter, bytes id, uint256 amount)
- Description - Internal helper that immediately calls decreases a strategy’s absolute cap on the vault.
@param adapter- The strategy adapter address.@param id- The encoded MYT strategy ID.@param amount- The amount denominated in underlying units to decrease the absolute cap by.
- Visibility Specifier - internal
- State Mutability Specifier - nonpayable
- Reverts
AbsoluteCapNotDecreasing()- if the new cap is higher than the previous. Propgated from the MorphoV2 vault call.
- Emits
_submitDecreaseAbsoluteCap(address adapter, bytes id, uint256 amount)
- Description - Internal helper that enqueues a cap decrease on the MYT vault by encoding
IVaultV2.decreaseAbsoluteCap(id, amount)and delegating to the internal_vaultSubmit(data).@param adapter- The strategy adapter address (used to resolve its vault).@param id- The encoded MYT strategy ID as bytes.@param amount- The amount denominated in underlying units to decrease the absolute cap by.
- Visibility Specifier - internal
- State Mutability Specifier - nonpayable
- Reverts
AbsoluteCapNotDecreasing()- if the new cap is higher than the previous. Propgated from the MorphoV2 vault call.
- Emits
_decreaseRelativeCap(address adapter, bytes id, uint256 amount)
- Description - Internal helper that calls the
vault.decreaseRelativeCap(id, amount)to immediately decrease a strategy’s relative cap. The relative cap is the maximum percentage of total assets the strategy can make up.@param adapter- The strategy adapter address@param id- The encoded MYT strategy ID@param amount- The new percentage of maximum assets that the strategy can make up. Scaled by 1e18. (1e18 = 100%)
- Visibility Specifier - internal
- State Mutability Specifier - nonpayable
- Reverts
RelativeCapNotDecreasing()- if the new cap is higher than the previous. Propgated from the MorphoV2 vault call.
- Emits
_submitDecreaseRelativeCap(address adapter, bytes id, uint256 amount)
- Description - Internal helper that enqueues a cap decrease on the MYT vault by encoding
IVaultV2.decreaseRelativeCap(id, amount)and delegating to the internal_vaultSubmit(data).@param adapter- Strategy adapter address (used to resolve its vault).@param id- Strategy ID blob (IMYTStrategy.getIdData()).@param amount- Amount (underlying or relative value basis) to decrease the relative cap by.
- Visibility Specifier - internal
- State Mutability Specifier - nonpayable
- Reverts
RelativeCapNotDecreasing()- if the new cap is higher than the previous. Propgated from the MorphoV2 vault call.
- Emits
_increaseAbsoluteCap(address adapter, bytes id, uint256 amount)
- Description - Internal helper that immediately calls
vault.increaseAbsoluteCap(id, amount)to raise a strategy’s absolute cap. The absolute cap is the maximum quantity of underlying assets that may be allocated to the strategy.@param adapter- The strategy adapter address.@param id- The encoded MYT strategy ID.@param amount- The amount denominated in underlying asset units to increase the absolute cap by.
- Visibility Specifier - internal
- State Mutability Specifier - nonpayable
- Reverts
AbsoluteCapNotIncreasing()- if the new cap is lower than the previous. Propagated from the MorphoV2 vault call.
- Emits
_increaseRelativeCap(address adapter, bytes id, uint256 amount)
- Description - Internal helper that immediately calls
vault.increaseRelativeCap(id, amount)to raise a strategy’s relative cap. The relative cap defines the maximum percentage of the vault’s total assets that the strategy can hold.@param adapter- The strategy adapter address.@param id- The encoded MYT strategy ID.@param amount- The new percentage, expressed as an 18-decimal scaled number (1e18 = 100%), to set as the relative cap. Must be higher than the previous relative cap.
- Visibility Specifier - internal
- State Mutability Specifier - nonpayable
- Reverts
RelativeCapNotIncreasing()- if the new cap is lower than the previous. Propagated from the MorphoV2 vault call.
- Emits
_submitIncreaseAbsoluteCap(address adapter, bytes id, uint256 amount)
- Description - Internal helper that enqueues a cap increase on the MYT vault by encoding
IVaultV2.increaseAbsoluteCap(id, amount)and delegating to the internal_vaultSubmit(data).@param adapter- The strategy adapter address.@param id- The encoded MYT strategy ID.@param amount- The amount denominated in underlying asset units to increase the absolute cap by.
- Visibility Specifier - internal
- State Mutability Specifier - nonpayable
- Reverts
AbsoluteCapNotIncreasing()- if the new cap is lower than the previous. Propagated from the MorphoV2 vault call.
- Emits
_vaultSubmit(address adapter, bytes data)
- Description - Internal helper that resolves the MYT vault associated with the provided adapter and calls its
submit(bytes)function to queue a governance action via the vault’s timelock.@param adapter- The strategy adapter address, used to look up its corresponding MYT vault.@param data- The ABI-encoded function to be submitted to the vault.
- Visibility Specifier - internal
- State Mutability Specifier - nonpayable
- Reverts
- With
"INVALID_ADDRESS"if the adapter has no registered MYT vault in theadapterToMYTmapping.
- With
- Emits - none
_vault(address adapter)
- Description - Internal helper that retrieves the MYT vault contract associated with a given strategy adapter from the
adapterToMYTmapping.@param adapter- The strategy adapter address.
- Visibility Specifier - internal
- State Mutability Specifier - nonpayable
- Reverts
"INVALID_ADDRESS"- if there is no MYT vault registered for the specified adapter inadapterToMYT.
- Emits - none
Events​
-
IncreaseAbsoluteCap(address indexed strategy, uint256 amount, bytes indexed id)- emitted when the absolute cap for a strategy has been increased. The absolute cap represents the maximum quantity of underlying assets that may be allocated to the strategy. -
SubmitIncreaseAbsoluteCap(address indexed strategy, uint256 amount, bytes indexed id)- emitted when an increase to the strategy’s absolute cap has been queued via the vault’s timelock, to be executed later. -
IncreaseRelativeCap(address indexed strategy, uint256 amount, bytes indexed id)- emitted when the relative cap for a strategy has been increased. The relative cap defines the maximum percentage of the vault’s total assets that the strategy can hold, scaled by 1e18 (1e18 = 100%). -
SubmitIncreaseRelativeCap(address indexed strategy, uint256 amount, bytes indexed id)- emitted when an increase to the strategy’s relative cap has been queued via the vault’s timelock, to be executed later. -
OperatorChanged(address indexed operator)- emitted when the contract’s operator address is updated. -
AdminChanged(address indexed admin)- emitted when the contract’s admin address is updated. -
DecreaseRelativeCap(address indexed strategy, uint256 amount, bytes indexed id)- emitted when the relative cap for a strategy has been decreased. The relative cap defines the maximum percentage of the vault’s total assets that the strategy can hold, scaled by 1e18 (1e18 = 100%). -
SubmitDecreaseRelativeCap(address indexed strategy, uint256 amount, bytes indexed id)- emitted when a decrease to the strategy’s relative cap has been queued via the vault’s timelock, to be executed later. -
StrategySet(address indexed strategy, address indexed myt)- emitted when a strategy adapter has been added to or removed from the specified MYT vault. -
SubmitSetStrategy(address indexed strategy, address indexed myt)- emitted when a strategy adapter has been queued for addition to a MYT vault via the vault’s timelock mechanism. -
DecreaseAbsoluteCap(address indexed strategy, uint256 amount, bytes indexed id)- emitted when the absolute cap for a strategy has been decreased. The absolute cap represents the maximum quantity of underlying assets that may be allocated to the strategy. -
SubmitDecreaseAbsoluteCap(address indexed strategy, uint256 amount, bytes indexed id)- emitted when a decrease to the strategy’s absolute cap has been queued via the vault’s timelock, to be executed later.