Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
XDaiMessengerWrapper
Compiler Version
v0.6.12+commit.27d51765
Optimization Enabled:
Yes with 50000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "../interfaces/xDai/messengers/IArbitraryMessageBridge.sol";
import "./MessengerWrapper.sol";
/**
* @dev A MessengerWrapper for xDai - https://www.xdaichain.com/ (also see https://docs.tokenbridge.net/)
* @notice Deployed on layer-1
*/
contract XDaiMessengerWrapper is MessengerWrapper {
IArbitraryMessageBridge public l1MessengerAddress;
/// @notice The xDai AMB uses bytes32 for chainId instead of uint256
bytes32 public l2ChainId;
address public ambBridge;
address public immutable l2BridgeAddress;
uint256 public immutable defaultGasLimit;
constructor(
address _l1BridgeAddress,
address _l2BridgeAddress,
IArbitraryMessageBridge _l1MessengerAddress,
uint256 _defaultGasLimit,
uint256 _l2ChainId,
address _ambBridge
)
public
MessengerWrapper(_l1BridgeAddress)
{
l2BridgeAddress = _l2BridgeAddress;
l1MessengerAddress = _l1MessengerAddress;
defaultGasLimit = _defaultGasLimit;
l2ChainId = bytes32(_l2ChainId);
ambBridge = _ambBridge;
}
/**
* @dev Sends a message to the l2BridgeAddress from layer-1
* @param _calldata The data that l2BridgeAddress will be called with
*/
function sendCrossDomainMessage(bytes memory _calldata) public override onlyL1Bridge {
l1MessengerAddress.requireToPassMessage(
l2BridgeAddress,
_calldata,
defaultGasLimit
);
}
/// @notice message data is not needed for message verification with the xDai AMB
function verifySender(address l1BridgeCaller, bytes memory) public override {
require(l1MessengerAddress.messageSender() == l2BridgeAddress, "L2_XDAI_BRG: Invalid cross-domain sender");
require(l1BridgeCaller == ambBridge, "L2_XDAI_BRG: Caller is not the expected sender");
// With the xDai AMB, it is best practice to also check the source chainId
// https://docs.tokenbridge.net/amb-bridge/how-to-develop-xchain-apps-by-amb#receive-a-method-call-from-the-amb-bridge
require(l1MessengerAddress.messageSourceChainId() == l2ChainId, "L2_XDAI_BRG: Invalid source Chain ID");
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
interface IArbitraryMessageBridge {
function messageSender() external view returns (address);
function maxGasPerTx() external view returns (uint256);
function transactionHash() external view returns (bytes32);
function messageId() external view returns (bytes32);
function messageSourceChainId() external view returns (bytes32);
function messageCallStatus(bytes32 _messageId) external view returns (bool);
function failedMessageDataHash(bytes32 _messageId) external view returns (bytes32);
function failedMessageReceiver(bytes32 _messageId) external view returns (address);
function failedMessageSender(bytes32 _messageId) external view returns (address);
function requireToPassMessage(address _contract, bytes memory _data, uint256 _gas) external returns (bytes32);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12 <0.8.0;
pragma experimental ABIEncoderV2;
import "../interfaces/IMessengerWrapper.sol";
abstract contract MessengerWrapper is IMessengerWrapper {
address public immutable l1BridgeAddress;
constructor(address _l1BridgeAddress) internal {
l1BridgeAddress = _l1BridgeAddress;
}
modifier onlyL1Bridge {
require(msg.sender == l1BridgeAddress, "MW: Sender must be the L1 Bridge");
_;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12 <0.8.0;
pragma experimental ABIEncoderV2;
interface IMessengerWrapper {
function sendCrossDomainMessage(bytes memory _calldata) external;
function verifySender(address l1BridgeCaller, bytes memory _data) external;
}{
"optimizer": {
"enabled": true,
"runs": 50000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_l1BridgeAddress","type":"address"},{"internalType":"address","name":"_l2BridgeAddress","type":"address"},{"internalType":"contract IArbitraryMessageBridge","name":"_l1MessengerAddress","type":"address"},{"internalType":"uint256","name":"_defaultGasLimit","type":"uint256"},{"internalType":"uint256","name":"_l2ChainId","type":"uint256"},{"internalType":"address","name":"_ambBridge","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ambBridge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultGasLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l1BridgeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l1MessengerAddress","outputs":[{"internalType":"contract IArbitraryMessageBridge","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l2BridgeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l2ChainId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_calldata","type":"bytes"}],"name":"sendCrossDomainMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"l1BridgeCaller","type":"address"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"verifySender","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60e060405234801561001057600080fd5b50604051610a79380380610a7983398101604081905261002f91610089565b6001600160601b0319606096871b81166080529490951b90931660a052600080546001600160a01b039384166001600160a01b03199182161790915560c09190915260019290925560028054919093169116179055610114565b60008060008060008060c087890312156100a1578182fd5b86516100ac816100fc565b60208801519096506100bd816100fc565b60408801519095506100ce816100fc565b80945050606087015192506080870151915060a08701516100ee816100fc565b809150509295509295509295565b6001600160a01b038116811461011157600080fd5b50565b60805160601c60a05160601c60c05161091f61015a6000398061020e52806102d65250806101ea52806102b2528061033b52508061013c528061028e525061091f6000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806395368d2e1161005b57806395368d2e146100d057806399178dd8146100e5578063c5deebb3146100f8578063d6ae3cd51461010057610088565b80630ba54df61461008d578063419cb550146100ab5780635ab2a558146100c0578063934746a7146100c8575b600080fd5b610095610108565b6040516100a291906106b7565b60405180910390f35b6100be6100b936600461067c565b610124565b005b61009561028c565b6100956102b0565b6100d86102d4565b6040516100a2919061076f565b6100be6100f3366004610616565b6102f8565b610095610535565b6100d8610551565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461019c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161019390610832565b60405180910390fd5b6000546040517fdc8601b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063dc8601b390610236907f00000000000000000000000000000000000000000000000000000000000000009085907f0000000000000000000000000000000000000000000000000000000000000000906004016106d8565b602060405180830381600087803b15801561025057600080fd5b505af1158015610264573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102889190610664565b5050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b600054604080517fd67bdd25000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811693169163d67bdd25916004808301926020929190829003018186803b15801561038457600080fd5b505afa158015610398573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103bc91906105f3565b73ffffffffffffffffffffffffffffffffffffffff1614610409576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610193906107d5565b60025473ffffffffffffffffffffffffffffffffffffffff83811691161461045d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161019390610867565b60015460008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639e307dff6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104c657600080fd5b505afa1580156104da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fe9190610664565b14610288576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161019390610778565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b600082601f830112610567578081fd5b813567ffffffffffffffff8082111561057e578283fd5b60405160207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f85011682010181811083821117156105bc578485fd5b6040528281529250828483016020018610156105d757600080fd5b8260208601602083013760006020848301015250505092915050565b600060208284031215610604578081fd5b815161060f816108c4565b9392505050565b60008060408385031215610628578081fd5b8235610633816108c4565b9150602083013567ffffffffffffffff81111561064e578182fd5b61065a85828601610557565b9150509250929050565b600060208284031215610675578081fd5b5051919050565b60006020828403121561068d578081fd5b813567ffffffffffffffff8111156106a3578182fd5b6106af84828501610557565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600073ffffffffffffffffffffffffffffffffffffffff8516825260206060818401528451806060850152825b8181101561072157868101830151858201608001528201610705565b818111156107325783608083870101525b5060408401949094525050601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160160800192915050565b90815260200190565b60208082526024908201527f4c325f584441495f4252473a20496e76616c696420736f75726365204368616960408201527f6e20494400000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f4c325f584441495f4252473a20496e76616c69642063726f73732d646f6d616960408201527f6e2073656e646572000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4d573a2053656e646572206d75737420626520746865204c3120427269646765604082015260600190565b6020808252602e908201527f4c325f584441495f4252473a2043616c6c6572206973206e6f7420746865206560408201527f787065637465642073656e646572000000000000000000000000000000000000606082015260800190565b73ffffffffffffffffffffffffffffffffffffffff811681146108e657600080fd5b5056fea26469706673582212209ba34c69c3a16414a15e55660de73a7d3861a5ad5352b1ad698466ea9b94538264736f6c634300060c0033000000000000000000000000b8901acb165ed027e32754e0ffe830802919727f000000000000000000000000d8926c12c0b2e5cd40cfda49ecaff40252af491b0000000000000000000000004c36d2919e407f0cc2ee3c993ccf8ac26d9ce64e00000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000640000000000000000000000004c36d2919e407f0cc2ee3c993ccf8ac26d9ce64e
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100885760003560e01c806395368d2e1161005b57806395368d2e146100d057806399178dd8146100e5578063c5deebb3146100f8578063d6ae3cd51461010057610088565b80630ba54df61461008d578063419cb550146100ab5780635ab2a558146100c0578063934746a7146100c8575b600080fd5b610095610108565b6040516100a291906106b7565b60405180910390f35b6100be6100b936600461067c565b610124565b005b61009561028c565b6100956102b0565b6100d86102d4565b6040516100a2919061076f565b6100be6100f3366004610616565b6102f8565b610095610535565b6100d8610551565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000b8901acb165ed027e32754e0ffe830802919727f161461019c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161019390610832565b60405180910390fd5b6000546040517fdc8601b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063dc8601b390610236907f000000000000000000000000d8926c12c0b2e5cd40cfda49ecaff40252af491b9085907f00000000000000000000000000000000000000000000000000000000000f4240906004016106d8565b602060405180830381600087803b15801561025057600080fd5b505af1158015610264573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102889190610664565b5050565b7f000000000000000000000000b8901acb165ed027e32754e0ffe830802919727f81565b7f000000000000000000000000d8926c12c0b2e5cd40cfda49ecaff40252af491b81565b7f00000000000000000000000000000000000000000000000000000000000f424081565b600054604080517fd67bdd25000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000d8926c12c0b2e5cd40cfda49ecaff40252af491b811693169163d67bdd25916004808301926020929190829003018186803b15801561038457600080fd5b505afa158015610398573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103bc91906105f3565b73ffffffffffffffffffffffffffffffffffffffff1614610409576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610193906107d5565b60025473ffffffffffffffffffffffffffffffffffffffff83811691161461045d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161019390610867565b60015460008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639e307dff6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104c657600080fd5b505afa1580156104da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fe9190610664565b14610288576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161019390610778565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b600082601f830112610567578081fd5b813567ffffffffffffffff8082111561057e578283fd5b60405160207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f85011682010181811083821117156105bc578485fd5b6040528281529250828483016020018610156105d757600080fd5b8260208601602083013760006020848301015250505092915050565b600060208284031215610604578081fd5b815161060f816108c4565b9392505050565b60008060408385031215610628578081fd5b8235610633816108c4565b9150602083013567ffffffffffffffff81111561064e578182fd5b61065a85828601610557565b9150509250929050565b600060208284031215610675578081fd5b5051919050565b60006020828403121561068d578081fd5b813567ffffffffffffffff8111156106a3578182fd5b6106af84828501610557565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600073ffffffffffffffffffffffffffffffffffffffff8516825260206060818401528451806060850152825b8181101561072157868101830151858201608001528201610705565b818111156107325783608083870101525b5060408401949094525050601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160160800192915050565b90815260200190565b60208082526024908201527f4c325f584441495f4252473a20496e76616c696420736f75726365204368616960408201527f6e20494400000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f4c325f584441495f4252473a20496e76616c69642063726f73732d646f6d616960408201527f6e2073656e646572000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4d573a2053656e646572206d75737420626520746865204c3120427269646765604082015260600190565b6020808252602e908201527f4c325f584441495f4252473a2043616c6c6572206973206e6f7420746865206560408201527f787065637465642073656e646572000000000000000000000000000000000000606082015260800190565b73ffffffffffffffffffffffffffffffffffffffff811681146108e657600080fd5b5056fea26469706673582212209ba34c69c3a16414a15e55660de73a7d3861a5ad5352b1ad698466ea9b94538264736f6c634300060c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000b8901acb165ed027e32754e0ffe830802919727f000000000000000000000000d8926c12c0b2e5cd40cfda49ecaff40252af491b0000000000000000000000004c36d2919e407f0cc2ee3c993ccf8ac26d9ce64e00000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000640000000000000000000000004c36d2919e407f0cc2ee3c993ccf8ac26d9ce64e
-----Decoded View---------------
Arg [0] : _l1BridgeAddress (address): 0xb8901acB165ed027E32754E0FFe830802919727f
Arg [1] : _l2BridgeAddress (address): 0xD8926c12C0B2E5Cd40cFdA49eCaFf40252Af491B
Arg [2] : _l1MessengerAddress (address): 0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e
Arg [3] : _defaultGasLimit (uint256): 1000000
Arg [4] : _l2ChainId (uint256): 100
Arg [5] : _ambBridge (address): 0x4C36d2919e407f0Cc2Ee3c993ccF8ac26d9CE64e
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000b8901acb165ed027e32754e0ffe830802919727f
Arg [1] : 000000000000000000000000d8926c12c0b2e5cd40cfda49ecaff40252af491b
Arg [2] : 0000000000000000000000004c36d2919e407f0cc2ee3c993ccf8ac26d9ce64e
Arg [3] : 00000000000000000000000000000000000000000000000000000000000f4240
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000064
Arg [5] : 0000000000000000000000004c36d2919e407f0cc2ee3c993ccf8ac26d9ce64e
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.