2021-09-29 21:39:30 +02:00
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
pragma solidity ^0.7.0;
|
|
|
|
|
2021-10-12 17:50:25 +02:00
|
|
|
import { IAMB } from "../interfaces/IBridge.sol";
|
2021-09-29 21:39:30 +02:00
|
|
|
|
|
|
|
contract MockAMB is IAMB {
|
|
|
|
address public xDomainMessageSender;
|
2021-10-04 12:06:58 +02:00
|
|
|
bytes32 public xDomainMessageChainId;
|
2021-09-29 21:39:30 +02:00
|
|
|
|
2021-10-04 12:06:58 +02:00
|
|
|
constructor(address _xDomainMessageSender, uint256 _xDomainMessageChainId) {
|
2021-09-29 21:39:30 +02:00
|
|
|
xDomainMessageSender = _xDomainMessageSender;
|
2021-10-04 12:06:58 +02:00
|
|
|
xDomainMessageChainId = bytes32(uint256(_xDomainMessageChainId));
|
2021-09-29 21:39:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function setMessageSender(address _sender) external {
|
|
|
|
xDomainMessageSender = _sender;
|
|
|
|
}
|
|
|
|
|
|
|
|
function messageSender() external view override returns (address) {
|
|
|
|
return xDomainMessageSender;
|
|
|
|
}
|
2021-10-04 12:06:58 +02:00
|
|
|
|
|
|
|
function messageSourceChainId() external view override returns (bytes32) {
|
|
|
|
return xDomainMessageChainId;
|
|
|
|
}
|
2021-10-05 11:08:04 +02:00
|
|
|
|
|
|
|
function execute(address _who, bytes calldata _calldata) external returns (bool success, bytes memory result) {
|
|
|
|
(success, result) = _who.call(_calldata);
|
2021-10-05 14:12:39 +02:00
|
|
|
require(success, string(result));
|
2021-10-05 11:08:04 +02:00
|
|
|
}
|
2021-09-29 21:39:30 +02:00
|
|
|
}
|