From 26e17648d4ad6d10cfb891065e1cfc35ec16a7ef Mon Sep 17 00:00:00 2001 From: Craig M Date: Tue, 14 Nov 2023 15:54:43 +1300 Subject: [PATCH] WIP --- src/interfaces/root/flowrate/IRootERC20BridgeFlowRate.sol | 2 +- src/root/flowrate/FlowRateDetection.sol | 2 +- src/root/flowrate/FlowRateWithdrawalQueue.sol | 3 ++- src/root/flowrate/RootERC20BridgeFlowRate.sol | 3 ++- test/unit/root/flowrate/RootERC20BridgeFlowRate.t.sol | 8 ++++++++ 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/interfaces/root/flowrate/IRootERC20BridgeFlowRate.sol b/src/interfaces/root/flowrate/IRootERC20BridgeFlowRate.sol index 3ab76cb8..7abf9b99 100644 --- a/src/interfaces/root/flowrate/IRootERC20BridgeFlowRate.sol +++ b/src/interfaces/root/flowrate/IRootERC20BridgeFlowRate.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache 2.0 -pragma solidity ^0.8.19; +pragma solidity 0.8.19; interface IRootERC20BridgeFlowRate {} diff --git a/src/root/flowrate/FlowRateDetection.sol b/src/root/flowrate/FlowRateDetection.sol index 1f190435..fd64ee41 100644 --- a/src/root/flowrate/FlowRateDetection.sol +++ b/src/root/flowrate/FlowRateDetection.sol @@ -1,6 +1,6 @@ // Copyright Immutable Pty Ltd 2018 - 2023 // SPDX-License-Identifier: MIT -pragma solidity ^0.8.19; +pragma solidity 0.8.19; /** * @title Flow Rate Detection diff --git a/src/root/flowrate/FlowRateWithdrawalQueue.sol b/src/root/flowrate/FlowRateWithdrawalQueue.sol index 51e8f2cf..014e1e5d 100644 --- a/src/root/flowrate/FlowRateWithdrawalQueue.sol +++ b/src/root/flowrate/FlowRateWithdrawalQueue.sol @@ -1,6 +1,6 @@ // Copyright Immutable Pty Ltd 2018 - 2023 // SPDX-License-Identifier: MIT -pragma solidity ^0.8.19; +pragma solidity 0.8.19; /** * @title Flow Rate Withdrawal Queue @@ -107,6 +107,7 @@ abstract contract FlowRateWithdrawalQueue { * @param amount The amount to withdraw. */ function _enqueueWithdrawal(address receiver, address withdrawer, address token, uint256 amount) internal { + // @TODO look at using a mapping instead of an array to make the withdraw function simpler if (token == address(0)) { revert TokenIsZero(receiver); } diff --git a/src/root/flowrate/RootERC20BridgeFlowRate.sol b/src/root/flowrate/RootERC20BridgeFlowRate.sol index 144ece00..abaf344a 100644 --- a/src/root/flowrate/RootERC20BridgeFlowRate.sol +++ b/src/root/flowrate/RootERC20BridgeFlowRate.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache 2.0 -pragma solidity ^0.8.19; +pragma solidity 0.8.19; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; @@ -166,6 +166,7 @@ contract RootERC20BridgeFlowRate is * Only when not paused. */ function _withdraw(bytes memory data) internal override { + // @TODO abstract this inside the RootERC20Bridge.sol (address rootToken, address withdrawer, address receiver, uint256 amount) = abi.decode(data, (address, address, address, uint256)); address childToken; diff --git a/test/unit/root/flowrate/RootERC20BridgeFlowRate.t.sol b/test/unit/root/flowrate/RootERC20BridgeFlowRate.t.sol index 6dabce5a..b4d0c17e 100644 --- a/test/unit/root/flowrate/RootERC20BridgeFlowRate.t.sol +++ b/test/unit/root/flowrate/RootERC20BridgeFlowRate.t.sol @@ -109,4 +109,12 @@ contract RootERC20BridgeFlowRateUnitTest is Test, IRootERC20BridgeFlowRateEvents ); } + //RootBridge initialiser should revert + + //Flow rate settings with roles + + //Flow rate withdraw + + //Processing the queued withdraws + }