mTokenProofDecoderLib
Title: mTokenProofDecoderLib
Author: Merge Layers Inc.
Utility library for encoding and decoding mToken journals
State Variables
ENTRY_SIZE
Encoded journal entry size in bytes
uint256 public constant ENTRY_SIZE = 113
Functions
decodeJournal
Decodes encoded journal data into fields
function decodeJournal(bytes memory journalData)
internal
pure
returns (
address sender,
address market,
uint256 accAmountIn,
uint256 accAmountOut,
uint32 chainId,
uint32 dstChainId,
bool l1Inclusion
);
Parameters
| Name | Type | Description |
|---|---|---|
journalData | bytes | Packed journal bytes |
Returns
| Name | Type | Description |
|---|---|---|
sender | address | Journal sender |
market | address | Market address |
accAmountIn | uint256 | Accumulated amount in |
accAmountOut | uint256 | Accumulated amount out |
chainId | uint32 | Source chain id |
dstChainId | uint32 | Destination chain id |
l1Inclusion | bool | Whether L1 inclusion is required |
encodeJournal
Encodes journal fields into packed bytes
function encodeJournal(
address sender,
address market,
uint256 accAmountIn,
uint256 accAmountOut,
uint32 chainId,
uint32 dstChainId,
bool l1Inclusion
) internal pure returns (bytes memory);
Parameters
| Name | Type | Description |
|---|---|---|
sender | address | Journal sender |
market | address | Market address |
accAmountIn | uint256 | Accumulated amount in |
accAmountOut | uint256 | Accumulated amount out |
chainId | uint32 | Source chain id |
dstChainId | uint32 | Destination chain id |
l1Inclusion | bool | Whether L1 inclusion is required |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bytes | Packed journal bytes |
Errors
mTokenProofDecoderLib_ChainNotFound
Thrown when chain is not found
error mTokenProofDecoderLib_ChainNotFound();
mTokenProofDecoderLib_InvalidLength
Thrown when journal length is invalid
error mTokenProofDecoderLib_InvalidLength();
mTokenProofDecoderLib_InvalidInclusion
Thrown when L1 inclusion flag is invalid
error mTokenProofDecoderLib_InvalidInclusion();