Skip to content
Prev Previous commit
Next Next commit
Merge branch 'rbac-migration' of github.com:OpenZeppelin/openzeppelin…
…-solidity into feat/mintable-erc721
  • Loading branch information
frangio committed Sep 6, 2018
commit 3e181f28105803d25e7fbc6db573334d6897a9d3
4 changes: 2 additions & 2 deletions contracts/mocks/ERC721MintableBurnableImpl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import "../token/ERC721/ERC721Burnable.sol";
* @title ERC721MintableBurnableImpl
*/
contract ERC721MintableBurnableImpl is ERC721, ERC721Mintable, ERC721Burnable {
constructor(address[] _minters)
ERC721Mintable(_minters)
constructor()
ERC721Mintable()
ERC721("Test", "TEST")
public
{
Expand Down
4 changes: 2 additions & 2 deletions contracts/mocks/ERC721Mock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import "../token/ERC721/ERC721Burnable.sol";
* and a public setter for metadata URI
*/
contract ERC721Mock is ERC721, ERC721Mintable, ERC721Burnable {
constructor(string _name, string _symbol, address[] _minters) public
ERC721Mintable(_minters)
constructor(string _name, string _symbol) public
ERC721Mintable()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed, for constructor with no arguments?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed, but since it's a mock I'll leave it so we can merge sooner. πŸ™‚

ERC721(_name, _symbol)
{}

Expand Down
9 changes: 7 additions & 2 deletions contracts/token/ERC20/ERC20Mintable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ contract ERC20Mintable is ERC20, MinterRole {
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() public onlyMinter canMint returns (bool) {
mintingFinished = true;
function finishMinting()
public
onlyMinter
onlyBeforeMintingFinished
returns (bool)
{
mintingFinished_ = true;
emit MintingFinished();
return true;
}
Expand Down
6 changes: 0 additions & 6 deletions contracts/token/ERC721/ERC721Mintable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ contract ERC721Mintable is ERC721, MinterRole {

bool public mintingFinished = false;

constructor(address[] _minters)
MinterRole(_minters)
public
{
}

modifier canMint() {
require(!mintingFinished);
_;
Expand Down
5 changes: 3 additions & 2 deletions test/token/ERC721/ERC721.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ require('chai')

contract('ERC721', function ([
creator,
minter,
...accounts
]) {
const name = 'Non Fungible Token';
Expand All @@ -23,6 +22,8 @@ contract('ERC721', function ([
const thirdTokenId = 300;
const nonExistentTokenId = 999;

const minter = creator;

const [
owner,
newOwner,
Expand All @@ -31,7 +32,7 @@ contract('ERC721', function ([
] = accounts;

beforeEach(async function () {
this.token = await ERC721.new(name, symbol, [minter], { from: creator });
this.token = await ERC721.new(name, symbol, { from: creator });
});

describe('like a full ERC721', function () {
Expand Down
6 changes: 4 additions & 2 deletions test/token/ERC721/ERC721Burnable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ require('chai')
.use(require('chai-bignumber')(BigNumber))
.should();

contract('ERC721Burnable', function ([_, creator, minter, ...accounts]) {
contract('ERC721Burnable', function ([_, creator, ...accounts]) {
const minter = creator;

beforeEach(async function () {
this.token = await ERC721Burnable.new([minter], { from: creator });
this.token = await ERC721Burnable.new({ from: creator });
});

shouldBehaveLikeERC721Basic(creator, minter, accounts);
Expand Down
6 changes: 4 additions & 2 deletions test/token/ERC721/ERC721Mintable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ require('chai')
.use(require('chai-bignumber')(BigNumber))
.should();

contract('ERC721Mintable', function ([_, creator, minter, ...accounts]) {
contract('ERC721Mintable', function ([_, creator, ...accounts]) {
const minter = creator;

beforeEach(async function () {
this.token = await ERC721Mintable.new([minter], {
this.token = await ERC721Mintable.new({
from: creator,
});
});
Expand Down
10 changes: 10 additions & 0 deletions test/token/ERC721/ERC721Pausable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,22 @@ contract('ERC721Pausable', function ([
creator,
owner,
operator,
otherPauser,
...accounts
]) {
beforeEach(async function () {
this.token = await ERC721Pausable.new({ from: creator });
});

describe('pauser role', function () {
beforeEach(async function () {
this.contract = this.token;
await this.contract.addPauser(otherPauser, { from: creator });
});

shouldBehaveLikePublicRole(creator, otherPauser, accounts, 'pauser');
});

context('when token is paused', function () {
beforeEach(async function () {
await this.token.pause({ from: creator });
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.