BatchSubmitter

Git Source

Inherits: Ownable

State Variables

rolesOperator

The roles contract for access control

IRoles public immutable rolesOperator;

verifier

IZkVerifier public verifier;

MINT_SELECTOR

bytes4 internal constant MINT_SELECTOR = ImErc20Host.mintExternal.selector;

REPAY_SELECTOR

bytes4 internal constant REPAY_SELECTOR = ImErc20Host.repayExternal.selector;

OUT_HERE_SELECTOR

bytes4 internal constant OUT_HERE_SELECTOR = ImTokenGateway.outHere.selector;

Functions

constructor

constructor(address _roles, address _zkVerifier, address _owner) Ownable(_owner);

updateZkVerifier

Updates IZkVerifier address

function updateZkVerifier(address _zkVerifier) external onlyOwner;

Parameters

NameTypeDescription
_zkVerifieraddressthe verifier address

batchProcess

Execute multiple operations in a single transaction

function batchProcess(BatchProcessMsg calldata data) external;

_verifyProof

Verifies the proof using ZkVerifier

function _verifyProof(bytes calldata journalData, bytes calldata seal) private view;

Parameters

NameTypeDescription
journalDatabytesThe journal data to verify
sealbytesThe seal data for verification

Events

BatchProcessFailed

event BatchProcessFailed(
    bytes32 initHash,
    address receiver,
    address mToken,
    uint256 amount,
    uint256 minAmountOut,
    bytes4 selector,
    bytes reason
);

BatchProcessSuccess

event BatchProcessSuccess(
    bytes32 initHash, address receiver, address mToken, uint256 amount, uint256 minAmountOut, bytes4 selector
);

ZkVerifierUpdated

event ZkVerifierUpdated(address indexed oldVerifier, address indexed newVerifier);

Errors

BatchSubmitter_CallerNotAllowed

error BatchSubmitter_CallerNotAllowed();

BatchSubmitter_JournalNotValid

error BatchSubmitter_JournalNotValid();

BatchSubmitter_InvalidSelector

error BatchSubmitter_InvalidSelector();

BatchSubmitter_AddressNotValid

error BatchSubmitter_AddressNotValid();

Structs

BatchProcessMsg

receiver Funds receiver/performed on journalData The encoded journal data seal The seal data for verification mTokens Array of mToken addresses amounts Array of amounts for each operation selectors Array of function selectors for each operation startIndex Start index for processing journals endIndex End index for processing journals (exclusive)

struct BatchProcessMsg {
    address[] receivers;
    bytes journalData;
    bytes seal;
    address[] mTokens;
    uint256[] amounts;
    uint256[] minAmountsOut;
    bytes4[] selectors;
    bytes32[] initHashes;
    uint256 startIndex;
}