Skip to content

Commit

Permalink
Merge pull request #6 from Kolektivo/feat-5/update-badger-address
Browse files Browse the repository at this point in the history
feat: enables updating badger address
  • Loading branch information
fabianschu authored Jun 8, 2022
2 parents 6e8009c + 67aa66f commit 8ff6f4c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contracts/Roles.sol
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,8 @@ contract Roles is Module {
);
return execAndReturnData(to, value, data, operation);
}

function updateBadger(address newBadger) external onlyOwner {
badger = IBadger(newBadger);
}
}
16 changes: 16 additions & 0 deletions test/Roles.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1680,4 +1680,20 @@ describe("RolesModifier", async () => {
).to.be.revertedWith("FunctionNotAllowed");
});
});

describe("updateBadger()", () => {
it("reverts if not authorized", async () => {
const { modifier } = await txSetup();
await expect(modifier.updateBadger(AddressOne)).to.be.revertedWith(
"Ownable: caller is not the owner"
);
});

it("sets new badger address", async () => {
const { modifier, owner } = await setupRolesWithOwnerAndInvoker();
await modifier.connect(owner).updateBadger(AddressOne);

expect(await modifier.badger()).to.equal(AddressOne);
});
});
});

0 comments on commit 8ff6f4c

Please sign in to comment.