forked from rarible/protocol-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use isPrivate in MinterAccessControl
- Loading branch information
Showing
16 changed files
with
202 additions
and
316 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
truffle test ./test/erc-721-minimal/RaribleUser.test.js \ | ||
./test/erc-1155/ERC1155RaribleUser.test.js \ | ||
./test/MinterAccessControl.test.js \ | ||
./test/contracts/access/MinterAccessControlTest.sol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const Testing = artifacts.require("MinterAccessControl.sol"); | ||
const TestingV2 = artifacts.require("MinterAccessControlTest.sol"); | ||
|
||
const { expectThrow } = require('@daonomic/tests-common'); | ||
const { deployProxy, upgradeProxy } = require('@openzeppelin/truffle-upgrades'); | ||
|
||
function creators(list) { | ||
const value = 10000 / list.length | ||
return list.map(account => ({ account, value })) | ||
} | ||
|
||
contract("MinterAccessControl", accounts => { | ||
let token; | ||
let tokenOwner = accounts[9]; | ||
|
||
beforeEach(async () => { | ||
token = await deployProxy(Testing, [], { initializer: '__MinterAccessControl_init' }); | ||
await token.transferOwnership(tokenOwner); | ||
}); | ||
|
||
it("conserve minter access control after upgrade", async () => { | ||
const minter = accounts[1]; | ||
|
||
await token.grantMinter(minter, {from: tokenOwner}) | ||
assert.equal(await token.isValidMinter(minter), true); | ||
|
||
// upgrade contract | ||
const newInstance = await upgradeProxy(token.address, TestingV2); | ||
assert.equal(await newInstance.version(), 2); | ||
|
||
assert.equal(await newInstance.isValidMinter(minter), true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity >=0.6.0 <0.8.0; | ||
|
||
import "../../../contracts/access/MinterAccessControl.sol"; | ||
|
||
contract MinterAccessControlTest is MinterAccessControl { | ||
|
||
function version() public view returns (uint256) { | ||
return 2; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.