Skip to content

Commit

Permalink
review change requests
Browse files Browse the repository at this point in the history
  • Loading branch information
samt1803 committed Oct 4, 2023
1 parent 545f13d commit 4d02c36
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("OperatorFactory", function(): void {
it("does NOT allow same operator signer deploy a second Operator contract", async function(): Promise<void> {
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<void> {
Expand Down

0 comments on commit 4d02c36

Please sign in to comment.