ImErc20Host

Git Source

Functions

getProofData

Returns the proof data journal

function getProofData(address user, uint32 dstId) external view returns (uint256, uint256);

mintOrBorrowMigration

Mints mTokens during migration without requiring underlying transfer

function mintOrBorrowMigration(bool mint, uint256 amount, address receiver, address borrower, uint256 minAmount)
    external;

Parameters

NameTypeDescription
mintboolMint or borrow
amountuint256The amount of underlying to be accounted for
receiveraddressThe address that will receive the mTokens or the underlying in case of borrowing
borroweraddressThe address that borrow is executed for
minAmountuint256The min amount of underlying to be accounted for

extractForRebalancing

Extract amount to be used for rebalancing operation

function extractForRebalancing(uint256 amount) external;

Parameters

NameTypeDescription
amountuint256The amount to rebalance

updateAllowedCallerStatus

Set caller status for msg.sender

function updateAllowedCallerStatus(address caller, bool status) external;

Parameters

NameTypeDescription
calleraddressThe caller address
statusboolThe status to set for caller

liquidateExternal

Mints tokens after external verification

function liquidateExternal(
    bytes calldata journalData,
    bytes calldata seal,
    address[] calldata userToLiquidate,
    uint256[] calldata liquidateAmount,
    address[] calldata collateral,
    address receiver
) external;

Parameters

NameTypeDescription
journalDatabytesThe journal data for minting (array of encoded journals)
sealbytesThe Zk proof seal
userToLiquidateaddress[]Array of positions to liquidate
liquidateAmountuint256[]Array of amounts to liquidate
collateraladdress[]Array of collaterals to seize
receiveraddressThe collateral receiver

mintExternal

Mints tokens after external verification

function mintExternal(
    bytes calldata journalData,
    bytes calldata seal,
    uint256[] calldata mintAmount,
    uint256[] calldata minAmountsOut,
    address receiver
) external;

Parameters

NameTypeDescription
journalDatabytesThe journal data for minting (array of encoded journals)
sealbytesThe Zk proof seal
mintAmountuint256[]Array of amounts to mint
minAmountsOutuint256[]Array of min amounts accepted
receiveraddressThe tokens receiver

repayExternal

Repays tokens after external verification

function repayExternal(
    bytes calldata journalData,
    bytes calldata seal,
    uint256[] calldata repayAmount,
    address receiver
) external;

Parameters

NameTypeDescription
journalDatabytesThe journal data for repayment (array of encoded journals)
sealbytesThe Zk proof seal
repayAmountuint256[]Array of amounts to repay
receiveraddressThe position to repay for

performExtensionCall

Initiates a withdraw operation

function performExtensionCall(uint256 actionType, uint256 amount, uint32 dstChainId) external payable;

Parameters

NameTypeDescription
actionTypeuint256The actionType param (1 - withdraw, 2 - borrow)
amountuint256The amount to withdraw
dstChainIduint32The destination chain to recieve funds

Events

AllowedCallerUpdated

Emitted when a user updates allowed callers

event AllowedCallerUpdated(address indexed sender, address indexed caller, bool status);

mErc20Host_ChainStatusUpdated

Emitted when a chain id whitelist status is updated

event mErc20Host_ChainStatusUpdated(uint32 indexed chainId, bool status);

mErc20Host_LiquidateExternal

Emitted when a liquidate operation is executed

event mErc20Host_LiquidateExternal(
    address indexed msgSender,
    address indexed srcSender,
    address userToLiquidate,
    address receiver,
    address indexed collateral,
    uint32 srcChainId,
    uint256 amount
);

mErc20Host_MintExternal

Emitted when a mint operation is executed

event mErc20Host_MintExternal(
    address indexed msgSender, address indexed srcSender, address indexed receiver, uint32 chainId, uint256 amount
);

mErc20Host_BorrowExternal

Emitted when a borrow operation is executed

event mErc20Host_BorrowExternal(
    address indexed msgSender, address indexed srcSender, uint32 indexed chainId, uint256 amount
);

mErc20Host_RepayExternal

Emitted when a repay operation is executed

event mErc20Host_RepayExternal(
    address indexed msgSender, address indexed srcSender, address indexed position, uint32 chainId, uint256 amount
);

mErc20Host_WithdrawExternal

Emitted when a withdrawal is executed

event mErc20Host_WithdrawExternal(
    address indexed msgSender, address indexed srcSender, uint32 indexed chainId, uint256 amount
);

mErc20Host_BorrowOnExtensionChain

Emitted when a borrow operation is triggered for an extension chain

event mErc20Host_BorrowOnExtensionChain(address indexed sender, uint32 dstChainId, uint256 amount);

mErc20Host_WithdrawOnExtensionChain

Emitted when a withdraw operation is triggered for an extension chain

event mErc20Host_WithdrawOnExtensionChain(address indexed sender, uint32 dstChainId, uint256 amount);

mErc20Host_GasFeeUpdated

Emitted when gas fees are updated for a dst chain

event mErc20Host_GasFeeUpdated(uint32 indexed dstChainId, uint256 amount);

mErc20Host_MintMigration

event mErc20Host_MintMigration(address indexed receiver, uint256 amount);

mErc20Host_BorrowMigration

event mErc20Host_BorrowMigration(address indexed borrower, uint256 amount);

Errors

mErc20Host_ProofGenerationInputNotValid

Thrown when the chain id is not LINEA

error mErc20Host_ProofGenerationInputNotValid();

mErc20Host_DstChainNotValid

Thrown when the dst chain id is not current chain

error mErc20Host_DstChainNotValid();

mErc20Host_ChainNotValid

Thrown when the chain id is not LINEA

error mErc20Host_ChainNotValid();

mErc20Host_AddressNotValid

Thrown when the address is not valid

error mErc20Host_AddressNotValid();

mErc20Host_AmountTooBig

Thrown when the amount provided is bigger than the available amount`

error mErc20Host_AmountTooBig();

mErc20Host_AmountNotValid

Thrown when the amount specified is invalid (e.g., zero)

error mErc20Host_AmountNotValid();

mErc20Host_JournalNotValid

Thrown when the journal data provided is invalid or corrupted

error mErc20Host_JournalNotValid();

mErc20Host_CallerNotAllowed

Thrown when caller is not allowed

error mErc20Host_CallerNotAllowed();

mErc20Host_NotRebalancer

Thrown when caller is not rebalancer

error mErc20Host_NotRebalancer();

mErc20Host_LengthMismatch

Thrown when length of array is not valid

error mErc20Host_LengthMismatch();

mErc20Host_NotEnoughGasFee

Thrown when not enough gas fee was received

error mErc20Host_NotEnoughGasFee();

mErc20Host_L1InclusionRequired

Thrown when L1 inclusion is required

error mErc20Host_L1InclusionRequired();

mErc20Host_ActionNotAvailable

Thrown when extension action is not valid

error mErc20Host_ActionNotAvailable();