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;

claimAvailableDeposits

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

function claimAvailableDeposits(
 address user_, 
 uint256 superformId_
 ) external;

claimAvailableRedeem

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

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

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;

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;

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);

getSyncWithdrawTxDataPayload

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

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

syncWithdrawTxDataPayloadCounter

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

function syncWithdrawTxDataPayloadCounter() external view returns (uint256);

Last updated