StateSyncer

Git Source

Inherits: IStateSyncer

Author: Zeropoint Labs.

SPDX-License-Identifier: Apache-2.0

base contract for stateSync functions

State Variables

superRegistry

is the super registry address

ISuperRegistry public immutable superRegistry;

ROUTER_TYPE

uint8 public immutable ROUTER_TYPE;

CHAIN_ID

uint64 public immutable CHAIN_ID;

txHistory

maps all transaction data routed through the smart contract.

mapping(uint256 transactionId => uint256 txInfo) public override txHistory;

Functions

onlyRouter

modifier onlyRouter();

onlyMinter

modifier onlyMinter(uint256 id) virtual;

onlyBatchMinter

modifier onlyBatchMinter(uint256[] memory ids) virtual;

onlyBurner

modifier onlyBurner() virtual;

onlyProtocolAdmin

modifier onlyProtocolAdmin();

constructor

constructor(address superRegistry_, uint8 routerType_);

Parameters

NameTypeDescription
superRegistry_addressthe superform registry contract
routerType_uint8the router type

updateTxHistory

saves the message being sent together with the associated id formulated in a router

function updateTxHistory(uint256 payloadId_, uint256 txInfo_) external override onlyRouter;

Parameters

NameTypeDescription
payloadId_uint256is the id of the message being saved
txInfo_uint256is the relevant information of the transaction being saved

mintSingle

allows minter to mint shares on source

function mintSingle(address srcSender_, uint256 id_, uint256 amount_) external virtual override;

Parameters

NameTypeDescription
srcSender_addressis the beneficiary of shares
id_uint256is the id of the shares
amount_uint256is the amount of shares to mint

mintBatch

allows minter to mint shares on source in batch

function mintBatch(address srcSender_, uint256[] memory ids_, uint256[] memory amounts_) external virtual override;

Parameters

NameTypeDescription
srcSender_addressis the beneficiary of shares
ids_uint256[]are the ids of the shares
amounts_uint256[]are the amounts of shares to mint

burnSingle

allows burner to burn shares on source

function burnSingle(address srcSender_, uint256 id_, uint256 amount_) external virtual override;

Parameters

NameTypeDescription
srcSender_addressis the address of the sender
id_uint256is the id of the shares
amount_uint256is the amount of shares to burn

burnBatch

allows burner to burn shares on source in batch

function burnBatch(address srcSender_, uint256[] memory ids_, uint256[] memory amounts_) external virtual override;

Parameters

NameTypeDescription
srcSender_addressis the address of the sender
ids_uint256[]are the ids of the shares
amounts_uint256[]are the amounts of shares to burn

stateMultiSync

allows state registry contract to mint shares on source

function stateMultiSync(AMBMessage memory data_) external virtual override returns (uint64 srcChainId_);

Parameters

NameTypeDescription
data_AMBMessageis the received information to be processed.

Returns

NameTypeDescription
srcChainId_uint64is the decoded srcChainId.

stateSync

allows state registry contract to mint shares on source

function stateSync(AMBMessage memory data_) external virtual override returns (uint64 srcChainId_);

Parameters

NameTypeDescription
data_AMBMessageis the received information to be processed.

Returns

NameTypeDescription
srcChainId_uint64is the decoded srcChainId.

_validateStateSyncer

helps validate the state registry id for minting superform id

function _validateStateSyncer(uint256 superformId_) internal view;

_validateStateSyncer

helps validate the state registry id for minting superform id

function _validateStateSyncer(uint256[] memory superformIds_) internal view;

_isValidStateSyncer

function _isValidStateSyncer(uint8 registryId_, uint256 superformId_) internal pure;