More Info
Private Name Tags
ContractCreator:
Sponsored
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xf2A1C557...CBcc51d7e The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
L2_PolygonMessengerProxy
Compiler Version
v0.7.3+commit.9bfce1f6
Contract Source Code (Solidity)
/** *Submitted for verification at polygonscan.com on 2021-07-21 */ // SPDX-License-Identifier: MIT // @unsupported: ovm pragma solidity 0.7.3; pragma experimental ABIEncoderV2; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor () internal { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // File contracts/polygon/tunnel/FxBaseChildTunnel.sol // IFxMessageProcessor represents interface to process message interface IFxMessageProcessor { function processMessageFromRoot(uint256 stateId, address rootMessageSender, bytes calldata data) external; } /** * @notice Mock child tunnel contract to receive and send message from L2 */ abstract contract FxBaseChildTunnel is IFxMessageProcessor{ // MessageTunnel on L1 will get data from this event event MessageSent(bytes message); // fx child address public fxChild; // fx root tunnel address public fxRootTunnel; constructor(address _fxChild) { fxChild = _fxChild; } // Sender must be fxRootTunnel in case of ERC20 tunnel modifier validateSender(address sender) { require(sender == fxRootTunnel, "FxBaseChildTunnel: INVALID_SENDER_FROM_ROOT"); _; } // set fxRootTunnel if not set already function setFxRootTunnel(address _fxRootTunnel) public { require(fxRootTunnel == address(0x0), "FxBaseChildTunnel: ROOT_TUNNEL_ALREADY_SET"); fxRootTunnel = _fxRootTunnel; } function processMessageFromRoot(uint256 stateId, address rootMessageSender, bytes calldata data) public override { require(msg.sender == fxChild, "FxBaseChildTunnel: INVALID_SENDER"); _processMessageFromRoot(stateId, rootMessageSender, data); } /** * @notice Emit message that can be received on Root Tunnel * @dev Call the internal function when need to emit message * @param message bytes message that will be sent to Root Tunnel * some message examples - * abi.encode(tokenId); * abi.encode(tokenId, tokenMetadata); * abi.encode(messageType, messageData); */ function _sendMessageToRoot(bytes memory message) internal { emit MessageSent(message); } /** * @notice Process message received from Root 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 stateId unique state id * @param sender root message sender * @param message bytes message that was sent from Root Tunnel */ function _processMessageFromRoot(uint256 stateId, address sender, bytes memory message) virtual internal; } contract L2_PolygonMessengerProxy is FxBaseChildTunnel, ReentrancyGuard { address public l2Bridge; address public xDomainMessageSender; address constant public DEAD_ADDRESS = 0x000000000000000000000000000000000000dEaD; modifier onlyL2Bridge { require(msg.sender == l2Bridge, "L2_PLGN_MSG: Sender must be the L2 Bridge"); _; } constructor(address _fxChild) public FxBaseChildTunnel(_fxChild) { xDomainMessageSender = DEAD_ADDRESS; } function setL2Bridge(address _l2Bridge) external { require(l2Bridge == address(0), "L2_PLGN_MSG: L2 Bridge already set"); l2Bridge = _l2Bridge; } function sendCrossDomainMessage(bytes memory message) external onlyL2Bridge { _sendMessageToRoot(message); } function _processMessageFromRoot( uint256 /* stateId */, address sender, bytes memory data ) internal override validateSender(sender) nonReentrant { (address l1Sender, bytes memory message) = abi.decode(data, (address, bytes)); xDomainMessageSender = l1Sender; (bool success,) = l2Bridge.call(message); require(success, "L2_PLGN_MSG: Failed to proxy message"); xDomainMessageSender = DEAD_ADDRESS; } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_fxChild","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"}],"name":"MessageSent","type":"event"},{"inputs":[],"name":"DEAD_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fxChild","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fxRootTunnel","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l2Bridge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"stateId","type":"uint256"},{"internalType":"address","name":"rootMessageSender","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"processMessageFromRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"message","type":"bytes"}],"name":"sendCrossDomainMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_fxRootTunnel","type":"address"}],"name":"setFxRootTunnel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_l2Bridge","type":"address"}],"name":"setL2Bridge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"xDomainMessageSender","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100a35760003560e01c80636e296e4511610076578063888370941161005b57806388837094146101065780639a7c4b7114610119578063ae1f6aaf1461012c576100a3565b80636e296e45146100f65780637f1e9cb0146100fe576100a3565b80633d36d971146100a8578063419cb550146100bd578063450d11f0146100d05780634e6fd6c4146100ee575b600080fd5b6100bb6100b63660046105da565b610134565b005b6100bb6100cb36600461068b565b6101d4565b6100d8610231565b6040516100e5919061079f565b60405180910390f35b6100d861024d565b6100d8610253565b6100d861026f565b6100bb6101143660046105da565b61028b565b6100bb6101273660046106ff565b610322565b6100d86103ba565b60035473ffffffffffffffffffffffffffffffffffffffff161561018d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161018490610985565b60405180910390fd5b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60035473ffffffffffffffffffffffffffffffffffffffff163314610225576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101849061086e565b61022e816103d6565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b61dead81565b60045473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff16156102db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161018490610a19565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610373576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161018490610811565b6103b4848484848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061041092505050565b50505050565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b7f8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b0368160405161040591906107c0565b60405180910390a150565b600154829073ffffffffffffffffffffffffffffffffffffffff808316911614610466576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610184906108cb565b6002805414156104a2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610184906109e2565b6002808190555060006060838060200190518101906104c191906105fd565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84811691909117909155600354604051939550919350600092911690610523908490610783565b6000604051808303816000865af19150503d8060008114610560576040519150601f19603f3d011682016040523d82523d6000602084013e610565565b606091505b50509050806105a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161018490610928565b5050600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001661dead17905550506001600255505050565b6000602082840312156105eb578081fd5b81356105f681610b06565b9392505050565b6000806040838503121561060f578081fd5b825161061a81610b06565b602084015190925067ffffffffffffffff811115610636578182fd5b8301601f81018513610646578182fd5b805161065961065482610a9a565b610a76565b81815286602083850101111561066d578384fd5b61067e826020830160208601610ada565b8093505050509250929050565b60006020828403121561069c578081fd5b813567ffffffffffffffff8111156106b2578182fd5b8201601f810184136106c2578182fd5b80356106d061065482610a9a565b8181528560208385010111156106e4578384fd5b81602084016020830137908101602001929092525092915050565b60008060008060608587031215610714578182fd5b84359350602085013561072681610b06565b9250604085013567ffffffffffffffff80821115610742578384fd5b818701915087601f830112610755578384fd5b813581811115610763578485fd5b886020828501011115610774578485fd5b95989497505060200194505050565b60008251610795818460208701610ada565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b60006020825282518060208401526107df816040850160208701610ada565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60208082526021908201527f4678426173654368696c6454756e6e656c3a20494e56414c49445f53454e444560408201527f5200000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526029908201527f4c325f504c474e5f4d53473a2053656e646572206d757374206265207468652060408201527f4c32204272696467650000000000000000000000000000000000000000000000606082015260800190565b6020808252602b908201527f4678426173654368696c6454756e6e656c3a20494e56414c49445f53454e444560408201527f525f46524f4d5f524f4f54000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f4c325f504c474e5f4d53473a204661696c656420746f2070726f7879206d657360408201527f7361676500000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526022908201527f4c325f504c474e5f4d53473a204c322042726964676520616c7265616479207360408201527f6574000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252602a908201527f4678426173654368696c6454756e6e656c3a20524f4f545f54554e4e454c5f4160408201527f4c52454144595f53455400000000000000000000000000000000000000000000606082015260800190565b60405181810167ffffffffffffffff81118282101715610a9257fe5b604052919050565b600067ffffffffffffffff821115610aae57fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b83811015610af5578181015183820152602001610add565b838111156103b45750506000910152565b73ffffffffffffffffffffffffffffffffffffffff8116811461022e57600080fdfea264697066735822122061515db5548807583c16ad007751398fda7245d741f1026f2efe9e5bfd9a24ab64736f6c63430007030033
Deployed Bytecode Sourcemap
5223:1340:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5732:168;;;;;;:::i;:::-;;:::i;:::-;;5908:122;;;;;;:::i;:::-;;:::i;3262:22::-;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;5378:81;;;:::i;5334:35::-;;;:::i;3316:27::-;;;:::i;3688:196::-;;;;;;:::i;:::-;;:::i;3892:267::-;;;;;;:::i;:::-;;:::i;5304:23::-;;;:::i;5732:168::-;5800:8;;:22;:8;:22;5792:69;;;;;;;;;;;;:::i;:::-;;;;;;;;;5872:8;:20;;;;;;;;;;;;;;;5732:168::o;5908:122::-;5523:8;;;;5509:10;:22;5501:76;;;;;;;;;;;;:::i;:::-;5995:27:::1;6014:7;5995:18;:27::i;:::-;5908:122:::0;:::o;3262:22::-;;;;;;:::o;5378:81::-;5417:42;5378:81;:::o;5334:35::-;;;;;;:::o;3316:27::-;;;;;;:::o;3688:196::-;3762:12;;:28;:12;:28;3754:83;;;;;;;;;;;;:::i;:::-;3848:12;:28;;;;;;;;;;;;;;;3688:196::o;3892:267::-;4038:7;;;;4024:10;:21;4016:67;;;;;;;;;;;;:::i;:::-;4094:57;4118:7;4127:17;4146:4;;4094:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4094:23:0;;-1:-1:-1;;;4094:57:0:i;:::-;3892:267;;;;:::o;5304:23::-;;;;;;:::o;4543:103::-;4618:20;4630:7;4618:20;;;;;;:::i;:::-;;;;;;;;4543:103;:::o;6038:522::-;3556:12;;6223:6;;3556:12;3546:22;;;3556:12;;3546:22;3538:78;;;;;;;;;;;;:::i;:::-;1767:1:::1;2373:7:::0;::::1;:19;;2365:63;;;;;;;;;;;;:::i;:::-;1767:1;2506:7:::0;:18:::1;;;;6270:16:::2;6288:20;6323:4;6312:34;;;;;;;;;;;;:::i;:::-;6357:20;:31:::0;;;::::2;;::::0;;::::2;::::0;;;::::2;::::0;;;6417:8:::2;::::0;:22:::2;::::0;6357:31;;-1:-1:-1;6269:77:0;;-1:-1:-1;;;6417:8:0;::::2;::::0;:22:::2;::::0;6269:77;;6417:22:::2;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6399:40;;;6458:7;6450:56;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;;6517:20:0::2;:35:::0;;;::::2;5417:42;6517:35;::::0;;-1:-1:-1;;6517:35:0;2685:7:::1;:22:::0;-1:-1:-1;;;6038:522:0:o;14:259:1:-;;126:2;114:9;105:7;101:23;97:32;94:2;;;147:6;139;132:22;94:2;191:9;178:23;210:33;237:5;210:33;:::i;:::-;262:5;84:189;-1:-1:-1;;;84:189:1:o;278:833::-;;;435:2;423:9;414:7;410:23;406:32;403:2;;;456:6;448;441:22;403:2;493:9;487:16;512:33;539:5;512:33;:::i;:::-;613:2;598:18;;592:25;564:5;;-1:-1:-1;640:18:1;629:30;;626:2;;;677:6;669;662:22;626:2;705:22;;758:4;750:13;;746:27;-1:-1:-1;736:2:1;;792:6;784;777:22;736:2;830;824:9;855:53;870:37;900:6;870:37;:::i;:::-;855:53;:::i;:::-;931:6;924:5;917:21;979:7;974:2;965:6;961:2;957:15;953:24;950:37;947:2;;;1005:6;997;990:22;947:2;1023:58;1074:6;1069:2;1062:5;1058:14;1053:2;1049;1045:11;1023:58;:::i;:::-;1100:5;1090:15;;;;;393:718;;;;;:::o;1116:741::-;;1237:2;1225:9;1216:7;1212:23;1208:32;1205:2;;;1258:6;1250;1243:22;1205:2;1303:9;1290:23;1336:18;1328:6;1325:30;1322:2;;;1373:6;1365;1358:22;1322:2;1401:22;;1454:4;1446:13;;1442:27;-1:-1:-1;1432:2:1;;1488:6;1480;1473:22;1432:2;1533;1520:16;1558:53;1573:37;1603:6;1573:37;:::i;1558:53::-;1634:6;1627:5;1620:21;1682:7;1677:2;1668:6;1664:2;1660:15;1656:24;1653:37;1650:2;;;1708:6;1700;1693:22;1650:2;1768:6;1763:2;1759;1755:11;1750:2;1743:5;1739:14;1726:49;1795:18;;;1815:2;1791:27;1784:43;;;;-1:-1:-1;1799:5:1;1195:662;-1:-1:-1;;1195:662:1:o;1862:846::-;;;;;2027:2;2015:9;2006:7;2002:23;1998:32;1995:2;;;2048:6;2040;2033:22;1995:2;2089:9;2076:23;2066:33;;2149:2;2138:9;2134:18;2121:32;2162:33;2189:5;2162:33;:::i;:::-;2214:5;-1:-1:-1;2270:2:1;2255:18;;2242:32;2293:18;2323:14;;;2320:2;;;2355:6;2347;2340:22;2320:2;2398:6;2387:9;2383:22;2373:32;;2443:7;2436:4;2432:2;2428:13;2424:27;2414:2;;2470:6;2462;2455:22;2414:2;2515;2502:16;2541:2;2533:6;2530:14;2527:2;;;2562:6;2554;2547:22;2527:2;2612:7;2607:2;2598:6;2594:2;2590:15;2586:24;2583:37;2580:2;;;2638:6;2630;2623:22;2580:2;1985:723;;;;-1:-1:-1;;2674:2:1;2666:11;;-1:-1:-1;;;1985:723:1:o;2713:274::-;;2880:6;2874:13;2896:53;2942:6;2937:3;2930:4;2922:6;2918:17;2896:53;:::i;:::-;2965:16;;;;;2850:137;-1:-1:-1;;2850:137:1:o;2992:226::-;3168:42;3156:55;;;;3138:74;;3126:2;3111:18;;3093:125::o;3223:440::-;;3370:2;3359:9;3352:21;3402:6;3396:13;3445:6;3440:2;3429:9;3425:18;3418:34;3461:66;3520:6;3515:2;3504:9;3500:18;3495:2;3487:6;3483:15;3461:66;:::i;:::-;3579:2;3567:15;3584:66;3563:88;3548:104;;;;3654:2;3544:113;;3342:321;-1:-1:-1;;3342:321:1:o;3668:397::-;3870:2;3852:21;;;3909:2;3889:18;;;3882:30;3948:34;3943:2;3928:18;;3921:62;4019:3;4014:2;3999:18;;3992:31;4055:3;4040:19;;3842:223::o;4070:405::-;4272:2;4254:21;;;4311:2;4291:18;;;4284:30;4350:34;4345:2;4330:18;;4323:62;4421:11;4416:2;4401:18;;4394:39;4465:3;4450:19;;4244:231::o;4480:407::-;4682:2;4664:21;;;4721:2;4701:18;;;4694:30;4760:34;4755:2;4740:18;;4733:62;4831:13;4826:2;4811:18;;4804:41;4877:3;4862:19;;4654:233::o;4892:400::-;5094:2;5076:21;;;5133:2;5113:18;;;5106:30;5172:34;5167:2;5152:18;;5145:62;5243:6;5238:2;5223:18;;5216:34;5282:3;5267:19;;5066:226::o;5297:398::-;5499:2;5481:21;;;5538:2;5518:18;;;5511:30;5577:34;5572:2;5557:18;;5550:62;5648:4;5643:2;5628:18;;5621:32;5685:3;5670:19;;5471:224::o;5700:355::-;5902:2;5884:21;;;5941:2;5921:18;;;5914:30;5980:33;5975:2;5960:18;;5953:61;6046:2;6031:18;;5874:181::o;6060:406::-;6262:2;6244:21;;;6301:2;6281:18;;;6274:30;6340:34;6335:2;6320:18;;6313:62;6411:12;6406:2;6391:18;;6384:40;6456:3;6441:19;;6234:232::o;6471:242::-;6541:2;6535:9;6571:17;;;6618:18;6603:34;;6639:22;;;6600:62;6597:2;;;6665:9;6597:2;6692;6685:22;6515:198;;-1:-1:-1;6515:198:1:o;6718:240::-;;6801:18;6793:6;6790:30;6787:2;;;6823:9;6787:2;-1:-1:-1;6871:4:1;6859:17;6878:66;6855:90;6947:4;6851:101;;6777:181::o;6963:258::-;7035:1;7045:113;7059:6;7056:1;7053:13;7045:113;;;7135:11;;;7129:18;7116:11;;;7109:39;7081:2;7074:10;7045:113;;;7176:6;7173:1;7170:13;7167:2;;;-1:-1:-1;;7211:1:1;7193:16;;7186:27;7016:205::o;7226:156::-;7314:42;7307:5;7303:54;7296:5;7293:65;7283:2;;7372:1;7369;7362:12
Swarm Source
ipfs://61515db5548807583c16ad007751398fda7245d741f1026f2efe9e5bfd9a24ab
Loading...
Loading
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.