@@ -8,10 +8,9 @@ import "@openzeppelin/contracts/utils/Address.sol";
88 * @title BasicAMBMediator
99 * @dev Basic storage and methods needed by mediators to interact with AMB bridge.
1010 */
11- contract BasicAMBMediator is Ownable {
11+ abstract contract BasicAMBMediator is Ownable {
1212 bytes32 internal constant BRIDGE_CONTRACT = 0x811bbb11e8899da471f0e69a3ed55090fc90215227fc5fb1cb0d6e962ea7b74f ; // keccak256(abi.encodePacked("bridgeContract"))
1313 bytes32 internal constant MEDIATOR_CONTRACT = 0x98aa806e31e94a687a31c65769cb99670064dd7f5a87526da075c5fb4eab9880 ; // keccak256(abi.encodePacked("mediatorContract"))
14- bytes32 internal constant REQUEST_GAS_LIMIT = 0x2dfd6c9f781bb6bbb5369c114e949b69ebb440ef3d4dd6b2836225eb1dc3a2be ; // keccak256(abi.encodePacked("requestGasLimit"))
1514
1615 /**
1716 * @dev Throws if caller on the other side is not an associated mediator.
@@ -25,8 +24,9 @@ contract BasicAMBMediator is Ownable {
2524 * @dev Internal function for reducing onlyMediator modifier bytecode overhead.
2625 */
2726 function _onlyMediator () internal view {
28- require (msg .sender == address (bridgeContract ()));
29- require (messageSender () == mediatorContractOnOtherSide ());
27+ IAMB bridge = bridgeContract ();
28+ require (msg .sender == address (bridge));
29+ require (bridge.messageSender () == mediatorContractOnOtherSide ());
3030 }
3131
3232 /**
@@ -45,16 +45,6 @@ contract BasicAMBMediator is Ownable {
4545 _setMediatorContractOnOtherSide (_mediatorContract);
4646 }
4747
48- /**
49- * @dev Sets the gas limit to be used in the message execution by the AMB bridge on the other network.
50- * This value can't exceed the parameter maxGasPerTx defined on the AMB bridge.
51- * Only the owner can call this method.
52- * @param _requestGasLimit the gas limit for the message execution.
53- */
54- function setRequestGasLimit (uint256 _requestGasLimit ) external onlyOwner {
55- _setRequestGasLimit (_requestGasLimit);
56- }
57-
5848 /**
5949 * @dev Get the AMB interface for the bridge contract address
6050 * @return AMB interface for the bridge contract address
@@ -71,14 +61,6 @@ contract BasicAMBMediator is Ownable {
7161 return addressStorage[MEDIATOR_CONTRACT];
7262 }
7363
74- /**
75- * @dev Tells the gas limit to be used in the message execution by the AMB bridge on the other network.
76- * @return the gas limit for the message execution.
77- */
78- function requestGasLimit () public view returns (uint256 ) {
79- return uintStorage[REQUEST_GAS_LIMIT];
80- }
81-
8264 /**
8365 * @dev Stores a valid AMB bridge contract address.
8466 * @param _bridgeContract the address of the bridge contract.
@@ -96,24 +78,6 @@ contract BasicAMBMediator is Ownable {
9678 addressStorage[MEDIATOR_CONTRACT] = _mediatorContract;
9779 }
9880
99- /**
100- * @dev Stores the gas limit to be used in the message execution by the AMB bridge on the other network.
101- * @param _requestGasLimit the gas limit for the message execution.
102- */
103- function _setRequestGasLimit (uint256 _requestGasLimit ) internal {
104- require (_requestGasLimit <= maxGasPerTx ());
105- uintStorage[REQUEST_GAS_LIMIT] = _requestGasLimit;
106- }
107-
108- /**
109- * @dev Tells the address that generated the message on the other network that is currently being executed by
110- * the AMB bridge.
111- * @return the address of the message sender.
112- */
113- function messageSender () internal view returns (address ) {
114- return bridgeContract ().messageSender ();
115- }
116-
11781 /**
11882 * @dev Tells the id of the message originated on the other network.
11983 * @return the id of the message originated on the other network.
@@ -129,4 +93,6 @@ contract BasicAMBMediator is Ownable {
12993 function maxGasPerTx () internal view returns (uint256 ) {
13094 return bridgeContract ().maxGasPerTx ();
13195 }
96+
97+ function _passMessage (bytes memory _data , bool _useOracleLane ) internal virtual returns (bytes32 );
13298}
0 commit comments