TimelockStateRegistry

Introduction

TimelockStateRegistry implements and extends BaseStateRegistry and is used by core contracts to support two step cross-chain withdrawals in Superform. Multiple vaults have implemented a two step withdrawal process, including Maple, Centrifuge, Notional and Umami.

BaseStateRegistry is an abstract contract that defines a foundation for implementing cross-chain processing and messaging mechanisms within Superform. StateRegistry contracts broadly store information that have been sent cross-chain and AMB Implementations move information cross-chain.

Core Concepts

Inheriting from BaseStateRegistry, this contract contains similar logic to CoreStateRegistry with adjusted methods to receive and finalize payloads.

receivePayload

This function receives payloads from ERC4626TimelockForm to process later, and is gated by the onlyForm role to ensure that only the Form can write to receive this.

function receivePayload(
    uint8 type_,
    address srcSender_,
    uint64 srcChainId_,
    uint256 lockedTill_,
    InitSingleVaultData memory data_
) external override onlyForm;
namedescription

type_

uint8 boolean. Informs if the withdraw call is cross-chain or not

srcSender_

address of the underlying beneficiary

srcChainId_

uint64 of the originating EVM chainId

lockedTill_

uint256 of the timestamp with the unlock time

data_

finalizePayload

For successful withdrawals payloads are finalized to ensure payloads aren't processed again.

function finalizePayload(
    uint256 timelockPayloadId_,
    bytes memory txData_,
    bytes memory ackExtraData_
) external payable returns onlyTimelockStateRegistryProcessor (bytes memory returnMessage);
namedescription

timeLockPayloadId_

unit256 payload id to finalize. Pertains only to the TwoStepsFormStateRegistry.

txData_

bytes transaction data to execute in withdrawing the payload.

ackExtraData_

bytes AMB message data to re-mint shares

getTimelockPayload

This function allows any user to translate payloadIds into TimeLockPayloads to see if there are Timelocked vaults associated with any request.

function getTimelockPayload(
    uint256 payloadId_) 
    external view returns (TimelockPayload memory timelockPayload_);

Last updated