Skip to content

Commit 1ad78df

Browse files
committed
Renamed chaosnet maestro role to chaosnet owner
1 parent 10fdf5d commit 1ad78df

2 files changed

Lines changed: 51 additions & 51 deletions

File tree

contracts/Chaosnet.sol

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,32 @@ contract Chaosnet {
1616
mapping(address => bool) public isBetaOperator;
1717

1818
/// @notice Address controlling chaosnet status and beta operator addresses.
19-
address public chaosnetMaestro;
19+
address public chaosnetOwner;
2020

2121
event BetaOperatorsAdded(address[] operators);
2222

23-
event ChaosnetMaestroRoleTransferred(
24-
address oldChaosnetMaestro,
25-
address newChaosnetMaestro
23+
event ChaosnetOwnerRoleTransferred(
24+
address oldChaosnetOwner,
25+
address newChaosnetOwner
2626
);
2727

2828
event ChaosnetDeactivated();
2929

3030
constructor() {
31-
_transferChaosnetMaestro(msg.sender);
31+
_transferChaosnetOwner(msg.sender);
3232
isChaosnetActive = true;
3333
}
3434

35-
modifier onlyChaosnetMaestro() {
36-
require(msg.sender == chaosnetMaestro, "Not the chaosnet maestro");
35+
modifier onlyChaosnetOwner() {
36+
require(msg.sender == chaosnetOwner, "Not the chaosnet owner");
3737
_;
3838
}
3939

4040
/// @notice Adds beta operator to chaosnet. Can be called only by the
41-
/// chaosnet maestro.
41+
/// chaosnet owner.
4242
function addBetaOperators(address[] calldata operators)
4343
public
44-
onlyChaosnetMaestro
44+
onlyChaosnetOwner
4545
{
4646
for (uint256 i = 0; i < operators.length; i++) {
4747
isBetaOperator[operators[i]] = true;
@@ -51,28 +51,28 @@ contract Chaosnet {
5151
}
5252

5353
/// @notice Deactivates the chaosnet. Can be called only by the chaosnet
54-
/// maestro. Once deactivated chaosnet can not be activated again.
55-
function deactivateChaosnet() public onlyChaosnetMaestro {
54+
/// owner. Once deactivated chaosnet can not be activated again.
55+
function deactivateChaosnet() public onlyChaosnetOwner {
5656
require(isChaosnetActive, "Chaosnet is not active");
5757
isChaosnetActive = false;
5858
emit ChaosnetDeactivated();
5959
}
6060

61-
/// @notice Transfers the chaosnet maestro role to another non-zero address.
62-
function transferChaosnetMaestroRole(address newChaosnetMaestro)
61+
/// @notice Transfers the chaosnet owner role to another non-zero address.
62+
function transferChaosnetOwnerRole(address newChaosnetOwner)
6363
public
64-
onlyChaosnetMaestro
64+
onlyChaosnetOwner
6565
{
6666
require(
67-
newChaosnetMaestro != address(0),
68-
"New chaosnet maestro must not be zero address"
67+
newChaosnetOwner != address(0),
68+
"New chaosnet owner must not be zero address"
6969
);
70-
_transferChaosnetMaestro(newChaosnetMaestro);
70+
_transferChaosnetOwner(newChaosnetOwner);
7171
}
7272

73-
function _transferChaosnetMaestro(address newChaosnetMaestro) internal {
74-
address oldChaosnetMaestro = chaosnetMaestro;
75-
chaosnetMaestro = newChaosnetMaestro;
76-
emit ChaosnetMaestroRoleTransferred(oldChaosnetMaestro, newChaosnetMaestro);
73+
function _transferChaosnetOwner(address newChaosnetOwner) internal {
74+
address oldChaosnetOwner = chaosnetOwner;
75+
chaosnetOwner = newChaosnetOwner;
76+
emit ChaosnetOwnerRoleTransferred(oldChaosnetOwner, newChaosnetOwner);
7777
}
7878
}

test/sortitionPoolTest.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe("SortitionPool", () => {
2424
;[
2525
deployer,
2626
owner,
27-
chaosnetMaestro,
27+
chaosnetOwner,
2828
alice,
2929
bob,
3030
carol,
@@ -44,7 +44,7 @@ describe("SortitionPool", () => {
4444
await pool.connect(deployer).transferOwnership(owner.address)
4545
await pool
4646
.connect(deployer)
47-
.transferChaosnetMaestroRole(chaosnetMaestro.address)
47+
.transferChaosnetOwnerRole(chaosnetOwner.address)
4848
})
4949

5050
describe("constructor", () => {
@@ -117,7 +117,7 @@ describe("SortitionPool", () => {
117117
context("when operator is beta operator", () => {
118118
beforeEach(async () => {
119119
await pool
120-
.connect(chaosnetMaestro)
120+
.connect(chaosnetOwner)
121121
.addBetaOperators([alice.address])
122122
await pool
123123
.connect(owner)
@@ -144,7 +144,7 @@ describe("SortitionPool", () => {
144144
context("when operator is beta operator", () => {
145145
beforeEach(async () => {
146146
await pool
147-
.connect(chaosnetMaestro)
147+
.connect(chaosnetOwner)
148148
.addBetaOperators([alice.address])
149149
})
150150

@@ -161,7 +161,7 @@ describe("SortitionPool", () => {
161161

162162
context("when chaosnet is not active", () => {
163163
beforeEach(async () => {
164-
await pool.connect(chaosnetMaestro).deactivateChaosnet()
164+
await pool.connect(chaosnetOwner).deactivateChaosnet()
165165
})
166166

167167
context("when operator is eligible", () => {
@@ -214,7 +214,7 @@ describe("SortitionPool", () => {
214214

215215
describe("updateOperatorStatus", () => {
216216
beforeEach(async () => {
217-
await pool.connect(chaosnetMaestro).deactivateChaosnet()
217+
await pool.connect(chaosnetOwner).deactivateChaosnet()
218218
await pool.connect(owner).insertOperator(alice.address, 2000)
219219
})
220220

@@ -270,7 +270,7 @@ describe("SortitionPool", () => {
270270

271271
describe("selectGroup", async () => {
272272
beforeEach(async () => {
273-
await pool.connect(chaosnetMaestro).deactivateChaosnet()
273+
await pool.connect(chaosnetOwner).deactivateChaosnet()
274274
})
275275

276276
context("when sortition pool is locked", () => {
@@ -348,7 +348,7 @@ describe("SortitionPool", () => {
348348

349349
describe("pool rewards", async () => {
350350
beforeEach(async () => {
351-
await pool.connect(chaosnetMaestro).deactivateChaosnet()
351+
await pool.connect(chaosnetOwner).deactivateChaosnet()
352352
})
353353

354354
async function withdrawRewards(
@@ -534,24 +534,24 @@ describe("SortitionPool", () => {
534534
it("should revert", async () => {
535535
await expect(
536536
pool.connect(thirdParty).addBetaOperators([alice.address]),
537-
).to.be.revertedWith("Not the chaosnet maestro")
537+
).to.be.revertedWith("Not the chaosnet owner")
538538
})
539539
})
540540

541541
context("when called by the operator", () => {
542542
it("should revert", async () => {
543543
await expect(
544544
pool.connect(alice).addBetaOperators([alice.address]),
545-
).to.be.revertedWith("Not the chaosnet maestro")
545+
).to.be.revertedWith("Not the chaosnet owner")
546546
})
547547
})
548548

549-
context("when called by the chaosnet maestro", () => {
549+
context("when called by the chaosnet owner", () => {
550550
let tx
551551

552552
beforeEach(async () => {
553553
tx = await pool
554-
.connect(chaosnetMaestro)
554+
.connect(chaosnetOwner)
555555
.addBetaOperators([alice.address, bob.address])
556556
})
557557

@@ -569,25 +569,25 @@ describe("SortitionPool", () => {
569569
})
570570
})
571571

572-
describe("transferChaosnetMaestroRole", () => {
572+
describe("transferChaosnetOwnerRole", () => {
573573
context("when called by third party", () => {
574574
it("should revert", async () => {
575575
await expect(
576576
pool
577577
.connect(thirdParty)
578-
.transferChaosnetMaestroRole(thirdParty.address),
579-
).to.be.revertedWith("Not the chaosnet maestro")
578+
.transferChaosnetOwnerRole(thirdParty.address),
579+
).to.be.revertedWith("Not the chaosnet owner")
580580
})
581581
})
582582

583-
context("when called by the current chaosnet maestro", () => {
583+
context("when called by the current chaosnet owner", () => {
584584
context("when called with the new address set to zero", () => {
585585
it("should revert", async () => {
586586
await expect(
587587
pool
588-
.connect(chaosnetMaestro)
589-
.transferChaosnetMaestroRole(ZERO_ADDRESS),
590-
).to.be.revertedWith("New chaosnet maestro must not be zero address")
588+
.connect(chaosnetOwner)
589+
.transferChaosnetOwnerRole(ZERO_ADDRESS),
590+
).to.be.revertedWith("New chaosnet owner must not be zero address")
591591
})
592592
})
593593

@@ -596,18 +596,18 @@ describe("SortitionPool", () => {
596596

597597
beforeEach(async () => {
598598
tx = await pool
599-
.connect(chaosnetMaestro)
600-
.transferChaosnetMaestroRole(alice.address)
599+
.connect(chaosnetOwner)
600+
.transferChaosnetOwnerRole(alice.address)
601601
})
602602

603603
it("should transfer the role", async () => {
604-
expect(await pool.chaosnetMaestro()).to.equal(alice.address)
604+
expect(await pool.chaosnetOwner()).to.equal(alice.address)
605605
})
606606

607-
it("should emit ChaosnetMaestroRoleTransferred event", async () => {
607+
it("should emit ChaosnetOwnerRoleTransferred event", async () => {
608608
await expect(tx)
609-
.to.emit(pool, "ChaosnetMaestroRoleTransferred")
610-
.withArgs(chaosnetMaestro.address, alice.address)
609+
.to.emit(pool, "ChaosnetOwnerRoleTransferred")
610+
.withArgs(chaosnetOwner.address, alice.address)
611611
})
612612
})
613613
})
@@ -618,19 +618,19 @@ describe("SortitionPool", () => {
618618
it("should revert", async () => {
619619
await expect(
620620
pool.connect(thirdParty).deactivateChaosnet(),
621-
).to.be.revertedWith("Not the chaosnet maestro")
621+
).to.be.revertedWith("Not the chaosnet owner")
622622
})
623623
})
624624

625-
context("when called by the chaosnet maestro", () => {
625+
context("when called by the chaosnet owner", () => {
626626
context("when chaosnet is not active", () => {
627627
beforeEach(async () => {
628-
await pool.connect(chaosnetMaestro).deactivateChaosnet()
628+
await pool.connect(chaosnetOwner).deactivateChaosnet()
629629
})
630630

631631
it("should revert", async () => {
632632
await expect(
633-
pool.connect(chaosnetMaestro).deactivateChaosnet(),
633+
pool.connect(chaosnetOwner).deactivateChaosnet(),
634634
).to.be.revertedWith("Chaosnet is not active")
635635
})
636636
})
@@ -639,7 +639,7 @@ describe("SortitionPool", () => {
639639
let tx
640640

641641
beforeEach(async () => {
642-
tx = await pool.connect(chaosnetMaestro).deactivateChaosnet()
642+
tx = await pool.connect(chaosnetOwner).deactivateChaosnet()
643643
})
644644

645645
it("should deactivate chaosnet", async () => {

0 commit comments

Comments
 (0)