fix all tests for 2.1.2
This commit is contained in:
@ -13,7 +13,7 @@ import "../token/ERC20/ERC20Pausable.sol";
|
|||||||
contract StandardToken is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pausable {
|
contract StandardToken is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pausable {
|
||||||
function initialize(
|
function initialize(
|
||||||
string memory name, string memory symbol, uint8 decimals, uint256 initialSupply, address initialHolder,
|
string memory name, string memory symbol, uint8 decimals, uint256 initialSupply, address initialHolder,
|
||||||
address[] memory minters, address[] memory pausers
|
address[] memory minters, address[] memory pausers, address sender
|
||||||
) public initializer {
|
) public initializer {
|
||||||
ERC20Detailed.initialize(name, symbol, decimals);
|
ERC20Detailed.initialize(name, symbol, decimals);
|
||||||
|
|
||||||
@ -23,11 +23,11 @@ contract StandardToken is Initializable, ERC20Detailed, ERC20Mintable, ERC20Paus
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the minter and pauser roles, and renounce them
|
// Initialize the minter and pauser roles, and renounce them
|
||||||
ERC20Mintable.initialize(msg.sender);
|
ERC20Mintable.initialize(sender);
|
||||||
renounceMinter();
|
_removeMinter(sender);
|
||||||
|
|
||||||
ERC20Pausable.initialize(msg.sender);
|
ERC20Pausable.initialize(sender);
|
||||||
renouncePauser();
|
_removePauser(sender);
|
||||||
|
|
||||||
// Add the requested minters and pausers (this can be done after renouncing since
|
// Add the requested minters and pausers (this can be done after renouncing since
|
||||||
// these are the internal calls)
|
// these are the internal calls)
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import "./ERC20Pausable.sol";
|
|||||||
contract StandaloneERC20 is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pausable {
|
contract StandaloneERC20 is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pausable {
|
||||||
function initialize(
|
function initialize(
|
||||||
string memory name, string memory symbol, uint8 decimals, uint256 initialSupply, address initialHolder,
|
string memory name, string memory symbol, uint8 decimals, uint256 initialSupply, address initialHolder,
|
||||||
address[] memory minters, address[] memory pausers
|
address[] memory minters, address[] memory pausers, address sender
|
||||||
) public initializer {
|
) public initializer {
|
||||||
ERC20Detailed.initialize(name, symbol, decimals);
|
ERC20Detailed.initialize(name, symbol, decimals);
|
||||||
|
|
||||||
@ -21,11 +21,11 @@ contract StandaloneERC20 is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pa
|
|||||||
_mint(initialHolder, initialSupply);
|
_mint(initialHolder, initialSupply);
|
||||||
|
|
||||||
// Initialize the minter and pauser roles, and renounce them
|
// Initialize the minter and pauser roles, and renounce them
|
||||||
ERC20Mintable.initialize(msg.sender);
|
ERC20Mintable.initialize(sender);
|
||||||
renounceMinter();
|
_removeMinter(sender);
|
||||||
|
|
||||||
ERC20Pausable.initialize(msg.sender);
|
ERC20Pausable.initialize(sender);
|
||||||
renouncePauser();
|
_removePauser(sender);
|
||||||
|
|
||||||
// Add the requested minters and pausers (this can be done after renouncing since
|
// Add the requested minters and pausers (this can be done after renouncing since
|
||||||
// these are the internal calls)
|
// these are the internal calls)
|
||||||
@ -39,16 +39,16 @@ contract StandaloneERC20 is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initialize(
|
function initialize(
|
||||||
string memory name, string memory symbol, uint8 decimals, address[] memory minters, address[] memory pausers
|
string memory name, string memory symbol, uint8 decimals, address[] memory minters, address[] memory pausers, address sender
|
||||||
) public initializer {
|
) public initializer {
|
||||||
ERC20Detailed.initialize(name, symbol, decimals);
|
ERC20Detailed.initialize(name, symbol, decimals);
|
||||||
|
|
||||||
// Initialize the minter and pauser roles, and renounce them
|
// Initialize the minter and pauser roles, and renounce them
|
||||||
ERC20Mintable.initialize(msg.sender);
|
ERC20Mintable.initialize(sender);
|
||||||
renounceMinter();
|
_removeMinter(sender);
|
||||||
|
|
||||||
ERC20Pausable.initialize(msg.sender);
|
ERC20Pausable.initialize(sender);
|
||||||
renouncePauser();
|
_removePauser(sender);
|
||||||
|
|
||||||
// Add the requested minters and pausers (this can be done after renouncing since
|
// Add the requested minters and pausers (this can be done after renouncing since
|
||||||
// these are the internal calls)
|
// these are the internal calls)
|
||||||
|
|||||||
@ -15,17 +15,17 @@ import "./ERC721Pausable.sol";
|
|||||||
contract StandaloneERC721
|
contract StandaloneERC721
|
||||||
is Initializable, ERC721, ERC721Enumerable, ERC721Metadata, ERC721MetadataMintable, ERC721Pausable
|
is Initializable, ERC721, ERC721Enumerable, ERC721Metadata, ERC721MetadataMintable, ERC721Pausable
|
||||||
{
|
{
|
||||||
function initialize(string memory name, string memory symbol, address[] memory minters, address[] memory pausers) public initializer {
|
function initialize(string memory name, string memory symbol, address[] memory minters, address[] memory pausers, address sender) public initializer {
|
||||||
ERC721.initialize();
|
ERC721.initialize();
|
||||||
ERC721Enumerable.initialize();
|
ERC721Enumerable.initialize();
|
||||||
ERC721Metadata.initialize(name, symbol);
|
ERC721Metadata.initialize(name, symbol);
|
||||||
|
|
||||||
// Initialize the minter and pauser roles, and renounce them
|
// Initialize the minter and pauser roles, and renounce them
|
||||||
ERC721MetadataMintable.initialize(msg.sender);
|
ERC721MetadataMintable.initialize(sender);
|
||||||
renounceMinter();
|
_removeMinter(sender);
|
||||||
|
|
||||||
ERC721Pausable.initialize(msg.sender);
|
ERC721Pausable.initialize(sender);
|
||||||
renouncePauser();
|
_removePauser(sender);
|
||||||
|
|
||||||
// Add the requested minters and pausers (this can be done after renouncing since
|
// Add the requested minters and pausers (this can be done after renouncing since
|
||||||
// these are the internal calls)
|
// these are the internal calls)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
const { constants, expectEvent } = require('openzeppelin-test-helpers');
|
const { constants, expectEvent } = require('openzeppelin-test-helpers');
|
||||||
const { ZERO_ADDRESS } = constants;
|
const { ZERO_ADDRESS } = constants;
|
||||||
|
|
||||||
const SimpleToken = artifacts.require('SimpleToken');
|
const SimpleToken = artifacts.require('SimpleTokenMock');
|
||||||
|
|
||||||
contract('SimpleToken', function ([_, creator]) {
|
contract('SimpleToken', function ([_, creator]) {
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
|
|||||||
@ -1,11 +1,7 @@
|
|||||||
const encodeCall = require('zos-lib/lib/helpers/encodeCall').default;
|
const encodeCall = require('zos-lib/lib/helpers/encodeCall').default;
|
||||||
const { shouldBehaveLikeERC20Mintable } = require('../token/ERC20/behaviors/ERC20Mintable.behavior');
|
const { shouldBehaveLikeERC20Mintable } = require('../token/ERC20/behaviors/ERC20Mintable.behavior');
|
||||||
|
|
||||||
const BigNumber = web3.BigNumber;
|
const { BN } = require('openzeppelin-test-helpers');
|
||||||
|
|
||||||
require('chai')
|
|
||||||
.use(require('chai-bignumber')(BigNumber))
|
|
||||||
.should();
|
|
||||||
|
|
||||||
const StandardToken = artifacts.require('StandardToken');
|
const StandardToken = artifacts.require('StandardToken');
|
||||||
|
|
||||||
@ -14,9 +10,9 @@ contract('StandardToken', function ([
|
|||||||
]) {
|
]) {
|
||||||
const name = 'StdToken';
|
const name = 'StdToken';
|
||||||
const symbol = 'STDT';
|
const symbol = 'STDT';
|
||||||
const decimals = 18;
|
const decimals = new BN('18');
|
||||||
|
|
||||||
const initialSupply = 300;
|
const initialSupply = new BN('300');
|
||||||
|
|
||||||
const minters = [minterA, minterB];
|
const minters = [minterA, minterB];
|
||||||
const pausers = [pauserA, pauserB];
|
const pausers = [pauserA, pauserB];
|
||||||
@ -28,10 +24,9 @@ contract('StandardToken', function ([
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function initialize (token, name, symbol, decimals, initialSupply, initialHolder, minters, pausers, from) {
|
async function initialize (token, name, symbol, decimals, initialSupply, initialHolder, minters, pausers, from) {
|
||||||
const callData = encodeCall('initialize',
|
const signature = 'initialize(string,string,uint8,uint256,address,address[],address[],address)';
|
||||||
['string', 'string', 'uint8', 'uint256', 'address', 'address[]', 'address[]'],
|
const arguments = [name, symbol, decimals, initialSupply, initialHolder, minters, pausers, from];
|
||||||
[name, symbol, decimals, initialSupply, initialHolder, minters, pausers]);
|
await token.methods[signature](...arguments, { from });
|
||||||
await token.sendTransaction({ data: callData, from });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
context('with all arguments', function () {
|
context('with all arguments', function () {
|
||||||
@ -77,8 +72,8 @@ contract('StandardToken', function ([
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('can be created with zero initial balance', async function () {
|
it('can be created with zero initial balance', async function () {
|
||||||
await initialize(this.token, name, symbol, decimals, 0, ZERO_ADDRESS, minters, pausers, deployer);
|
await initialize(this.token, name, symbol, decimals, new BN(0), ZERO_ADDRESS, minters, pausers, deployer);
|
||||||
(await this.token.balanceOf(initialHolder)).should.be.bignumber.equal(0);
|
(await this.token.balanceOf(initialHolder)).should.be.bignumber.equal('0');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can be created with no minters', async function () {
|
it('can be created with no minters', async function () {
|
||||||
|
|||||||
@ -1,12 +1,7 @@
|
|||||||
const encodeCall = require('zos-lib/lib/helpers/encodeCall').default;
|
const encodeCall = require('zos-lib/lib/helpers/encodeCall').default;
|
||||||
const { shouldBehaveLikeERC20Mintable } = require('./behaviors/ERC20Mintable.behavior');
|
const { shouldBehaveLikeERC20Mintable } = require('./behaviors/ERC20Mintable.behavior');
|
||||||
const shouldFail = require('../../helpers/shouldFail');
|
|
||||||
|
|
||||||
const BigNumber = web3.BigNumber;
|
const { shouldFail, BN } = require('openzeppelin-test-helpers');
|
||||||
|
|
||||||
require('chai')
|
|
||||||
.use(require('chai-bignumber')(BigNumber))
|
|
||||||
.should();
|
|
||||||
|
|
||||||
const StandaloneERC20 = artifacts.require('StandaloneERC20');
|
const StandaloneERC20 = artifacts.require('StandaloneERC20');
|
||||||
|
|
||||||
@ -15,9 +10,9 @@ contract('StandaloneERC20', function ([
|
|||||||
]) {
|
]) {
|
||||||
const name = 'StandaloneERC20';
|
const name = 'StandaloneERC20';
|
||||||
const symbol = 'SAERC20';
|
const symbol = 'SAERC20';
|
||||||
const decimals = 18;
|
const decimals = new BN(18);
|
||||||
|
|
||||||
const initialSupply = 300;
|
const initialSupply = new BN(300);
|
||||||
|
|
||||||
const minters = [minterA, minterB];
|
const minters = [minterA, minterB];
|
||||||
const pausers = [pauserA, pauserB];
|
const pausers = [pauserA, pauserB];
|
||||||
@ -29,17 +24,15 @@ contract('StandaloneERC20', function ([
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function initializeFull (token, name, symbol, decimals, initialSupply, initialHolder, minters, pausers, from) {
|
async function initializeFull (token, name, symbol, decimals, initialSupply, initialHolder, minters, pausers, from) {
|
||||||
const callData = encodeCall('initialize',
|
const signature = 'initialize(string,string,uint8,uint256,address,address[],address[],address)';
|
||||||
['string', 'string', 'uint8', 'uint256', 'address', 'address[]', 'address[]'],
|
const arguments = [name, symbol, decimals, initialSupply, initialHolder, minters, pausers, from];
|
||||||
[name, symbol, decimals, initialSupply, initialHolder, minters, pausers]);
|
await token.methods[signature](...arguments, { from });
|
||||||
await token.sendTransaction({ data: callData, from });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function initializePartial (token, name, symbol, decimals, minters, pausers, from) {
|
async function initializePartial (token, name, symbol, decimals, minters, pausers, from) {
|
||||||
const callData = encodeCall('initialize',
|
const signature = 'initialize(string,string,uint8,address[],address[],address)';
|
||||||
['string', 'string', 'uint8', 'address[]', 'address[]'],
|
const arguments = [name, symbol, decimals, minters, pausers, from];
|
||||||
[name, symbol, decimals, minters, pausers]);
|
await token.methods[signature](...arguments, { from });
|
||||||
await token.sendTransaction({ data: callData, from });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('with all arguments', function () {
|
describe('with all arguments', function () {
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
const encodeCall = require('zos-lib/lib/helpers/encodeCall').default;
|
const encodeCall = require('zos-lib/lib/helpers/encodeCall').default;
|
||||||
|
|
||||||
const BigNumber = web3.BigNumber;
|
require('openzeppelin-test-helpers');
|
||||||
|
|
||||||
require('chai')
|
|
||||||
.use(require('chai-bignumber')(BigNumber))
|
|
||||||
.should();
|
|
||||||
|
|
||||||
const StandaloneERC721 = artifacts.require('StandaloneERC721');
|
const StandaloneERC721 = artifacts.require('StandaloneERC721');
|
||||||
|
|
||||||
@ -20,10 +16,9 @@ contract('StandaloneERC721', function ([_, deployer, minterA, minterB, pauserA,
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function initialize (token, name, symbol, minters, pausers, from) {
|
async function initialize (token, name, symbol, minters, pausers, from) {
|
||||||
const callData = encodeCall('initialize',
|
const signature = 'initialize(string,string,address[],address[],address)';
|
||||||
['string', 'string', 'address[]', 'address[]'],
|
const arguments = [name, symbol, minters, pausers, from];
|
||||||
[name, symbol, minters, pausers]);
|
await token.methods[signature](...arguments, { from });
|
||||||
await token.sendTransaction({ data: callData, from });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
it('can be created with no minters', async function () {
|
it('can be created with no minters', async function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user