Comment on page
SuperformFactory
SuperformFactory
is used for adding vaults to Superform.The factory defines the logic for three actions
- 1.Adding
Forms
: Forms are effectively yield adapters to support different types of opportunities on Superform.ERC4626Form
is an adapter that supports standard ERC4626 vaults. Forms that are developed in the future can only be added by theProtocolAdmin
role. - 2.Creating
Superforms
: Anybody can permissionlessly create aSuperform
by adding vaults toForms.
- 3.Emergency Action: This exists as a circuit break, allowing
EmergencyAdmin
to pause deposits/withdrawals and BroadcastRegistry to send that message across chains.
A
Superform
is defined by a vault address, the Form which it is added to, and the EVM chain ID it is on. This function allows the
ProtocolAdmin
to add a Form
implementation to Superform
for a specified formId
. function addFormImplementation(
address formImplementation_,
uint32 formImplementationId_,
) public override onlyProtocolAdmin
Name | Description |
---|---|
formImplementation_ | address of the implementation contract |
formBeaconId_ | uint32 id to set the Form implementation to |
This function creates the
Superform
and returns the resulting superformId
and Superform address
.function createSuperform(
uint32 formImplementationId_,
address vault_
) external override returns (uint256 superformId_, address superform_)
Name | Description |
---|---|
formImplementationId_ | uint32 id of the Form implementation |
vault_ | address of the vault |
This function allows the
EmergencyAdmin
to pause any deposits or withdrawals into any Form
implementation if an exploit is suspected. If put into a paused state, no deposits can go through, and all withdrawals are sent to an EmergencyWithdrawal
queue where withdrawals must be fulfilled by the EmergencyAdmin
keeper which performs off-chain validations. function changeFormImplementationPauseStatus(
uint32 formImplementationId_,
uint256 paused_,
bytes memory extraData_
) external payable override onlyEmergencyAdmin
Name | Description |
---|---|
formImplementationId_ | uint32 id of the Form implementation |
paused_ | bool that is True if the Form is paused, halting deposits and only allowing emergency withdrawals |
extraData_ | bytes extradata if broadcasting of the message is required |
This function returns the number of
Forms
that have been added to the specific chain. function getFormCount()
external view override returns (
uint256 forms_)
This function returns the number of
Superforms
that have been created on the specific chain. function getSuperformCount()
external view override returns (
uint256 superforms_)
This function returns the
address
of a given Form
implementation id. function getFormImplementation(uint32 formImplementationId_)
external view override returns (address)
Name | Description |
---|---|
formImplementationId_ | uint32 id of the Form implementation |
This function returns if a Form id has been paused, triggering emergency-only withdrawal mode.
function isFormImplementationPaused(uint32 formImplementationId_)
external view override returns (bool)
Name | Description |
---|---|
formImplementationId_ | uint32 id of the Form implementation |
This function decodes any
superFormId
, regardless of the chain it was created on, into the Superform address, form id it was added to, and the chain id it was added on. function getSuperform(uint256 superformId)
external pure override returns (
address superform_,
uint32 formBeaconId_,
uint64 chainId_)
Name | Description |
---|---|
superformId | uint256 superformId |
This function returns the
superformIds
and associated addresses given a vault address, if there are any. There can be multiple superformIds
for any given vault because vaults can be added to multiple Forms. function getAllSuperformsFromVault(address vault_)
external view override returns (
uint256[] memory superformIds_,
address[] memory superforms_
)
Name | Description |
---|---|
vault_ | Address of the vault to check |
This function returns all the
superformIds
and addresses that have been created on that particular chain. function getAllSuperforms()
external view override returns (
uint256[] memory superformIds_,
address[] memory superforms_
)
Last modified 18d ago