From 4d02c36602bdd0ff75719ecebc000340b7bc178a Mon Sep 17 00:00:00 2001 From: Christoph-Samuel Pitter Date: Wed, 4 Oct 2023 15:50:33 +0400 Subject: [PATCH] review change requests --- .../contracts/OperatorTokenomics/Operator.sol | 2 +- .../OperatorTokenomics/OperatorFactory.sol | 18 +++++++++--------- .../OperatorTokenomics/OperatorFactory.test.ts | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/network-contracts/contracts/OperatorTokenomics/Operator.sol b/packages/network-contracts/contracts/OperatorTokenomics/Operator.sol index 1e43de68c..cda6a6fd4 100644 --- a/packages/network-contracts/contracts/OperatorTokenomics/Operator.sol +++ b/packages/network-contracts/contracts/OperatorTokenomics/Operator.sol @@ -74,7 +74,7 @@ contract Operator is Initializable, ERC2771ContextUpgradeable, IERC677Receiver, error NoEarnings(); error FirstEmptyQueueThenStake(); error ZeroUndelegation(); - error DidNotReceiveReward(); //0xb1c5c787 + error DidNotReceiveReward(); bytes32 public constant OWNER_ROLE = keccak256("OWNER_ROLE"); bytes32 public constant CONTROLLER_ROLE = keccak256("CONTROLLER_ROLE"); diff --git a/packages/network-contracts/contracts/OperatorTokenomics/OperatorFactory.sol b/packages/network-contracts/contracts/OperatorTokenomics/OperatorFactory.sol index 132cc2943..944cfdd93 100644 --- a/packages/network-contracts/contracts/OperatorTokenomics/OperatorFactory.sol +++ b/packages/network-contracts/contracts/OperatorTokenomics/OperatorFactory.sol @@ -22,10 +22,10 @@ contract OperatorFactory is Initializable, UUPSUpgradeable, ERC2771ContextUpgrad error InvalidOperatorsCut(); error PolicyNotTrusted(); - error operatorAlreadyDeployed(); - error onlyOperators(); - error alreadyLive(); - error notLive(); + error OperatorAlreadyDeployed(); + error OnlyOperators(); + error AlreadyLive(); + error NotLive(); bytes32 public constant TRUSTED_FORWARDER_ROLE = keccak256("TRUSTED_FORWARDER_ROLE"); @@ -168,7 +168,7 @@ contract OperatorFactory is Initializable, UUPSUpgradeable, ERC2771ContextUpgrad deploymentTimestamp[newContractAddress] = block.timestamp; // solhint-disable-line not-rely-on-time emit NewOperator(operatorAddress, newContractAddress); - if (operators[operatorAddress] != address(0)) { revert operatorAlreadyDeployed(); } + if (operators[operatorAddress] != address(0)) { revert OperatorAlreadyDeployed(); } operators[operatorAddress] = newContractAddress; return newContractAddress; @@ -190,9 +190,9 @@ contract OperatorFactory is Initializable, UUPSUpgradeable, ERC2771ContextUpgrad /** Operators MUST call this function when they stake to their first Sponsorship */ function registerAsLive() public { address operatorContractAddress = _msgSender(); - if (deploymentTimestamp[operatorContractAddress] == 0) { revert onlyOperators(); } + if (deploymentTimestamp[operatorContractAddress] == 0) { revert OnlyOperators(); } Operator operator = Operator(operatorContractAddress); - if (liveOperatorsIndex[operator] != 0) { revert alreadyLive(); } + if (liveOperatorsIndex[operator] != 0) { revert AlreadyLive(); } liveOperators.push(operator); liveOperatorsIndex[operator] = liveOperators.length; // real index + 1 @@ -203,9 +203,9 @@ contract OperatorFactory is Initializable, UUPSUpgradeable, ERC2771ContextUpgrad /** Operators MUST call this function when they unstake from their last Sponsorship */ function registerAsNotLive() public { address operatorContractAddress = _msgSender(); - if (deploymentTimestamp[operatorContractAddress] == 0) { revert onlyOperators(); } + if (deploymentTimestamp[operatorContractAddress] == 0) { revert OnlyOperators(); } Operator operator = Operator(operatorContractAddress); - if (liveOperatorsIndex[operator] == 0) { revert notLive(); } + if (liveOperatorsIndex[operator] == 0) { revert NotLive(); } uint index = liveOperatorsIndex[operator] - 1; // real index = liveOperatorsIndex - 1 Operator lastOperator = liveOperators[liveOperators.length - 1]; diff --git a/packages/network-contracts/test/hardhat/OperatorTokenomics/OperatorFactory.test.ts b/packages/network-contracts/test/hardhat/OperatorTokenomics/OperatorFactory.test.ts index 7bfbdd5e9..21ba1efe3 100644 --- a/packages/network-contracts/test/hardhat/OperatorTokenomics/OperatorFactory.test.ts +++ b/packages/network-contracts/test/hardhat/OperatorTokenomics/OperatorFactory.test.ts @@ -23,7 +23,7 @@ describe("OperatorFactory", function(): void { it("does NOT allow same operator signer deploy a second Operator contract", async function(): Promise { await deployOperatorContract(sharedContracts, operatorWallet) await expect(deployOperatorContract(sharedContracts, operatorWallet)) - .to.be.revertedWithCustomError(sharedContracts.operatorFactory, "operatorAlreadyDeployed") + .to.be.revertedWithCustomError(sharedContracts.operatorFactory, "OperatorAlreadyDeployed") }) it("can create an Operator with transferAndCall (atomic fund and deploy operator)", async function(): Promise {