CoreStateRegistry
Introduction
CoreStateRegistry
implements and extends BaseStateRegistry
and is used by core contracts to fulfill cross-chain deposits to all Forms and cross-chain withdrawals from vaults contained in ERC4626Form
.
Core Concepts
dispatchPayload
This function allows the core contracts to send messages (payloads) to state registries on other chains. The entire message is sent to the first ambId
in the index via _dispatchPayload
and for chains that support more than one AMB, the proof of the message is sent to the other ambIds
in the index via _dispatchProof
. The user must supply at least 1 + the Quorum (typically 1) required ambIds
.
receivePayload
This function allows state registries to receive messages (payloads) from AMB implementations on other chains. Depending on the size of the message, this is handled differently as either a full payload or a proof.
processPayload
This function allows any appropriately permissioned actor to process payloads on the state registry.
Access Control Modifiers
There are multiple gated functions in the CoreStateRegistry contract.
CORE_STATE_REGISTRY_UPDATER_ROLE
may update parameters within pre-defined ranges by the user on deposits and withdrawals inupdateDepositPayload
andupdateWithdrawPayload
CORE_STATE_REGISTRY_PROCESSOR_ROLE
may process payloads inprocessPayload
CORE_STATE_REGISTRY_RESCUER_ROLE
may propose the amount of tokens that can be rescued inproposeRescueFailedDeposits
CORE_STATE_REGISTRY_DISPUTER_ROLE
may, in addition to the user whose tokens were in question, dispute the amount of funds proposed to be rescued during the time window indisputeRescueFailedDeposits
At this time, both of these roles are executed by Superform infrastructure but will be removed as the protocol decentralizes.
Updating Deposits
On deposits, the amount of token being received on the destination chain can only be updated within a certain range. The range is determined by what the caller specified they intended to receive in submitting the Superform Request.
updateDepositPayload
Updates a payload once transactions are confirmed to finalize the amount of tokens received on the destination chain before processing the deposit.
Updating Withdrawals
Updates a payload that corresponds to a multi-vault withdrawal with liquidity data if the user didn't submit any liquidity data. This increases the chance of successful withdrawals and still maintains security validations on-chain to ensure the correct tokens are received back to the user.
updateWithdrawPayload
Rescuing payloads
There are 4 steps involved in rescuing funds from stuck payloads.
View all failed deposits for a given payload id
CoreStateRegistryRescuer
must propose the amount of tokens to be rescued for a user for a payload idThere is a set amount of time to dispute this number
If not disputed in that timeframe by user or
CoreStateRegistryDisputer
, anybody can rescue the payload, sending funds back to thedstRefundAddress
.
getFailedDeposits
Allows anyone to see which deposits in a payload have failed.
proposeRescueFailedDeposits
Allows RESCUER
to propose the amount of tokens that should be rescued for a given payloadId.
disputeRescueFailedDeposits
Allows the initial user and DISPUTER
to challenge the final receiving token amounts on failed deposits if within the challenge time window.
finalizeRescueFailedDeposits
Allows anyone to finalize the amount of tokens to be received after the challenge period is over.
Last updated