Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.

Commit f08ccaa

Browse files
authored
Merge branch 'master' into brian/core_interface
2 parents 227d670 + c27b12a commit f08ccaa

File tree

4 files changed

+8
-22
lines changed

4 files changed

+8
-22
lines changed

test/core/setToken.spec.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ ChaiSetup.configure();
3232
const { expect, assert } = chai;
3333

3434
import { getFormattedLogsFromTxHash } from "../logs/logUtils";
35-
import { randomIntegerLessThan } from "../utils/math";
3635
import { assertTokenBalance, expectRevertError } from "../utils/tokenAssertions";
3736

3837
import {
@@ -83,7 +82,7 @@ contract("SetToken", (accounts) => {
8382
await coreWrapper.setCoreAddress(factory, coreAccount);
8483

8584
subjectComponentAddresses = _.map(components, (token) => token.address);
86-
subjectComponentUnits = _.map(components, () => ether(randomIntegerLessThan(4)));
85+
subjectComponentUnits = _.map(components, () => ether(_.random(1, 4)));
8786
subjectNaturalUnit = STANDARD_NATURAL_UNIT;
8887
});
8988

@@ -262,14 +261,12 @@ contract("SetToken", (accounts) => {
262261
await coreWrapper.setCoreAddress(factory, coreAccount);
263262

264263
const componentAddresses = _.map(components, (token) => token.address);
265-
const componentUnits = _.map(components, () => ether(randomIntegerLessThan(4)));
264+
const componentUnits = _.map(components, () => ether(_.random(1, 4)));
266265
setToken = await coreWrapper.deploySetTokenAsync(
267266
factory.address,
268267
componentAddresses,
269268
componentUnits,
270269
STANDARD_NATURAL_UNIT,
271-
"Set Token",
272-
"SET",
273270
);
274271
});
275272

@@ -326,14 +323,12 @@ contract("SetToken", (accounts) => {
326323
await coreWrapper.setCoreAddress(factory, coreAccount);
327324

328325
const componentAddresses = _.map(components, (token) => token.address);
329-
const componentUnits = _.map(components, () => ether(randomIntegerLessThan(4)));
326+
const componentUnits = _.map(components, () => ether(_.random(1, 4)));
330327
setToken = await coreWrapper.deploySetTokenAsync(
331328
factory.address,
332329
componentAddresses,
333330
componentUnits,
334331
STANDARD_NATURAL_UNIT,
335-
"Set Token",
336-
"SET",
337332
);
338333

339334
await setToken.mint.sendTransactionAsync(
@@ -415,14 +410,12 @@ contract("SetToken", (accounts) => {
415410
await coreWrapper.setCoreAddress(factory, coreAccount);
416411

417412
const componentAddresses = _.map(components, (token) => token.address);
418-
const componentUnits = _.map(components, () => ether(randomIntegerLessThan(4)));
413+
const componentUnits = _.map(components, () => ether(_.random(1, 4)));
419414
setToken = await coreWrapper.deploySetTokenAsync(
420415
factory.address,
421416
componentAddresses,
422417
componentUnits,
423418
STANDARD_NATURAL_UNIT,
424-
"Set Token",
425-
"SET",
426419
);
427420

428421
await setToken.mint.sendTransactionAsync(
@@ -487,14 +480,12 @@ contract("SetToken", (accounts) => {
487480
await coreWrapper.setCoreAddress(factory, coreAccount);
488481

489482
const componentAddresses = _.map(components, (token) => token.address);
490-
const componentUnits = _.map(components, () => ether(randomIntegerLessThan(4)));
483+
const componentUnits = _.map(components, () => ether(_.random(1, 4)));
491484
setToken = await coreWrapper.deploySetTokenAsync(
492485
factory.address,
493486
componentAddresses,
494487
componentUnits,
495488
STANDARD_NATURAL_UNIT,
496-
"Set Token",
497-
"SET",
498489
);
499490

500491
await setToken.mint.sendTransactionAsync(

test/utils/coreWrapper.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { VaultContract } from "../../types/generated/vault";
1111
import { BigNumber } from "bignumber.js";
1212
import { Address } from "../../types/common.js";
1313
import { DEFAULT_GAS } from "../utils/constants";
14-
import { randomIntegerLessThan } from "../utils/math";
1514
import { getFormattedLogsFromTxHash } from "../logs/logUtils";
1615
import { extractNewSetTokenAddressFromLogs } from "../logs/contracts/core";
1716

@@ -98,8 +97,8 @@ export class CoreWrapper {
9897
componentAddresses: Address[],
9998
units: BigNumber[],
10099
naturalUnit: BigNumber,
101-
name: string,
102-
symbol: string,
100+
name: string = "Set Token",
101+
symbol: string = "SET",
103102
from: Address = this._tokenOwnerAddress
104103
): Promise<SetTokenContract> {
105104
const truffleSetToken = await SetToken.new(

test/utils/erc20Wrapper.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
DEPLOYED_TOKEN_QUANTITY,
1414
UNLIMITED_ALLOWANCE_IN_BASE_UNITS,
1515
} from "../utils/constants";
16-
import { randomIntegerLessThan } from "../utils/math";
1716

1817
const BadTokenMock = artifacts.require("BadTokenMock");
1918
const StandardTokenMock = artifacts.require("StandardTokenMock");
@@ -58,7 +57,7 @@ export class ERC20Wrapper {
5857
DEPLOYED_TOKEN_QUANTITY,
5958
`Component ${index}`,
6059
index,
61-
randomIntegerLessThan(18, 4),
60+
_.random(4, 18),
6261
{ from: this._senderAccountAddress, gas: DEFAULT_GAS },
6362
);
6463
});

test/utils/math.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)