Migrated some test files, missing BN scientific notation usage.
This commit is contained in:
@ -1,11 +1,10 @@
|
||||
const { BN } = require('openzeppelin-test-helpers');
|
||||
|
||||
const CounterImpl = artifacts.require('CounterImpl');
|
||||
|
||||
require('../helpers/setup');
|
||||
|
||||
const EXPECTED = [1, 2, 3, 4];
|
||||
const KEY1 = web3.sha3('key1');
|
||||
const KEY2 = web3.sha3('key2');
|
||||
const EXPECTED = [new BN(1), new BN(2), new BN(3), new BN(4)];
|
||||
const KEY1 = web3.utils.sha3('key1');
|
||||
const KEY2 = web3.utils.sha3('key2');
|
||||
|
||||
contract('Counter', function ([_, owner]) {
|
||||
beforeEach(async function () {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
const ERC20WithMetadataMock = artifacts.require('ERC20WithMetadataMock');
|
||||
require('openzeppelin-test-helpers');
|
||||
|
||||
require('../../helpers/setup');
|
||||
const ERC20WithMetadataMock = artifacts.require('ERC20WithMetadataMock');
|
||||
|
||||
const metadataURI = 'https://example.com';
|
||||
|
||||
|
||||
@ -1,17 +1,14 @@
|
||||
const shouldFail = require('../helpers/shouldFail');
|
||||
const { ZERO_ADDRESS } = require('../helpers/constants');
|
||||
const { BN, constants, shouldFail } = require('openzeppelin-test-helpers');
|
||||
|
||||
const ERC20Mock = artifacts.require('ERC20Mock');
|
||||
const ERC20Mintable = artifacts.require('ERC20Mintable');
|
||||
const ERC20Migrator = artifacts.require('ERC20Migrator');
|
||||
|
||||
require('../helpers/setup');
|
||||
|
||||
contract('ERC20Migrator', function ([_, owner, recipient, anotherAccount]) {
|
||||
const totalSupply = 200;
|
||||
const totalSupply = new BN('200');
|
||||
|
||||
it('reverts with a null legacy token address', async function () {
|
||||
await shouldFail.reverting(ERC20Migrator.new(ZERO_ADDRESS));
|
||||
await shouldFail.reverting(ERC20Migrator.new(constants.ZERO_ADDRESS));
|
||||
});
|
||||
|
||||
describe('with tokens and migrator', function () {
|
||||
@ -27,7 +24,7 @@ contract('ERC20Migrator', function ([_, owner, recipient, anotherAccount]) {
|
||||
|
||||
describe('beginMigration', function () {
|
||||
it('reverts with a null new token address', async function () {
|
||||
await shouldFail.reverting(this.migrator.beginMigration(ZERO_ADDRESS));
|
||||
await shouldFail.reverting(this.migrator.beginMigration(constants.ZERO_ADDRESS));
|
||||
});
|
||||
|
||||
it('reverts if not a minter of the token', async function () {
|
||||
@ -81,7 +78,7 @@ contract('ERC20Migrator', function ([_, owner, recipient, anotherAccount]) {
|
||||
currentBurnedBalance.should.be.bignumber.equal(amount);
|
||||
|
||||
const currentLegacyTokenBalance = await this.legacyToken.balanceOf(owner);
|
||||
currentLegacyTokenBalance.should.be.bignumber.equal(0);
|
||||
currentLegacyTokenBalance.should.be.bignumber.equal('0');
|
||||
});
|
||||
|
||||
it('updates the total supply', async function () {
|
||||
@ -91,7 +88,7 @@ contract('ERC20Migrator', function ([_, owner, recipient, anotherAccount]) {
|
||||
});
|
||||
|
||||
describe('when the approved balance is lower than the owned balance', function () {
|
||||
const amount = baseAmount - 1;
|
||||
const amount = baseAmount.subn(1);
|
||||
|
||||
beforeEach('approving part of the balance to the new contract', async function () {
|
||||
await this.legacyToken.approve(this.migrator.address, amount, { from: owner });
|
||||
@ -106,7 +103,7 @@ contract('ERC20Migrator', function ([_, owner, recipient, anotherAccount]) {
|
||||
});
|
||||
|
||||
describe('migrate', function () {
|
||||
const baseAmount = 50;
|
||||
const baseAmount = new BN(50);
|
||||
|
||||
beforeEach('approving tokens to the new contract', async function () {
|
||||
await this.legacyToken.approve(this.migrator.address, baseAmount, { from: owner });
|
||||
@ -129,7 +126,7 @@ contract('ERC20Migrator', function ([_, owner, recipient, anotherAccount]) {
|
||||
currentBurnedBalance.should.be.bignumber.equal(amount);
|
||||
|
||||
const currentLegacyTokenBalance = await this.legacyToken.balanceOf(owner);
|
||||
currentLegacyTokenBalance.should.be.bignumber.equal(totalSupply - amount);
|
||||
currentLegacyTokenBalance.should.be.bignumber.equal(totalSupply.sub(amount));
|
||||
});
|
||||
|
||||
it('updates the total supply', async function () {
|
||||
@ -139,7 +136,7 @@ contract('ERC20Migrator', function ([_, owner, recipient, anotherAccount]) {
|
||||
});
|
||||
|
||||
describe('when the given amount is higher than the one approved', function () {
|
||||
const amount = baseAmount + 1;
|
||||
const amount = baseAmount.addn(1);
|
||||
|
||||
it('reverts', async function () {
|
||||
await shouldFail.reverting(this.migrator.migrate(owner, amount));
|
||||
|
||||
@ -1,13 +1,11 @@
|
||||
const shouldFail = require('../helpers/shouldFail');
|
||||
const { shouldFail } = require('openzeppelin-test-helpers');
|
||||
const { getSignFor } = require('../helpers/sign');
|
||||
const { shouldBehaveLikePublicRole } = require('../access/roles/PublicRole.behavior');
|
||||
|
||||
const SignatureBouncerMock = artifacts.require('SignatureBouncerMock');
|
||||
|
||||
require('../helpers/setup');
|
||||
|
||||
const UINT_VALUE = 23;
|
||||
const BYTES_VALUE = web3.toHex('test');
|
||||
const BYTES_VALUE = web3.utils.toHex('test');
|
||||
const INVALID_SIGNATURE = '0xabcd';
|
||||
|
||||
contract('SignatureBouncer', function ([_, signer, otherSigner, anyone, authorizedUser, ...otherAccounts]) {
|
||||
|
||||
@ -1,16 +1,10 @@
|
||||
const shouldFail = require('../helpers/shouldFail');
|
||||
const expectEvent = require('../helpers/expectEvent');
|
||||
const time = require('../helpers/time');
|
||||
const { ethGetBlock } = require('../helpers/web3');
|
||||
const { ZERO_ADDRESS } = require('../helpers/constants');
|
||||
|
||||
const { BigNumber } = require('../helpers/setup');
|
||||
const { BN, constants, expectEvent, shouldFail, time } = require('openzeppelin-test-helpers');
|
||||
|
||||
const ERC20Mintable = artifacts.require('ERC20Mintable');
|
||||
const TokenVesting = artifacts.require('TokenVesting');
|
||||
|
||||
contract('TokenVesting', function ([_, owner, beneficiary]) {
|
||||
const amount = new BigNumber(1000);
|
||||
const amount = new BN('1000');
|
||||
|
||||
beforeEach(async function () {
|
||||
// +1 minute so it starts after contract instantiation
|
||||
@ -32,7 +26,7 @@ contract('TokenVesting', function ([_, owner, beneficiary]) {
|
||||
|
||||
it('reverts with a null beneficiary', async function () {
|
||||
await shouldFail.reverting(
|
||||
TokenVesting.new(ZERO_ADDRESS, this.start, this.cliffDuration, this.duration, true, { from: owner })
|
||||
TokenVesting.new(constants.ZERO_ADDRESS, this.start, this.cliffDuration, this.duration, true, { from: owner })
|
||||
);
|
||||
});
|
||||
|
||||
@ -86,7 +80,7 @@ contract('TokenVesting', function ([_, owner, beneficiary]) {
|
||||
await time.increaseTo(this.start + this.cliffDuration);
|
||||
|
||||
const { receipt } = await this.vesting.release(this.token.address);
|
||||
const block = await ethGetBlock(receipt.blockNumber);
|
||||
const block = await web3.eth.getBlock(receipt.blockNumber);
|
||||
const releaseTime = block.timestamp;
|
||||
|
||||
const releasedAmount = amount.mul(releaseTime - this.start).div(this.duration).floor();
|
||||
|
||||
Reference in New Issue
Block a user