-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
836c8eb
commit 665f283
Showing
8 changed files
with
149 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
pragma solidity >=0.8.9; | ||
|
||
import {GAC} from "./GAC.sol"; | ||
import {Error} from "../libraries/Error.sol"; | ||
import {ISenderGAC} from "../interfaces/ISenderGAC.sol"; | ||
|
||
/// @dev is extension of GAC containing sender only functions | ||
contract SenderGAC is GAC, ISenderGAC { | ||
/*/////////////////////////////////////////////////////////////// | ||
CONSTANTS | ||
//////////////////////////////////////////////////////////////*/ | ||
uint256 public constant MINIMUM_DST_GAS_LIMIT = 50000; | ||
|
||
/*/////////////////////////////////////////////////////////////// | ||
STATE VARIABLES | ||
//////////////////////////////////////////////////////////////*/ | ||
uint256 public dstGasLimit; | ||
|
||
/// @notice is the MMA Core Contracts on the chain | ||
/// @dev leveraged by bridge adapters for authentication | ||
address public multiMessageSender; | ||
|
||
/// @dev is the allowed caller for the multi-message sender | ||
address public allowedCaller; | ||
|
||
/*/////////////////////////////////////////////////////////////// | ||
EXTERNAL FUNCTIONS | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
/// @inheritdoc ISenderGAC | ||
function setMultiMessageSender(address _mmaSender) external override onlyOwner { | ||
if (_mmaSender == address(0)) { | ||
revert Error.ZERO_ADDRESS_INPUT(); | ||
} | ||
|
||
multiMessageSender = _mmaSender; | ||
|
||
emit MultiMessageSenderUpdated(_mmaSender); | ||
} | ||
|
||
/// @inheritdoc ISenderGAC | ||
function setMultiMessageCaller(address _mmaCaller) external override onlyOwner { | ||
if (_mmaCaller == address(0)) { | ||
revert Error.ZERO_ADDRESS_INPUT(); | ||
} | ||
|
||
allowedCaller = _mmaCaller; | ||
|
||
emit MultiMessageCallerUpdated(_mmaCaller); | ||
} | ||
|
||
/// @inheritdoc ISenderGAC | ||
function setGlobalMsgDeliveryGasLimit(uint256 _gasLimit) external override onlyOwner { | ||
if (_gasLimit < MINIMUM_DST_GAS_LIMIT) { | ||
revert Error.INVALID_DST_GAS_LIMIT_MIN(); | ||
} | ||
|
||
uint256 oldLimit = dstGasLimit; | ||
dstGasLimit = _gasLimit; | ||
|
||
emit DstGasLimitUpdated(oldLimit, _gasLimit); | ||
} | ||
/*/////////////////////////////////////////////////////////////// | ||
EXTERNAL VIEW FUNCTIONS | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
/// @inheritdoc ISenderGAC | ||
function getMultiMessageCaller() external view returns (address _mmaCaller) { | ||
_mmaCaller = allowedCaller; | ||
} | ||
|
||
/// @inheritdoc ISenderGAC | ||
function getMultiMessageSender() external view returns (address _mmaSender) { | ||
_mmaSender = multiMessageSender; | ||
} | ||
|
||
/// @inheritdoc ISenderGAC | ||
function getGlobalMsgDeliveryGasLimit() external view override returns (uint256 _gasLimit) { | ||
_gasLimit = dstGasLimit; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
pragma solidity >=0.8.9; | ||
|
||
import {IGAC} from "./IGAC.sol"; | ||
|
||
/// @notice interface for GAC (Global Access Controller) on sender chain | ||
interface ISenderGAC is IGAC { | ||
/*/////////////////////////////////////////////////////////////// | ||
EVENT | ||
//////////////////////////////////////////////////////////////*/ | ||
event DstGasLimitUpdated(uint256 oldLimit, uint256 newLimit); | ||
|
||
event MultiMessageCallerUpdated(address indexed mmaCaller); | ||
|
||
event MultiMessageSenderUpdated(address indexed mmaSender); | ||
|
||
/*/////////////////////////////////////////////////////////////// | ||
EXTERNAL FUNCTIONS | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
/// @dev sets the multi message sender caller | ||
/// @param _mmaCaller is the multi message caller | ||
function setMultiMessageCaller(address _mmaCaller) external; | ||
|
||
/// @dev sets the multi message sender on same chain | ||
/// @param _mmaSender is the multi message sender contracts | ||
function setMultiMessageSender(address _mmaSender) external; | ||
|
||
/// @dev sets the global message gas limits | ||
/// @param _gasLimit is the limit to be set | ||
function setGlobalMsgDeliveryGasLimit(uint256 _gasLimit) external; | ||
|
||
/*/////////////////////////////////////////////////////////////// | ||
EXTERNAL VIEW FUNCTIONS | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
/// @dev returns the global message delivery gas limit configured | ||
/// @return _gasLimit is the configured gas limit on dst | ||
function getGlobalMsgDeliveryGasLimit() external view returns (uint256 _gasLimit); | ||
|
||
/// @dev returns the multi message sender on the chain | ||
function getMultiMessageSender() external view returns (address _mmaSender); | ||
|
||
/// @dev returns the multi message caller that can only call the multi message sender contract | ||
function getMultiMessageCaller() external view returns (address _mmaCaller); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters