Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions contracts/access/roles/CapperRole.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ contract CapperRole {
Roles.Role private cappers;

constructor() public {
cappers.add(msg.sender);
_addCapper(msg.sender);
}

modifier onlyCapper() {
Expand All @@ -25,12 +25,16 @@ contract CapperRole {
}

function addCapper(address account) public onlyCapper {
cappers.add(account);
emit CapperAdded(account);
_addCapper(account);
}

function renounceCapper() public {
cappers.remove(msg.sender);
_removeCapper(msg.sender);
}

function _addCapper(address account) internal {
cappers.add(account);
emit CapperAdded(account);
}

function _removeCapper(address account) internal {
Expand Down
12 changes: 8 additions & 4 deletions contracts/access/roles/MinterRole.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ contract MinterRole {
Roles.Role private minters;

constructor() public {
minters.add(msg.sender);
_addMinter(msg.sender);
}

modifier onlyMinter() {
Expand All @@ -25,12 +25,16 @@ contract MinterRole {
}

function addMinter(address account) public onlyMinter {
minters.add(account);
emit MinterAdded(account);
_addMinter(account);
}

function renounceMinter() public {
minters.remove(msg.sender);
_removeMinter(msg.sender);
}

function _addMinter(address account) internal {
minters.add(account);
emit MinterAdded(account);
}

function _removeMinter(address account) internal {
Expand Down
12 changes: 8 additions & 4 deletions contracts/access/roles/PauserRole.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ contract PauserRole {
Roles.Role private pausers;

constructor() public {
pausers.add(msg.sender);
_addPauser(msg.sender);
}

modifier onlyPauser() {
Expand All @@ -25,12 +25,16 @@ contract PauserRole {
}

function addPauser(address account) public onlyPauser {
pausers.add(account);
emit PauserAdded(account);
_addPauser(account);
}

function renouncePauser() public {
pausers.remove(msg.sender);
_removePauser(msg.sender);
}

function _addPauser(address account) internal {
pausers.add(account);
emit PauserAdded(account);
}

function _removePauser(address account) internal {
Expand Down
12 changes: 8 additions & 4 deletions contracts/access/roles/SignerRole.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ contract SignerRole {
Roles.Role private signers;

constructor() public {
signers.add(msg.sender);
_addSigner(msg.sender);
}

modifier onlySigner() {
Expand All @@ -25,12 +25,16 @@ contract SignerRole {
}

function addSigner(address account) public onlySigner {
signers.add(account);
emit SignerAdded(account);
_addSigner(account);
}

function renounceSigner() public {
signers.remove(msg.sender);
_removeSigner(msg.sender);
}

function _addSigner(address account) internal {
signers.add(account);
emit SignerAdded(account);
}

function _removeSigner(address account) internal {
Expand Down
2 changes: 1 addition & 1 deletion ethpm.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"package_name": "zeppelin",
"version": "1.12.0",
"version": "2.0.0-rc.1",
"description": "Secure Smart Contract library for Solidity",
"authors": [
"OpenZeppelin Community <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openzeppelin-solidity",
"version": "1.12.0",
"version": "2.0.0-rc.1",
"description": "Secure Smart Contract library for Solidity",
"files": [
"build",
Expand Down
5 changes: 5 additions & 0 deletions test/access/roles/PublicRole.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ function shouldBehaveLikePublicRole (authorized, otherAuthorized, [anyone], role
(await this.contract[`is${rolename}`](authorized)).should.equal(false);
});

it(`emits a ${rolename}Removed event`, async function () {
const { logs } = await this.contract[`renounce${rolename}`]({ from: authorized });
expectEvent.inLogs(logs, `${rolename}Removed`, { account: authorized });
});

it('doesn\'t revert when renouncing unassigned role', async function () {
await this.contract[`renounce${rolename}`]({ from: anyone });
});
Expand Down
1 change: 0 additions & 1 deletion test/token/ERC20/behaviors/ERC20Capped.behavior.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { expectThrow } = require('../../../helpers/expectThrow');
const expectEvent = require('../../../helpers/expectEvent');

const BigNumber = web3.BigNumber;

Expand Down