Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 116 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Receive Message | 20143164 | 173 days ago | IN | 0 ETH | 0.00085033 | ||||
Receive Message | 19657428 | 240 days ago | IN | 0 ETH | 0.00242369 | ||||
Receive Message | 19592301 | 250 days ago | IN | 0 ETH | 0.0064049 | ||||
Receive Message | 19508038 | 261 days ago | IN | 0 ETH | 0.00473757 | ||||
Receive Message | 19468581 | 267 days ago | IN | 0 ETH | 0.01571569 | ||||
Receive Message | 19430377 | 272 days ago | IN | 0 ETH | 0.01542394 | ||||
Receive Message | 19390835 | 278 days ago | IN | 0 ETH | 0.02264161 | ||||
Receive Message | 19369350 | 281 days ago | IN | 0 ETH | 0.02528333 | ||||
Receive Message | 19366066 | 281 days ago | IN | 0 ETH | 0.02552529 | ||||
Receive Message | 19328800 | 287 days ago | IN | 0 ETH | 0.01823034 | ||||
Receive Message | 19312123 | 289 days ago | IN | 0 ETH | 0.01491441 | ||||
Receive Message | 19273750 | 294 days ago | IN | 0 ETH | 0.011302 | ||||
Receive Message | 19272513 | 294 days ago | IN | 0 ETH | 0.01092032 | ||||
Receive Message | 19272510 | 294 days ago | IN | 0 ETH | 0.01094952 | ||||
Receive Message | 19272507 | 294 days ago | IN | 0 ETH | 0.01127558 | ||||
Receive Message | 19272504 | 294 days ago | IN | 0 ETH | 0.01348915 | ||||
Receive Message | 19272501 | 294 days ago | IN | 0 ETH | 0.01068029 | ||||
Receive Message | 19272497 | 294 days ago | IN | 0 ETH | 0.01090655 | ||||
Receive Message | 19272493 | 294 days ago | IN | 0 ETH | 0.0106878 | ||||
Receive Message | 19272490 | 294 days ago | IN | 0 ETH | 0.01095241 | ||||
Receive Message | 19272486 | 294 days ago | IN | 0 ETH | 0.01115537 | ||||
Receive Message | 19272483 | 294 days ago | IN | 0 ETH | 0.01147688 | ||||
Receive Message | 19272476 | 294 days ago | IN | 0 ETH | 0.01048936 | ||||
Receive Message | 19272473 | 294 days ago | IN | 0 ETH | 0.01000121 | ||||
Receive Message | 19272470 | 294 days ago | IN | 0 ETH | 0.01106994 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xEc20eD12...8Dc0fF583 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
PolygonRoot
Compiler Version
v0.8.23+commit.f704f362
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: AGPL-3.0-or-later pragma solidity ^0.8.0; import "@fx-portal/contracts/tunnel/FxBaseRootTunnel.sol"; contract PolygonRoot is FxBaseRootTunnel { address public immutable rootApplication; constructor( address _checkpointManager, address _fxRoot, address _rootApplication, address _fxChildTunnel ) FxBaseRootTunnel(_checkpointManager, _fxRoot) { require( _rootApplication != address(0) && _fxChildTunnel != address(0), "Wrong input parameters" ); rootApplication = _rootApplication; fxChildTunnel = _fxChildTunnel; } function _processMessageFromChild(bytes memory data) internal override { // solhint-disable-next-line avoid-low-level-calls (bool success, ) = rootApplication.call(data); require(success, "Root tx failed"); } fallback() external { require(msg.sender == rootApplication, "Caller must be the root app"); _sendMessageToChild(msg.data); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {RLPReader} from "../lib/RLPReader.sol"; import {MerklePatriciaProof} from "../lib/MerklePatriciaProof.sol"; import {Merkle} from "../lib/Merkle.sol"; import "../lib/ExitPayloadReader.sol"; interface IFxStateSender { function sendMessageToChild(address _receiver, bytes calldata _data) external; } contract ICheckpointManager { struct HeaderBlock { bytes32 root; uint256 start; uint256 end; uint256 createdAt; address proposer; } /** * @notice mapping of checkpoint header numbers to block details * @dev These checkpoints are submited by plasma contracts */ mapping(uint256 => HeaderBlock) public headerBlocks; } abstract contract FxBaseRootTunnel { using RLPReader for RLPReader.RLPItem; using Merkle for bytes32; using ExitPayloadReader for bytes; using ExitPayloadReader for ExitPayloadReader.ExitPayload; using ExitPayloadReader for ExitPayloadReader.Log; using ExitPayloadReader for ExitPayloadReader.LogTopics; using ExitPayloadReader for ExitPayloadReader.Receipt; // keccak256(MessageSent(bytes)) bytes32 public constant SEND_MESSAGE_EVENT_SIG = 0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036; // state sender contract IFxStateSender public fxRoot; // root chain manager ICheckpointManager public checkpointManager; // child tunnel contract which receives and sends messages address public fxChildTunnel; // storage to avoid duplicate exits mapping(bytes32 => bool) public processedExits; constructor(address _checkpointManager, address _fxRoot) { checkpointManager = ICheckpointManager(_checkpointManager); fxRoot = IFxStateSender(_fxRoot); } // set fxChildTunnel if not set already function setFxChildTunnel(address _fxChildTunnel) public virtual { require(fxChildTunnel == address(0x0), "FxBaseRootTunnel: CHILD_TUNNEL_ALREADY_SET"); fxChildTunnel = _fxChildTunnel; } /** * @notice Send bytes message to Child Tunnel * @param message bytes message that will be sent to Child Tunnel * some message examples - * abi.encode(tokenId); * abi.encode(tokenId, tokenMetadata); * abi.encode(messageType, messageData); */ function _sendMessageToChild(bytes memory message) internal { fxRoot.sendMessageToChild(fxChildTunnel, message); } function _validateAndExtractMessage(bytes memory inputData) internal returns (bytes memory) { ExitPayloadReader.ExitPayload memory payload = inputData.toExitPayload(); bytes memory branchMaskBytes = payload.getBranchMaskAsBytes(); uint256 blockNumber = payload.getBlockNumber(); // checking if exit has already been processed // unique exit is identified using hash of (blockNumber, branchMask, receiptLogIndex) bytes32 exitHash = keccak256( abi.encodePacked( blockNumber, // first 2 nibbles are dropped while generating nibble array // this allows branch masks that are valid but bypass exitHash check (changing first 2 nibbles only) // so converting to nibble array and then hashing it MerklePatriciaProof._getNibbleArray(branchMaskBytes), payload.getReceiptLogIndex() ) ); require(processedExits[exitHash] == false, "FxRootTunnel: EXIT_ALREADY_PROCESSED"); processedExits[exitHash] = true; ExitPayloadReader.Receipt memory receipt = payload.getReceipt(); ExitPayloadReader.Log memory log = receipt.getLog(); // check child tunnel require(fxChildTunnel == log.getEmitter(), "FxRootTunnel: INVALID_FX_CHILD_TUNNEL"); bytes32 receiptRoot = payload.getReceiptRoot(); // verify receipt inclusion require( MerklePatriciaProof.verify(receipt.toBytes(), branchMaskBytes, payload.getReceiptProof(), receiptRoot), "FxRootTunnel: INVALID_RECEIPT_PROOF" ); // verify checkpoint inclusion _checkBlockMembershipInCheckpoint( blockNumber, payload.getBlockTime(), payload.getTxRoot(), receiptRoot, payload.getHeaderNumber(), payload.getBlockProof() ); ExitPayloadReader.LogTopics memory topics = log.getTopics(); require( bytes32(topics.getField(0).toUint()) == SEND_MESSAGE_EVENT_SIG, // topic0 is event sig "FxRootTunnel: INVALID_SIGNATURE" ); // received message data bytes memory message = abi.decode(log.getData(), (bytes)); // event decodes params again, so decoding bytes to get message return message; } function _checkBlockMembershipInCheckpoint( uint256 blockNumber, uint256 blockTime, bytes32 txRoot, bytes32 receiptRoot, uint256 headerNumber, bytes memory blockProof ) private view returns (uint256) { (bytes32 headerRoot, uint256 startBlock, , uint256 createdAt, ) = checkpointManager.headerBlocks(headerNumber); require( keccak256(abi.encodePacked(blockNumber, blockTime, txRoot, receiptRoot)).checkMembership( blockNumber - startBlock, headerRoot, blockProof ), "FxRootTunnel: INVALID_HEADER" ); return createdAt; } /** * @notice receive message from L2 to L1, validated by proof * @dev This function verifies if the transaction actually happened on child chain * * @param inputData RLP encoded data of the reference tx containing following list of fields * 0 - headerNumber - Checkpoint header block number containing the reference tx * 1 - blockProof - Proof that the block header (in the child chain) is a leaf in the submitted merkle root * 2 - blockNumber - Block number containing the reference tx on child chain * 3 - blockTime - Reference tx block time * 4 - txRoot - Transactions root of block * 5 - receiptRoot - Receipts root of block * 6 - receipt - Receipt of the reference transaction * 7 - receiptProof - Merkle proof of the reference receipt * 8 - branchMask - 32 bits denoting the path of receipt in merkle tree * 9 - receiptLogIndex - Log Index to read from the receipt */ function receiveMessage(bytes memory inputData) public virtual { bytes memory message = _validateAndExtractMessage(inputData); _processMessageFromChild(message); } /** * @notice Process message received from Child Tunnel * @dev function needs to be implemented to handle message as per requirement * This is called by onStateReceive function. * Since it is called via a system call, any event will not be emitted during its execution. * @param message bytes message that was sent from Child Tunnel */ function _processMessageFromChild(bytes memory message) internal virtual; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {RLPReader} from "./RLPReader.sol"; library MerklePatriciaProof { /* * @dev Verifies a merkle patricia proof. * @param value The terminating value in the trie. * @param encodedPath The path in the trie leading to value. * @param rlpParentNodes The rlp encoded stack of nodes. * @param root The root hash of the trie. * @return The boolean validity of the proof. */ function verify( bytes memory value, bytes memory encodedPath, bytes memory rlpParentNodes, bytes32 root ) internal pure returns (bool) { RLPReader.RLPItem memory item = RLPReader.toRlpItem(rlpParentNodes); RLPReader.RLPItem[] memory parentNodes = RLPReader.toList(item); bytes memory currentNode; RLPReader.RLPItem[] memory currentNodeList; bytes32 nodeKey = root; uint256 pathPtr = 0; bytes memory path = _getNibbleArray(encodedPath); if (path.length == 0) { return false; } for (uint256 i = 0; i < parentNodes.length; i++) { if (pathPtr > path.length) { return false; } currentNode = RLPReader.toRlpBytes(parentNodes[i]); if (nodeKey != keccak256(currentNode)) { return false; } currentNodeList = RLPReader.toList(parentNodes[i]); if (currentNodeList.length == 17) { if (pathPtr == path.length) { if (keccak256(RLPReader.toBytes(currentNodeList[16])) == keccak256(value)) { return true; } else { return false; } } uint8 nextPathNibble = uint8(path[pathPtr]); if (nextPathNibble > 16) { return false; } nodeKey = bytes32(RLPReader.toUintStrict(currentNodeList[nextPathNibble])); pathPtr += 1; } else if (currentNodeList.length == 2) { uint256 traversed = _nibblesToTraverse(RLPReader.toBytes(currentNodeList[0]), path, pathPtr); if (pathPtr + traversed == path.length) { //leaf node if (keccak256(RLPReader.toBytes(currentNodeList[1])) == keccak256(value)) { return true; } else { return false; } } //extension node if (traversed == 0) { return false; } pathPtr += traversed; nodeKey = bytes32(RLPReader.toUintStrict(currentNodeList[1])); } else { return false; } } } function _nibblesToTraverse( bytes memory encodedPartialPath, bytes memory path, uint256 pathPtr ) private pure returns (uint256) { uint256 len = 0; // encodedPartialPath has elements that are each two hex characters (1 byte), but partialPath // and slicedPath have elements that are each one hex character (1 nibble) bytes memory partialPath = _getNibbleArray(encodedPartialPath); bytes memory slicedPath = new bytes(partialPath.length); // pathPtr counts nibbles in path // partialPath.length is a number of nibbles for (uint256 i = pathPtr; i < pathPtr + partialPath.length; i++) { bytes1 pathNibble = path[i]; slicedPath[i - pathPtr] = pathNibble; } if (keccak256(partialPath) == keccak256(slicedPath)) { len = partialPath.length; } else { len = 0; } return len; } // bytes b must be hp encoded function _getNibbleArray(bytes memory b) internal pure returns (bytes memory) { bytes memory nibbles = ""; if (b.length > 0) { uint8 offset; uint8 hpNibble = uint8(_getNthNibbleOfBytes(0, b)); if (hpNibble == 1 || hpNibble == 3) { nibbles = new bytes(b.length * 2 - 1); bytes1 oddNibble = _getNthNibbleOfBytes(1, b); nibbles[0] = oddNibble; offset = 1; } else { nibbles = new bytes(b.length * 2 - 2); offset = 0; } for (uint256 i = offset; i < nibbles.length; i++) { nibbles[i] = _getNthNibbleOfBytes(i - offset + 2, b); } } return nibbles; } function _getNthNibbleOfBytes(uint256 n, bytes memory str) private pure returns (bytes1) { return bytes1(n % 2 == 0 ? uint8(str[n / 2]) / 0x10 : uint8(str[n / 2]) % 0x10); } }
/* * @author Hamdi Allam [email protected] * Please reach out with any questions or concerns */ pragma solidity ^0.8.0; library RLPReader { uint8 constant STRING_SHORT_START = 0x80; uint8 constant STRING_LONG_START = 0xb8; uint8 constant LIST_SHORT_START = 0xc0; uint8 constant LIST_LONG_START = 0xf8; uint8 constant WORD_SIZE = 32; struct RLPItem { uint256 len; uint256 memPtr; } struct Iterator { RLPItem item; // Item that's being iterated over. uint256 nextPtr; // Position of the next item in the list. } /* * @dev Returns the next element in the iteration. Reverts if it has not next element. * @param self The iterator. * @return The next element in the iteration. */ function next(Iterator memory self) internal pure returns (RLPItem memory) { require(hasNext(self)); uint256 ptr = self.nextPtr; uint256 itemLength = _itemLength(ptr); self.nextPtr = ptr + itemLength; return RLPItem(itemLength, ptr); } /* * @dev Returns true if the iteration has more elements. * @param self The iterator. * @return true if the iteration has more elements. */ function hasNext(Iterator memory self) internal pure returns (bool) { RLPItem memory item = self.item; return self.nextPtr < item.memPtr + item.len; } /* * @param item RLP encoded bytes */ function toRlpItem(bytes memory item) internal pure returns (RLPItem memory) { uint256 memPtr; assembly { memPtr := add(item, 0x20) } return RLPItem(item.length, memPtr); } /* * @dev Create an iterator. Reverts if item is not a list. * @param self The RLP item. * @return An 'Iterator' over the item. */ function iterator(RLPItem memory self) internal pure returns (Iterator memory) { require(isList(self)); uint256 ptr = self.memPtr + _payloadOffset(self.memPtr); return Iterator(self, ptr); } /* * @param item RLP encoded bytes */ function rlpLen(RLPItem memory item) internal pure returns (uint256) { return item.len; } /* * @param item RLP encoded bytes */ function payloadLen(RLPItem memory item) internal pure returns (uint256) { return item.len - _payloadOffset(item.memPtr); } /* * @param item RLP encoded list in bytes */ function toList(RLPItem memory item) internal pure returns (RLPItem[] memory) { require(isList(item)); uint256 items = numItems(item); RLPItem[] memory result = new RLPItem[](items); uint256 memPtr = item.memPtr + _payloadOffset(item.memPtr); uint256 dataLen; for (uint256 i = 0; i < items; i++) { dataLen = _itemLength(memPtr); result[i] = RLPItem(dataLen, memPtr); memPtr = memPtr + dataLen; } return result; } // @return indicator whether encoded payload is a list. negate this function call for isData. function isList(RLPItem memory item) internal pure returns (bool) { if (item.len == 0) return false; uint8 byte0; uint256 memPtr = item.memPtr; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < LIST_SHORT_START) return false; return true; } /* * @dev A cheaper version of keccak256(toRlpBytes(item)) that avoids copying memory. * @return keccak256 hash of RLP encoded bytes. */ function rlpBytesKeccak256(RLPItem memory item) internal pure returns (bytes32) { uint256 ptr = item.memPtr; uint256 len = item.len; bytes32 result; assembly { result := keccak256(ptr, len) } return result; } function payloadLocation(RLPItem memory item) internal pure returns (uint256, uint256) { uint256 offset = _payloadOffset(item.memPtr); uint256 memPtr = item.memPtr + offset; uint256 len = item.len - offset; // data length return (memPtr, len); } /* * @dev A cheaper version of keccak256(toBytes(item)) that avoids copying memory. * @return keccak256 hash of the item payload. */ function payloadKeccak256(RLPItem memory item) internal pure returns (bytes32) { (uint256 memPtr, uint256 len) = payloadLocation(item); bytes32 result; assembly { result := keccak256(memPtr, len) } return result; } /** RLPItem conversions into data types **/ // @returns raw rlp encoding in bytes function toRlpBytes(RLPItem memory item) internal pure returns (bytes memory) { bytes memory result = new bytes(item.len); if (result.length == 0) return result; uint256 ptr; assembly { ptr := add(0x20, result) } copy(item.memPtr, ptr, item.len); return result; } // any non-zero byte is considered true function toBoolean(RLPItem memory item) internal pure returns (bool) { require(item.len == 1); uint256 result; uint256 memPtr = item.memPtr; assembly { result := byte(0, mload(memPtr)) } return result == 0 ? false : true; } function toAddress(RLPItem memory item) internal pure returns (address) { // 1 byte for the length prefix require(item.len == 21); return address(uint160(toUint(item))); } function toUint(RLPItem memory item) internal pure returns (uint256) { require(item.len > 0 && item.len <= 33); uint256 offset = _payloadOffset(item.memPtr); uint256 len = item.len - offset; uint256 result; uint256 memPtr = item.memPtr + offset; assembly { result := mload(memPtr) // shfit to the correct location if neccesary if lt(len, 32) { result := div(result, exp(256, sub(32, len))) } } return result; } // enforces 32 byte length function toUintStrict(RLPItem memory item) internal pure returns (uint256) { // one byte prefix require(item.len == 33); uint256 result; uint256 memPtr = item.memPtr + 1; assembly { result := mload(memPtr) } return result; } function toBytes(RLPItem memory item) internal pure returns (bytes memory) { require(item.len > 0); uint256 offset = _payloadOffset(item.memPtr); uint256 len = item.len - offset; // data length bytes memory result = new bytes(len); uint256 destPtr; assembly { destPtr := add(0x20, result) } copy(item.memPtr + offset, destPtr, len); return result; } /* * Private Helpers */ // @return number of payload items inside an encoded list. function numItems(RLPItem memory item) private pure returns (uint256) { if (item.len == 0) return 0; uint256 count = 0; uint256 currPtr = item.memPtr + _payloadOffset(item.memPtr); uint256 endPtr = item.memPtr + item.len; while (currPtr < endPtr) { currPtr = currPtr + _itemLength(currPtr); // skip over an item count++; } return count; } // @return entire rlp item byte length function _itemLength(uint256 memPtr) private pure returns (uint256) { uint256 itemLen; uint256 byte0; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < STRING_SHORT_START) itemLen = 1; else if (byte0 < STRING_LONG_START) itemLen = byte0 - STRING_SHORT_START + 1; else if (byte0 < LIST_SHORT_START) { assembly { let byteLen := sub(byte0, 0xb7) // # of bytes the actual length is memPtr := add(memPtr, 1) // skip over the first byte /* 32 byte word size */ let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to get the len itemLen := add(dataLen, add(byteLen, 1)) } } else if (byte0 < LIST_LONG_START) { itemLen = byte0 - LIST_SHORT_START + 1; } else { assembly { let byteLen := sub(byte0, 0xf7) memPtr := add(memPtr, 1) let dataLen := div(mload(memPtr), exp(256, sub(32, byteLen))) // right shifting to the correct length itemLen := add(dataLen, add(byteLen, 1)) } } return itemLen; } // @return number of bytes until the data function _payloadOffset(uint256 memPtr) private pure returns (uint256) { uint256 byte0; assembly { byte0 := byte(0, mload(memPtr)) } if (byte0 < STRING_SHORT_START) return 0; else if (byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LONG_START)) return 1; else if (byte0 < LIST_SHORT_START) // being explicit return byte0 - (STRING_LONG_START - 1) + 1; else return byte0 - (LIST_LONG_START - 1) + 1; } /* * @param src Pointer to source * @param dest Pointer to destination * @param len Amount of memory to copy from the source */ function copy( uint256 src, uint256 dest, uint256 len ) private pure { if (len == 0) return; // copy as many word sizes as possible for (; len >= WORD_SIZE; len -= WORD_SIZE) { assembly { mstore(dest, mload(src)) } src += WORD_SIZE; dest += WORD_SIZE; } if (len == 0) return; // left over bytes. Mask is used to remove unwanted bytes from the word uint256 mask = 256**(WORD_SIZE - len) - 1; assembly { let srcpart := and(mload(src), not(mask)) // zero out src let destpart := and(mload(dest), mask) // retrieve the bytes mstore(dest, or(destpart, srcpart)) } } }
pragma solidity ^0.8.0; import {RLPReader} from "./RLPReader.sol"; library ExitPayloadReader { using RLPReader for bytes; using RLPReader for RLPReader.RLPItem; uint8 constant WORD_SIZE = 32; struct ExitPayload { RLPReader.RLPItem[] data; } struct Receipt { RLPReader.RLPItem[] data; bytes raw; uint256 logIndex; } struct Log { RLPReader.RLPItem data; RLPReader.RLPItem[] list; } struct LogTopics { RLPReader.RLPItem[] data; } // copy paste of private copy() from RLPReader to avoid changing of existing contracts function copy( uint256 src, uint256 dest, uint256 len ) private pure { if (len == 0) return; // copy as many word sizes as possible for (; len >= WORD_SIZE; len -= WORD_SIZE) { assembly { mstore(dest, mload(src)) } src += WORD_SIZE; dest += WORD_SIZE; } if (len == 0) return; // left over bytes. Mask is used to remove unwanted bytes from the word uint256 mask = 256**(WORD_SIZE - len) - 1; assembly { let srcpart := and(mload(src), not(mask)) // zero out src let destpart := and(mload(dest), mask) // retrieve the bytes mstore(dest, or(destpart, srcpart)) } } function toExitPayload(bytes memory data) internal pure returns (ExitPayload memory) { RLPReader.RLPItem[] memory payloadData = data.toRlpItem().toList(); return ExitPayload(payloadData); } function getHeaderNumber(ExitPayload memory payload) internal pure returns (uint256) { return payload.data[0].toUint(); } function getBlockProof(ExitPayload memory payload) internal pure returns (bytes memory) { return payload.data[1].toBytes(); } function getBlockNumber(ExitPayload memory payload) internal pure returns (uint256) { return payload.data[2].toUint(); } function getBlockTime(ExitPayload memory payload) internal pure returns (uint256) { return payload.data[3].toUint(); } function getTxRoot(ExitPayload memory payload) internal pure returns (bytes32) { return bytes32(payload.data[4].toUint()); } function getReceiptRoot(ExitPayload memory payload) internal pure returns (bytes32) { return bytes32(payload.data[5].toUint()); } function getReceipt(ExitPayload memory payload) internal pure returns (Receipt memory receipt) { receipt.raw = payload.data[6].toBytes(); RLPReader.RLPItem memory receiptItem = receipt.raw.toRlpItem(); if (receiptItem.isList()) { // legacy tx receipt.data = receiptItem.toList(); } else { // pop first byte before parsting receipt bytes memory typedBytes = receipt.raw; bytes memory result = new bytes(typedBytes.length - 1); uint256 srcPtr; uint256 destPtr; assembly { srcPtr := add(33, typedBytes) destPtr := add(0x20, result) } copy(srcPtr, destPtr, result.length); receipt.data = result.toRlpItem().toList(); } receipt.logIndex = getReceiptLogIndex(payload); return receipt; } function getReceiptProof(ExitPayload memory payload) internal pure returns (bytes memory) { return payload.data[7].toBytes(); } function getBranchMaskAsBytes(ExitPayload memory payload) internal pure returns (bytes memory) { return payload.data[8].toBytes(); } function getBranchMaskAsUint(ExitPayload memory payload) internal pure returns (uint256) { return payload.data[8].toUint(); } function getReceiptLogIndex(ExitPayload memory payload) internal pure returns (uint256) { return payload.data[9].toUint(); } // Receipt methods function toBytes(Receipt memory receipt) internal pure returns (bytes memory) { return receipt.raw; } function getLog(Receipt memory receipt) internal pure returns (Log memory) { RLPReader.RLPItem memory logData = receipt.data[3].toList()[receipt.logIndex]; return Log(logData, logData.toList()); } // Log methods function getEmitter(Log memory log) internal pure returns (address) { return RLPReader.toAddress(log.list[0]); } function getTopics(Log memory log) internal pure returns (LogTopics memory) { return LogTopics(log.list[1].toList()); } function getData(Log memory log) internal pure returns (bytes memory) { return log.list[2].toBytes(); } function toRlpBytes(Log memory log) internal pure returns (bytes memory) { return log.data.toRlpBytes(); } // LogTopics methods function getField(LogTopics memory topics, uint256 index) internal pure returns (RLPReader.RLPItem memory) { return topics.data[index]; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library Merkle { function checkMembership( bytes32 leaf, uint256 index, bytes32 rootHash, bytes memory proof ) internal pure returns (bool) { require(proof.length % 32 == 0, "Invalid proof length"); uint256 proofHeight = proof.length / 32; // Proof of size n means, height of the tree is n+1. // In a tree of height n+1, max #leafs possible is 2 ^ n require(index < 2**proofHeight, "Leaf index is too big"); bytes32 proofElement; bytes32 computedHash = leaf; for (uint256 i = 32; i <= proof.length; i += 32) { assembly { proofElement := mload(add(proof, i)) } if (index % 2 == 0) { computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); } index = index / 2; } return computedHash == rootHash; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "remappings": [ "@fx-portal/contracts=.cache/fx-portal/v1.0.5" ], "evmVersion": "paris", "viaIR": false }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_checkpointManager","type":"address"},{"internalType":"address","name":"_fxRoot","type":"address"},{"internalType":"address","name":"_rootApplication","type":"address"},{"internalType":"address","name":"_fxChildTunnel","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[],"name":"SEND_MESSAGE_EVENT_SIG","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"checkpointManager","outputs":[{"internalType":"contract ICheckpointManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fxChildTunnel","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fxRoot","outputs":[{"internalType":"contract IFxStateSender","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"processedExits","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"inputData","type":"bytes"}],"name":"receiveMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rootApplication","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_fxChildTunnel","type":"address"}],"name":"setFxChildTunnel","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063aea4e49e1161005b578063aea4e49e14610206578063c0857ba014610219578063de9b771f1461022c578063f953cec71461023f57610088565b80630e387de614610147578063607f2d421461018157806362b0a197146101b4578063972c4928146101f3575b336001600160a01b037f000000000000000000000000347cc7ede7e5517bd47d20620b2cf1b406edcf0716146101055760405162461bcd60e51b815260206004820152601b60248201527f43616c6c6572206d7573742062652074686520726f6f7420617070000000000060448201526064015b60405180910390fd5b6101456000368080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061025292505050565b005b61016e7f8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b03681565b6040519081526020015b60405180910390f35b6101a461018f366004611921565b60036020526000908152604090205460ff1681565b6040519015158152602001610178565b6101db7f000000000000000000000000347cc7ede7e5517bd47d20620b2cf1b406edcf0781565b6040516001600160a01b039091168152602001610178565b6002546101db906001600160a01b031681565b610145610214366004611952565b6102bd565b6001546101db906001600160a01b031681565b6000546101db906001600160a01b031681565b61014561024d3660046119de565b61034b565b60005460025460405163b472047760e01b81526001600160a01b039283169263b472047792610288929116908590600401611a82565b600060405180830381600087803b1580156102a257600080fd5b505af11580156102b6573d6000803e3d6000fd5b5050505050565b6002546001600160a01b0316156103295760405162461bcd60e51b815260206004820152602a60248201527f467842617365526f6f7454756e6e656c3a204348494c445f54554e4e454c5f4160448201526913149150511657d4d15560b21b60648201526084016100fc565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b600061035682610365565b90506103618161064b565b5050565b6060600061037283610709565b9050600061037f82610768565b9050600061038c83610797565b905060008161039a846107c0565b6103a386610974565b6040516020016103b593929190611ac4565b60408051601f1981840301815291815281516020928301206000818152600390935291205490915060ff16156104395760405162461bcd60e51b8152602060048201526024808201527f4678526f6f7454756e6e656c3a20455849545f414c52454144595f50524f434560448201526314d4d15160e21b60648201526084016100fc565b6000818152600360205260408120805460ff1916600117905561045b85610990565b9050600061046882610ada565b905061047381610b6a565b6002546001600160a01b039081169116146104de5760405162461bcd60e51b815260206004820152602560248201527f4678526f6f7454756e6e656c3a20494e56414c49445f46585f4348494c445f54604482015264155393915360da1b60648201526084016100fc565b60006104e987610b93565b90506105096104f9846020015190565b876105038a610baf565b84610bcb565b6105615760405162461bcd60e51b815260206004820152602360248201527f4678526f6f7454756e6e656c3a20494e56414c49445f524543454950545f505260448201526227a7a360e91b60648201526084016100fc565b61058f8561056e89610e74565b6105778a610e90565b846105818c610eac565b61058a8d610ec8565b610ee4565b50600061059b8361100a565b90507f8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b0366105d16105cc836000611046565b61107e565b1461061e5760405162461bcd60e51b815260206004820152601f60248201527f4678526f6f7454756e6e656c3a20494e56414c49445f5349474e41545552450060448201526064016100fc565b6000610629846110f9565b80602001905181019061063c9190611af1565b9b9a5050505050505050505050565b60007f000000000000000000000000347cc7ede7e5517bd47d20620b2cf1b406edcf076001600160a01b0316826040516106859190611b68565b6000604051808303816000865af19150503d80600081146106c2576040519150601f19603f3d011682016040523d82523d6000602084013e6106c7565b606091505b50509050806103615760405162461bcd60e51b815260206004820152600e60248201526d149bdbdd081d1e0819985a5b195960921b60448201526064016100fc565b604080516020810190915260608152600061075361074e8460408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b611115565b60408051602081019091529081529392505050565b6060610791826000015160088151811061078457610784611b84565b6020026020010151611221565b92915050565b600061079182600001516002815181106107b3576107b3611b84565b602002602001015161107e565b60408051602081019091526000815281516060919015610791576000806107e86000866112be565b60f81c905060018114806107ff57508060ff166003145b156108a7576001855160026108149190611bb0565b61081e9190611bc7565b67ffffffffffffffff8111156108365761083661196f565b6040519080825280601f01601f191660200182016040528015610860576020820181803683370190505b50925060006108706001876112be565b9050808460008151811061088657610886611b84565b60200101906001600160f81b031916908160001a905350600192505061090b565b6002855160026108b79190611bb0565b6108c19190611bc7565b67ffffffffffffffff8111156108d9576108d961196f565b6040519080825280601f01601f191660200182016040528015610903576020820181803683370190505b509250600091505b60ff82165b835181101561096b5761093a61092960ff851683611bc7565b610934906002611bda565b876112be565b84828151811061094c5761094c611b84565b60200101906001600160f81b031916908160001a905350600101610910565b50505092915050565b600061079182600001516009815181106107b3576107b3611b84565b6109b460405180606001604052806060815260200160608152602001600081525090565b6109ce826000015160068151811061078457610784611b84565b602082810182905260408051808201825260008082529083015280518082019091528251815291810190820152610a048161133f565b15610a1957610a1281611115565b8252610ac6565b60208201518051600090610a2f90600190611bc7565b67ffffffffffffffff811115610a4757610a4761196f565b6040519080825280601f01601f191660200182016040528015610a71576020820181803683370190505b509050600080836021019150826020019050610a8f8282855161137a565b604080518082018252600080825260209182015281518083019092528451825280850190820152610abf90611115565b8652505050505b610acf83610974565b604083015250919050565b604080516080810182526000918101828152606080830193909352815260208101919091526000610b288360000151600381518110610b1b57610b1b611b84565b6020026020010151611115565b836040015181518110610b3d57610b3d611b84565b602002602001015190506040518060400160405280828152602001610b6183611115565b90529392505050565b60006107918260200151600081518110610b8657610b86611b84565b6020026020010151611405565b600061079182600001516005815181106107b3576107b3611b84565b6060610791826000015160078151811061078457610784611b84565b600080610bff8460408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b90506000610c0c82611115565b905060608085600080610c1e8b6107c0565b90508051600003610c39576000975050505050505050610e6c565b60005b8651811015610e63578151831115610c5f57600098505050505050505050610e6c565b610c81878281518110610c7457610c74611b84565b602002602001015161141f565b955085805190602001208414610ca257600098505050505050505050610e6c565b610cb7878281518110610b1b57610b1b611b84565b94508451601103610d895781518303610d16578c80519060200120610ce88660108151811061078457610784611b84565b8051906020012003610d0557600198505050505050505050610e6c565b600098505050505050505050610e6c565b6000828481518110610d2a57610d2a611b84565b016020015160f81c90506010811115610d4f5760009950505050505050505050610e6c565b610d74868260ff1681518110610d6757610d67611b84565b602002602001015161149e565b9450610d81600185611bda565b935050610e5b565b8451600203610d05576000610db4610dad8760008151811061078457610784611b84565b84866114cc565b8351909150610dc38286611bda565b03610e16578d80519060200120610de68760018151811061078457610784611b84565b8051906020012003610e045760019950505050505050505050610e6c565b60009950505050505050505050610e6c565b80600003610e305760009950505050505050505050610e6c565b610e3a8185611bda565b9350610e5286600181518110610d6757610d67611b84565b9450610e5b9050565b600101610c3c565b50505050505050505b949350505050565b600061079182600001516003815181106107b3576107b3611b84565b600061079182600001516004815181106107b3576107b3611b84565b600061079182600001516000815181106107b3576107b3611b84565b6060610791826000015160018151811061078457610784611b84565b6001546040516320a9cea560e11b8152600481018490526000918291829182916001600160a01b03909116906341539d4a9060240160a060405180830381865afa158015610f36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5a9190611bed565b5093505092509250610fb1828b610f719190611bc7565b6040805160208082018f90528183018e9052606082018d905260808083018d90528351808403909101815260a090920190925280519101209085886115c9565b610ffd5760405162461bcd60e51b815260206004820152601c60248201527f4678526f6f7454756e6e656c3a20494e56414c49445f4845414445520000000060448201526064016100fc565b9998505050505050505050565b604080516020810190915260608152604051806020016040528061103e8460200151600181518110610b1b57610b1b611b84565b905292915050565b6040805180820190915260008082526020820152825180518390811061106e5761106e611b84565b6020026020010151905092915050565b80516000901580159061109357508151602110155b61109c57600080fd5b60006110ab8360200151611731565b905060008184600001516110bf9190611bc7565b90506000808386602001516110d49190611bda565b90508051915060208310156110f057826020036101000a820491505b50949350505050565b6060610791826020015160028151811061078457610784611b84565b60606111208261133f565b61112957600080fd5b6000611134836117b3565b905060008167ffffffffffffffff8111156111515761115161196f565b60405190808252806020026020018201604052801561119657816020015b604080518082019091526000808252602082015281526020019060019003908161116f5790505b50905060006111a88560200151611731565b85602001516111b79190611bda565b90506000805b84811015611216576111ce83611838565b91506040518060400160405280838152602001848152508482815181106111f7576111f7611b84565b602090810291909101015261120c8284611bda565b92506001016111bd565b509195945050505050565b805160609061122f57600080fd5b600061123e8360200151611731565b905060008184600001516112529190611bc7565b905060008167ffffffffffffffff81111561126f5761126f61196f565b6040519080825280601f01601f191660200182016040528015611299576020820181803683370190505b50905060008160200190506110f08487602001516112b79190611bda565b82856118dc565b60006112cb600284611c50565b15611305576010826112de600286611c64565b815181106112ee576112ee611b84565b0160200151611300919060f81c611c78565b611335565b601082611313600286611c64565b8151811061132357611323611b84565b0160200151611335919060f81c611c9a565b60f81b9392505050565b8051600090810361135257506000919050565b6020820151805160001a9060c0821015611370575060009392505050565b5060019392505050565b8060000361138757505050565b602081106113bf578251825261139e602084611bda565b92506113ab602083611bda565b91506113b8602082611bc7565b9050611387565b806000036113cc57505050565b600060016113db836020611bc7565b6113e790610100611da0565b6113f19190611bc7565b935183518516941916939093179091525050565b805160009060151461141657600080fd5b6107918261107e565b60606000826000015167ffffffffffffffff8111156114405761144061196f565b6040519080825280601f01601f19166020018201604052801561146a576020820181803683370190505b509050805160000361147c5792915050565b600081602001905061149784602001518286600001516118dc565b5092915050565b80516000906021146114af57600080fd5b600080836020015160016114c39190611bda565b51949350505050565b600080806114d9866107c0565b90506000815167ffffffffffffffff8111156114f7576114f761196f565b6040519080825280601f01601f191660200182016040528015611521576020820181803683370190505b509050845b82516115329087611bda565b81101561159a57600087828151811061154d5761154d611b84565b01602001516001600160f81b0319169050808361156a8985611bc7565b8151811061157a5761157a611b84565b60200101906001600160f81b031916908160001a90535050600101611526565b5080805190602001208280519060200120036115b957815192506115be565b600092505b509095945050505050565b6000602082516115d99190611c50565b1561161d5760405162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c840e0e4dedecc40d8cadccee8d60631b60448201526064016100fc565b60006020835161162d9190611c64565b905061163a816002611da0565b85106116805760405162461bcd60e51b81526020600482015260156024820152744c65616620696e64657820697320746f6f2062696760581b60448201526064016100fc565b60008660205b855181116117235785810151925061169f600289611c50565b6000036116d7576040805160208101849052908101849052606001604051602081830303815290604052805190602001209150611704565b60408051602081018590529081018390526060016040516020818303038152906040528051906020012091505b61170f600289611c64565b975061171c602082611bda565b9050611686565b509094149695505050505050565b8051600090811a608081101561174a5750600092915050565b60b8811080611765575060c08110801590611765575060f881105b156117735750600192915050565b60c08110156117a757611788600160b8611dac565b6117959060ff1682611bc7565b6117a0906001611bda565b9392505050565b611788600160f8611dac565b805160009081036117c657506000919050565b6000806117d68460200151611731565b84602001516117e59190611bda565b90506000846000015185602001516117fd9190611bda565b90505b8082101561182f5761181182611838565b61181b9083611bda565b91508261182781611dc5565b935050611800565b50909392505050565b80516000908190811a60808110156118535760019150611497565b60b881101561187957611867608082611bc7565b611872906001611bda565b9150611497565b60c08110156118a65760b78103600185019450806020036101000a85510460018201810193505050611497565b60f88110156118ba5761186760c082611bc7565b60019390930151602084900360f7016101000a900490920160f5190192915050565b806000036118e957505050565b602081106113bf5782518252611900602084611bda565b925061190d602083611bda565b915061191a602082611bc7565b90506118e9565b60006020828403121561193357600080fd5b5035919050565b6001600160a01b038116811461194f57600080fd5b50565b60006020828403121561196457600080fd5b81356117a08161193a565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156119ae576119ae61196f565b604052919050565b600067ffffffffffffffff8211156119d0576119d061196f565b50601f01601f191660200190565b6000602082840312156119f057600080fd5b813567ffffffffffffffff811115611a0757600080fd5b8201601f81018413611a1857600080fd5b8035611a2b611a26826119b6565b611985565b818152856020838501011115611a4057600080fd5b81602084016020830137600091810160200191909152949350505050565b60005b83811015611a79578181015183820152602001611a61565b50506000910152565b60018060a01b03831681526040602082015260008251806040840152611aaf816060850160208701611a5e565b601f01601f1916919091016060019392505050565b83815260008351611adc816020850160208801611a5e565b60209201918201929092526040019392505050565b600060208284031215611b0357600080fd5b815167ffffffffffffffff811115611b1a57600080fd5b8201601f81018413611b2b57600080fd5b8051611b39611a26826119b6565b818152856020838501011115611b4e57600080fd5b611b5f826020830160208601611a5e565b95945050505050565b60008251611b7a818460208701611a5e565b9190910192915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761079157610791611b9a565b8181038181111561079157610791611b9a565b8082018082111561079157610791611b9a565b600080600080600060a08688031215611c0557600080fd5b855194506020860151935060408601519250606086015191506080860151611c2c8161193a565b809150509295509295909350565b634e487b7160e01b600052601260045260246000fd5b600082611c5f57611c5f611c3a565b500690565b600082611c7357611c73611c3a565b500490565b600060ff831680611c8b57611c8b611c3a565b8060ff84160691505092915050565b600060ff831680611cad57611cad611c3a565b8060ff84160491505092915050565b600181815b80851115611cf7578160001904821115611cdd57611cdd611b9a565b80851615611cea57918102915b93841c9390800290611cc1565b509250929050565b600082611d0e57506001610791565b81611d1b57506000610791565b8160018114611d315760028114611d3b57611d57565b6001915050610791565b60ff841115611d4c57611d4c611b9a565b50506001821b610791565b5060208310610133831016604e8410600b8410161715611d7a575081810a610791565b611d848383611cbc565b8060001904821115611d9857611d98611b9a565b029392505050565b60006117a08383611cff565b60ff828116828216039081111561079157610791611b9a565b600060018201611dd757611dd7611b9a565b506001019056fea26469706673582212206aa6d8e79df3a7e1b44aff6f48f9f543772a7c0f9a543b39340b51f9deefeb9864736f6c63430008170033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.