AsyncStateRegistry

Overview

AsyncStateRegistry is a smart contract that extends BaseStateRegistry and is used to support two-step cross-chain actions (deposits & withdrawals) in Superform. Vaults implementing the ERC-7540, including Centrifuge, will use this state registry.

Core Concepts

Inheriting from BaseStateRegistry,this contract contains logic similar to CoreStateRegistry for sending and receiving payloads. The initial deposit request is handled by the CoreStateRegistry This state registry handles subsequent actions and has minting rights to mint superpositions corresponding to the ERC7540Form. This contract has a standard request configuration updated on each incoming deposit / redeem request. For example, suppose there are two transactions where the user requests to deposit to a vault, first with retain4626 and second without retain4626. In that case, the requested value gets minted to their address on the destination without the retain4626 flag when it is available to deposit.

updateRequestConfig

Updates the request configuration for a user and superform. It sets various parameters such as srcChainId,`requestId`, etc. This gets updated for every incoming request, and the latest request configuration is considered the final configuration for all the previously requested actions.

function updateRequestConfig(
    uint8 type_,
    uint64 srcChainId_,
    bool isDeposit_,
    uint256 requestId_,
    InitSingleVaultData memory data_
) external;
name
description

type_

The type_ of request. Represents if the action is same-chain (or) cross-chain

srcChainId_

The origin chain of the request

isDeposit_

Flag indicating if the request type is deposit / redeem

requestId_

The unique ID of the request

data_

Request specific data that comes from the form

claimAvailableDeposits

This function claims the deposits made available for the user to claim.

function claimAvailableDeposits(
   address user_,
   uint256 superformId_
 ) external;
name
description

user_

The address of the user whose deposits are made available to claim by the vault

superformId_

The superformId to claim deposits from

claimAvailableRedeem

This function redeems the shares that are available to redeem after requesting redemption.

function claimAvailableRedeem(
   address user_, 
   uint256 superformId_, 
   bytes memory updatedTxData_
) external;
name
description

user_

The address of the user whose redeem requests are made available to redeem

superformId_

The superformId to redeem from

updatedTxData_

The txData to bridge collateral post redeem

receiveSyncWithdrawTxDataPayload

This function is used to process the synchronous withdrawal requests of DEPOSIT_ASYNC form if it requires a txData update.

Superform allows users to specify only the withdrawal intent, like the final token and final destination chain and allows the processor to generate the txData on-demand to prevent slippage-related issues. This function is not invoked if the user provides the txData themselves.

function receiveSyncWithdrawTxDataPayload(
  uint64 srcChainId_,
  InitSingleVaultData calldata data_
) external;
name
description

srcChainId_

The chainId from which the cross-chain redeem call is invoked

data_

The cross-chain withdrawal data passed in from the ERC7540 Form.

processSyncWithdrawWithUpdatedTxData

This function helps the async state registry processor to complete payloads received via the receiveSyncWithdrawTxDataPayload with an updated txData.

function processSyncWithdrawWithUpdatedTxData(
  uint256 payloadId_,
  bytes calldata txData_
 ) external;
name
description

payloadId_

The unique identifier of the received sync withdraw payload

txData_

The txData to process user collateral after the redemption process.

getRequestConfig

It helps retrieve the latest request configuration of a user per performed.

function getRequestConfig(
 address user_,
 uint256 superformId_
) external view returns (RequestConfig memory requestConfig);
name
description

user_

The wallet address of the user

superformId_

The unique identifier of the superform to query its request config for

getSyncWithdrawTxDataPayload

It helps retrieve the withdraw tx data payload (for DEPOSIT_ASYNC 7540Form).

function getSyncWithdrawTxDataPayload(
  uint256 payloadId_
) external view returns (SyncWithdrawTxDataPayload memory syncWithdrawTxDataPayload_);
name
description

payloadId_

The unique identifier assigned to every payload upon its delivery.

syncWithdrawTxDataPayloadCounter

Returns the number of sync withdraw payloads received by the async state registry.

function syncWithdrawTxDataPayloadCounter() external view returns (uint256);

Last updated