Skip to content

Commit

Permalink
fix: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sujithsomraaj committed Aug 25, 2023
1 parent 06bd31d commit e69fca3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 72 deletions.
10 changes: 5 additions & 5 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[profile.default]
solc = "0.8.19"
src = "src"
out = "out"
libs = ["lib"]
solc = "0.8.19"

optimizer = true
runs = 100
viaIR = true
verbosity = 0
ffi = true
fs_permissions = [{ access = "read-write", path = "./script/" }]

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
# See more config options https://github.com/foundry-rs/foundry/tree/master/config
44 changes: 0 additions & 44 deletions src/controllers/GAC.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,19 @@ import {Error} from "../libraries/Error.sol";

/// @dev is the global access control contract for bridge adapters
contract GAC is IGAC, Ownable {
/*///////////////////////////////////////////////////////////////
CONSTANTS
//////////////////////////////////////////////////////////////*/
/// @dev NOTE: can discuss this with team and finalize
uint256 public constant MIN_TIMELOCK = 24 hours;

/*///////////////////////////////////////////////////////////////
STATE VARIABLES
//////////////////////////////////////////////////////////////*/
uint256 public dstGasLimit;
uint256 public msgExpiration;

/// @dev is the timelock to be used by multi-message receiver before execution
uint256 public msgTimelock;

/// @dev is the address to receive value refunds from remoteCall
address public refundAddress;

/// @notice is the MMA Core Contracts on the chain
/// @dev leveraged by bridge adapters for authentication
address public multiMessageSender;

/// @notice is the governance timelock contract on the chain to queue actions
address public governanceTimelock;

/// @dev is the allowed caller for the multi-message sender
address public allowedCaller;

Expand Down Expand Up @@ -104,19 +92,6 @@ contract GAC is IGAC, Ownable {
msgExpiration = _timeInSeconds;
}

/// @inheritdoc IGAC
function setMsgTimelock(uint256 _timelockInSeconds) external override onlyOwner {
if (_timelockInSeconds == 0) {
revert Error.ZERO_TIMELOCK_PERIOD();
}

if (_timelockInSeconds < MIN_TIMELOCK) {
revert Error.TIMELOCK_PERIOD_LESS_THAN_MINIMUM();
}

msgTimelock = _timelockInSeconds;
}

/// @inheritdoc IGAC
function setRefundAddress(address _refundAddress) external override onlyOwner {
if (_refundAddress == address(0)) {
Expand All @@ -126,15 +101,6 @@ contract GAC is IGAC, Ownable {
refundAddress = _refundAddress;
}

/// @inheritdoc IGAC
function setGovernanceTimelock(address _governanceTimelock) external override onlyOwner {
if (_governanceTimelock == address(0)) {
revert Error.ZERO_ADDRESS_INPUT();
}

governanceTimelock = _governanceTimelock;
}

/*///////////////////////////////////////////////////////////////
EXTERNAL VIEW FUNCTIONS
//////////////////////////////////////////////////////////////*/
Expand Down Expand Up @@ -163,11 +129,6 @@ contract GAC is IGAC, Ownable {
_expiration = msgExpiration;
}

/// @inheritdoc IGAC
function getMsgTimelock() external view returns (uint256 _timelock) {
_timelock = msgTimelock;
}

/// @inheritdoc IGAC
function getRefundAddress() external view override returns (address _refundAddress) {
_refundAddress = refundAddress;
Expand All @@ -187,9 +148,4 @@ contract GAC is IGAC, Ownable {
function getMultiMessageCaller() external view returns (address _mmaCaller) {
_mmaCaller = allowedCaller;
}

/// @inheritdoc IGAC
function getGovernanceTimelock() external view returns (address _governanceTimelock) {
_governanceTimelock = governanceTimelock;
}
}
9 changes: 6 additions & 3 deletions src/controllers/GovernanceTimelock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ import "../interfaces/IGovernanceTimelock.sol";
import "../libraries/Error.sol";

contract GovernanceTimelock is IGovernanceTimelock {
/*/////////////////////////////////////////////////////////////////
STATE VARIABLES
////////////////////////////////////////////////////////////////*/
/*///////////////////////////////////////////////////////////////
CONSTANTS
//////////////////////////////////////////////////////////////*/
uint256 public constant MINIMUM_DELAY = 2 days;
uint256 public constant MAXIMUM_DELAY = 14 days;

/*/////////////////////////////////////////////////////////////////
STATE VARIABLES
////////////////////////////////////////////////////////////////*/
uint256 public txCounter;
uint256 public delay = MINIMUM_DELAY;

Expand Down
14 changes: 0 additions & 14 deletions src/interfaces/IGAC.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,10 @@ interface IGAC {
/// @param _timeInSeconds is the expiry time for the message on dst chain
function setMsgExpiryTime(uint256 _timeInSeconds) external;

/// @dev sets the message timelock before execution
/// @param _timelockInSeconds is the timelock period for the message before execution on dst chain
function setMsgTimelock(uint256 _timelockInSeconds) external;

/// @dev sets the refund address for gas refunds
/// @param _refundAddress is the address to receive refunds from MMA sender
function setRefundAddress(address _refundAddress) external;

/// @dev sets the governance timelock address for queuing dst chain actions
/// @param _governanceTimelock is the address of governance timelock
function setGovernanceTimelock(address _governanceTimelock) external;

/*///////////////////////////////////////////////////////////////
EXTERNAL VIEW FUNCTIONS
//////////////////////////////////////////////////////////////*/
Expand Down Expand Up @@ -81,12 +73,6 @@ interface IGAC {
/// @dev returns the expiry time of message from the time of dispatch
function getMsgExpiryTime() external view returns (uint256 _expiration);

/// @dev returns the timelock period of message in queue before execution
function getMsgTimelock() external view returns (uint256 _timelock);

/// @dev returns the refund address
function getRefundAddress() external view returns (address _refundAddress);

/// @dev returns the governance timelock address before execution on dst chains
function getGovernanceTimelock() external view returns (address _governanceTimelock);
}
6 changes: 0 additions & 6 deletions src/libraries/Error.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ library Error {
/// @dev is thrown if expiration time is zero
error ZERO_EXPIRATION_TIME();

/// @dev is thrown if timelock period is zero
error ZERO_TIMELOCK_PERIOD();

/// @dev is thrown if timelock period is less than minimum allowed limit
error TIMELOCK_PERIOD_LESS_THAN_MINIMUM();

/// @dev is thrown if quorum threshold is greater than receiver adapters
error INVALID_QUORUM_THRESHOLD();

Expand Down

0 comments on commit e69fca3

Please sign in to comment.