From f8da85767e09b32d943b3682880c9b45e488243b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Cuesta=20Ca=C3=B1ada?= Date: Wed, 13 Oct 2021 12:38:45 +0100 Subject: [PATCH] tweak: allow overriding --- contracts/token/ERC20Rewards.sol | 6 +++--- contracts/utils/AuthEtherFaucet.sol | 2 +- contracts/utils/EmergencyBrake.sol | 10 +++++----- contracts/utils/Relay.sol | 2 +- contracts/utils/Timelock.sol | 10 +++++----- package.json | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/contracts/token/ERC20Rewards.sol b/contracts/token/ERC20Rewards.sol index b6572f3..0b17faf 100644 --- a/contracts/token/ERC20Rewards.sol +++ b/contracts/token/ERC20Rewards.sol @@ -58,7 +58,7 @@ contract ERC20Rewards is AccessControl, ERC20Permit { /// @dev Set a rewards token. /// @notice Careful, this can only be done once. function setRewardsToken(IERC20 rewardsToken_) - external + external virtual auth { require(rewardsToken == IERC20(address(0)), "Rewards token already set"); @@ -68,7 +68,7 @@ contract ERC20Rewards is AccessControl, ERC20Permit { /// @dev Set a rewards schedule function setRewards(uint32 start, uint32 end, uint96 rate) - external + external virtual auth { require( @@ -167,7 +167,7 @@ contract ERC20Rewards is AccessControl, ERC20Permit { /// @dev Claim all rewards from caller into a given address function claim(address to) - external + external virtual returns (uint256 claiming) { _updateRewardsPerToken(); diff --git a/contracts/utils/AuthEtherFaucet.sol b/contracts/utils/AuthEtherFaucet.sol index a3c099a..09af059 100644 --- a/contracts/utils/AuthEtherFaucet.sol +++ b/contracts/utils/AuthEtherFaucet.sol @@ -16,7 +16,7 @@ contract AuthEtherFaucet is AccessControl { receive() external payable {} function drip(address payable to, uint256 amount) - external + external virtual auth { (bool sent,) = to.call{value: amount}(""); diff --git a/contracts/utils/EmergencyBrake.sol b/contracts/utils/EmergencyBrake.sol index a02a434..dbd3ba8 100644 --- a/contracts/utils/EmergencyBrake.sol +++ b/contracts/utils/EmergencyBrake.sol @@ -62,7 +62,7 @@ contract EmergencyBrake is AccessControl, IEmergencyBrake { /// @dev Register an access removal transaction function plan(address target, Permission[] calldata permissions) - external override auth + external override virtual auth returns (bytes32 txHash) { txHash = keccak256(abi.encode(target, permissions)); @@ -88,7 +88,7 @@ contract EmergencyBrake is AccessControl, IEmergencyBrake { /// @dev Erase a planned access removal transaction function cancel(bytes32 txHash) - external override auth + external override virtual auth { require(plans[txHash].state == State.PLANNED, "Emergency not planned for."); delete plans[txHash]; @@ -97,7 +97,7 @@ contract EmergencyBrake is AccessControl, IEmergencyBrake { /// @dev Execute an access removal transaction function execute(bytes32 txHash) - external override auth + external override virtual auth { Plan memory plan_ = plans[txHash]; require(plan_.state == State.PLANNED, "Emergency not planned for."); @@ -124,7 +124,7 @@ contract EmergencyBrake is AccessControl, IEmergencyBrake { /// @dev Restore the orchestration from an isolated target function restore(bytes32 txHash) - external override auth + external override virtual auth { Plan memory plan_ = plans[txHash]; require(plan_.state == State.EXECUTED, "Emergency plan not executed."); @@ -145,7 +145,7 @@ contract EmergencyBrake is AccessControl, IEmergencyBrake { /// @dev Remove the restoring option from an isolated target function terminate(bytes32 txHash) - external override auth + external override virtual auth { require(plans[txHash].state == State.EXECUTED, "Emergency plan not executed."); delete plans[txHash]; diff --git a/contracts/utils/Relay.sol b/contracts/utils/Relay.sol index 4a16fa2..f99e71a 100644 --- a/contracts/utils/Relay.sol +++ b/contracts/utils/Relay.sol @@ -16,7 +16,7 @@ contract Relay is Ownable() { /// @dev Execute a series of function calls function execute(Call[] calldata functionCalls) - external onlyOwner returns (bytes[] memory results) + external virtual onlyOwner returns (bytes[] memory results) { results = new bytes[](functionCalls.length); for (uint256 i = 0; i < functionCalls.length; i++){ diff --git a/contracts/utils/Timelock.sol b/contracts/utils/Timelock.sol index c54b2a5..f57015c 100644 --- a/contracts/utils/Timelock.sol +++ b/contracts/utils/Timelock.sol @@ -102,7 +102,7 @@ contract Timelock is ITimelock, AccessControl { /// @dev Propose a transaction batch for execution function propose(Call[] calldata functionCalls) - external override auth returns (bytes32 txHash) + external override virtual auth returns (bytes32 txHash) { return _propose(functionCalls, 0); } @@ -110,7 +110,7 @@ contract Timelock is ITimelock, AccessControl { /// @dev Propose a transaction batch for execution, with other identical proposals existing /// @param salt Unique identifier for the transaction when repeatedly proposed. Chosen by governor. function proposeRepeated(Call[] calldata functionCalls, uint256 salt) - external override auth returns (bytes32 txHash) + external override virtual auth returns (bytes32 txHash) { return _propose(functionCalls, salt); } @@ -127,7 +127,7 @@ contract Timelock is ITimelock, AccessControl { /// @dev Approve a proposal and set its eta function approve(bytes32 txHash) - external override auth returns (uint32 eta) + external override virtual auth returns (uint32 eta) { Proposal memory proposal = proposals[txHash]; require(proposal.state == STATE.PROPOSED, "Not proposed."); @@ -140,7 +140,7 @@ contract Timelock is ITimelock, AccessControl { /// @dev Execute a proposal function execute(Call[] calldata functionCalls) - external override auth returns (bytes[] memory results) + external override virtual auth returns (bytes[] memory results) { return _execute(functionCalls, 0); } @@ -148,7 +148,7 @@ contract Timelock is ITimelock, AccessControl { /// @dev Execute a proposal, among several identical ones /// @param salt Unique identifier for the transaction when repeatedly proposed. Chosen by governor. function executeRepeated(Call[] calldata functionCalls, uint256 salt) - external override auth returns (bytes[] memory results) + external override virtual auth returns (bytes[] memory results) { return _execute(functionCalls, salt); } diff --git a/package.json b/package.json index 241d081..514d06e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yield-protocol/utils-v2", - "version": "2.4.6", + "version": "2.4.7", "description": "Yield v2 utility contracts", "author": "Yield Inc.", "files": [