fix other lint errors

This commit is contained in:
Michael Zhu
2019-10-30 14:43:25 -07:00
parent e9e6452890
commit 43e32f6a1a
18 changed files with 138 additions and 109 deletions

View File

@@ -21,7 +21,7 @@ export class Actor {
public readonly name: string;
public readonly privateKey: Buffer;
public readonly deployment: DeploymentManager;
protected readonly transactionFactory: TransactionFactory;
protected readonly _transactionFactory: TransactionFactory;
constructor(config: ActorConfig) {
Actor.count++;
@@ -29,7 +29,7 @@ export class Actor {
this.name = config.name || this.address;
this.deployment = config.deployment;
this.privateKey = constants.TESTRPC_PRIVATE_KEYS[config.deployment.accounts.indexOf(this.address)];
this.transactionFactory = new TransactionFactory(
this._transactionFactory = new TransactionFactory(
this.privateKey,
config.deployment.exchange.address,
config.deployment.chainId,
@@ -99,6 +99,6 @@ export class Actor {
customTransactionParams: Partial<ZeroExTransaction>,
signatureType: SignatureType = SignatureType.EthSign,
): Promise<SignedZeroExTransaction> {
return this.transactionFactory.newSignedTransactionAsync(customTransactionParams, signatureType);
return this._transactionFactory.newSignedTransactionAsync(customTransactionParams, signatureType);
}
}

View File

@@ -4,7 +4,7 @@ import { SignatureType, SignedZeroExTransaction } from '@0x/types';
import { Actor, ActorConfig, Constructor } from './base';
export interface FeeRecipientConfig extends ActorConfig {
interface FeeRecipientConfig extends ActorConfig {
verifyingContract?: BaseContract;
}
@@ -17,6 +17,10 @@ export interface FeeRecipientInterface {
) => SignedCoordinatorApproval;
}
/**
* This mixin encapsulates functionaltiy associated with fee recipients within the 0x ecosystem.
* As of writing, the only extra functionality provided is signing Coordinator approvals.
*/
export function FeeRecipientMixin<TBase extends Constructor>(Base: TBase): TBase & Constructor<FeeRecipientInterface> {
return class extends Base {
public readonly actor: Actor;
@@ -28,6 +32,7 @@ export function FeeRecipientMixin<TBase extends Constructor>(Base: TBase): TBase
* base class).
*/
constructor(...args: any[]) {
// tslint:disable-next-line:no-inferred-empty-object-type
super(...args);
this.actor = (this as any) as Actor;

View File

@@ -1,8 +1,8 @@
import { Actor } from './base';
import { KeeperMixin } from './keeper';
import { MakerMixin } from './maker';
import { PoolOperatorMixin } from './pool_operator';
import { StakerMixin } from './staker';
import { KeeperMixin } from './keeper';
export class OperatorMaker extends PoolOperatorMixin(MakerMixin(Actor)) {}
export class StakerMaker extends StakerMixin(MakerMixin(Actor)) {}

View File

@@ -10,6 +10,10 @@ export interface KeeperInterface {
finalizePoolsAsync: (poolIds?: string[]) => Promise<TransactionReceiptWithDecodedLogs[]>;
}
/**
* This mixin encapsulates functionaltiy associated with keepers within the 0x ecosystem.
* This includes ending epochs sand finalizing pools in the staking system.
*/
export function KeeperMixin<TBase extends Constructor>(Base: TBase): TBase & Constructor<KeeperInterface> {
return class extends Base {
public readonly actor: Actor;
@@ -20,6 +24,7 @@ export function KeeperMixin<TBase extends Constructor>(Base: TBase): TBase & Con
* class).
*/
constructor(...args: any[]) {
// tslint:disable-next-line:no-inferred-empty-object-type
super(...args);
this.actor = (this as any) as Actor;
}
@@ -63,11 +68,10 @@ export function KeeperMixin<TBase extends Constructor>(Base: TBase): TBase & Con
}
return Promise.all(
poolIds.map(
async poolId =>
await stakingWrapper.finalizePool.awaitTransactionSuccessAsync(poolId, {
from: this.actor.address,
}),
poolIds.map(async poolId =>
stakingWrapper.finalizePool.awaitTransactionSuccessAsync(poolId, {
from: this.actor.address,
}),
),
);
}

View File

@@ -4,7 +4,7 @@ import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import { Actor, ActorConfig, Constructor } from './base';
export interface MakerConfig extends ActorConfig {
interface MakerConfig extends ActorConfig {
orderConfig: Partial<Order>;
}
@@ -16,6 +16,10 @@ export interface MakerInterface {
joinStakingPoolAsync: (poolId: string) => Promise<TransactionReceiptWithDecodedLogs>;
}
/**
* This mixin encapsulates functionaltiy associated with makers within the 0x ecosystem.
* This includes signing and canceling orders, as well as joining a staking pool as a maker.
*/
export function MakerMixin<TBase extends Constructor>(Base: TBase): TBase & Constructor<MakerInterface> {
return class extends Base {
public makerPoolId?: string;
@@ -28,6 +32,7 @@ export function MakerMixin<TBase extends Constructor>(Base: TBase): TBase & Cons
* class).
*/
constructor(...args: any[]) {
// tslint:disable-next-line:no-inferred-empty-object-type
super(...args);
this.actor = (this as any) as Actor;

View File

@@ -2,7 +2,7 @@ import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import { Actor, Constructor } from './base';
export interface OperatorShareByPoolId {
interface OperatorShareByPoolId {
[poolId: string]: number;
}
@@ -15,6 +15,10 @@ export interface PoolOperatorInterface {
) => Promise<TransactionReceiptWithDecodedLogs>;
}
/**
* This mixin encapsulates functionaltiy associated with pool operators within the 0x ecosystem.
* This includes creating staking pools and decreasing the operator share of a pool.
*/
export function PoolOperatorMixin<TBase extends Constructor>(Base: TBase): TBase & Constructor<PoolOperatorInterface> {
return class extends Base {
public readonly operatorShares: OperatorShareByPoolId = {};
@@ -26,6 +30,7 @@ export function PoolOperatorMixin<TBase extends Constructor>(Base: TBase): TBase
* base class).
*/
constructor(...args: any[]) {
// tslint:disable-next-line:no-inferred-empty-object-type
super(...args);
this.actor = (this as any) as Actor;
}

View File

@@ -4,12 +4,13 @@ import { BigNumber } from '@0x/utils';
import { Actor, Constructor } from './base';
export interface StakerInterface {
stakeAsync: (
amount: BigNumber,
poolId?: string,
) => Promise<void>;
stakeAsync: (amount: BigNumber, poolId?: string) => Promise<void>;
}
/**
* This mixin encapsulates functionaltiy associated with stakers within the 0x ecosystem.
* This includes staking ZRX (and optionally delegating it to a specific pool).
*/
export function StakerMixin<TBase extends Constructor>(Base: TBase): TBase & Constructor<StakerInterface> {
return class extends Base {
public readonly actor: Actor;
@@ -20,6 +21,7 @@ export function StakerMixin<TBase extends Constructor>(Base: TBase): TBase & Con
* class).
*/
constructor(...args: any[]) {
// tslint:disable-next-line:no-inferred-empty-object-type
super(...args);
this.actor = (this as any) as Actor;
}

View File

@@ -2,9 +2,10 @@ import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { TransactionReceiptWithDecodedLogs, TxData } from 'ethereum-types';
import { Actor, Constructor } from './base';
import { DeploymentManager } from '../utils/deployment_manager';
import { Actor, Constructor } from './base';
export interface TakerInterface {
fillOrderAsync: (
order: SignedOrder,
@@ -13,6 +14,10 @@ export interface TakerInterface {
) => Promise<TransactionReceiptWithDecodedLogs>;
}
/**
* This mixin encapsulates functionaltiy associated with takers within the 0x ecosystem.
* As of writing, the only extra functionality provided is a utility wrapper around `fillOrder`,
*/
export function TakerMixin<TBase extends Constructor>(Base: TBase): TBase & Constructor<TakerInterface> {
return class extends Base {
public readonly actor: Actor;
@@ -23,6 +28,7 @@ export function TakerMixin<TBase extends Constructor>(Base: TBase): TBase & Cons
* class).
*/
constructor(...args: any[]) {
// tslint:disable-next-line:no-inferred-empty-object-type
super(...args);
this.actor = (this as any) as Actor;
}

View File

@@ -0,0 +1,6 @@
{
"extends": ["@0x/tslint-config"],
"rules": {
"max-classes-per-file": false
}
}

View File

@@ -3,6 +3,10 @@ import * as _ from 'lodash';
import { Actor } from './base';
/**
* Utility function to convert Actors into an object mapping readable names to addresses.
* Useful for BalanceStore.
*/
export function actorAddressesByName(actors: Actor[]): TokenOwnersByName {
return _.zipObject(actors.map(actor => actor.name), actors.map(actor => actor.address));
}

View File

@@ -1,7 +1,6 @@
import { CoordinatorContract, SignedCoordinatorApproval } from '@0x/contracts-coordinator';
import {
BlockchainBalanceStore,
LocalBalanceStore,
constants as exchangeConstants,
ExchangeCancelEventArgs,
ExchangeCancelUpToEventArgs,
@@ -9,6 +8,7 @@ import {
ExchangeEvents,
ExchangeFillEventArgs,
ExchangeFunctionName,
LocalBalanceStore,
} from '@0x/contracts-exchange';
import { blockchainTests, expect, hexConcat, hexSlice, verifyEvents } from '@0x/contracts-test-utils';
import { assetDataUtils, CoordinatorRevertErrors, orderHashUtils, transactionHashUtils } from '@0x/order-utils';
@@ -17,9 +17,10 @@ import { BigNumber } from '@0x/utils';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import { Actor, actorAddressesByName, FeeRecipient, Maker } from '../actors';
import { deployCoordinatorAsync } from './deploy_coordinator';
import { DeploymentManager } from '../utils/deployment_manager';
import { deployCoordinatorAsync } from './deploy_coordinator';
// tslint:disable:no-unnecessary-type-assertion
blockchainTests.resets('Coordinator integration tests', env => {
let deployment: DeploymentManager;
@@ -59,11 +60,11 @@ blockchainTests.resets('Coordinator integration tests', env => {
},
});
taker.configureERC20TokenAsync(takerToken);
taker.configureERC20TokenAsync(takerFeeToken);
taker.configureERC20TokenAsync(deployment.tokens.weth, deployment.staking.stakingProxy.address);
maker.configureERC20TokenAsync(makerToken);
maker.configureERC20TokenAsync(makerFeeToken);
await taker.configureERC20TokenAsync(takerToken);
await taker.configureERC20TokenAsync(takerFeeToken);
await taker.configureERC20TokenAsync(deployment.tokens.weth, deployment.staking.stakingProxy.address);
await maker.configureERC20TokenAsync(makerToken);
await maker.configureERC20TokenAsync(makerFeeToken);
balanceStore = new BlockchainBalanceStore(
{
@@ -79,8 +80,9 @@ blockchainTests.resets('Coordinator integration tests', env => {
function simulateFills(
orders: SignedOrder[],
txReceipt: TransactionReceiptWithDecodedLogs,
msgValue: BigNumber = new BigNumber(0),
msgValue?: BigNumber,
): LocalBalanceStore {
let remainingValue = msgValue || new BigNumber(0);
const localBalanceStore = LocalBalanceStore.create(balanceStore);
// Transaction gas cost
localBalanceStore.burnGas(txReceipt.from, DeploymentManager.gasPrice.times(txReceipt.gasUsed));
@@ -106,13 +108,13 @@ blockchainTests.resets('Coordinator integration tests', env => {
);
// Protocol fee
if (msgValue.isGreaterThanOrEqualTo(DeploymentManager.protocolFee)) {
if (remainingValue.isGreaterThanOrEqualTo(DeploymentManager.protocolFee)) {
localBalanceStore.sendEth(
txReceipt.from,
deployment.staking.stakingProxy.address,
DeploymentManager.protocolFee,
);
msgValue = msgValue.minus(DeploymentManager.protocolFee);
remainingValue = remainingValue.minus(DeploymentManager.protocolFee);
} else {
localBalanceStore.transferAsset(
taker.address,

View File

@@ -5,11 +5,14 @@ import { BigNumber } from '@0x/utils';
import { DeploymentManager } from '../utils/deployment_manager';
/**
* Deploys a Coordinator contract configured to work alongside the provided `deployment`.
*/
export async function deployCoordinatorAsync(
deployment: DeploymentManager,
environment: BlockchainTestsEnvironment,
): Promise<CoordinatorContract> {
return await CoordinatorContract.deployFrom0xArtifactAsync(
return CoordinatorContract.deployFrom0xArtifactAsync(
artifacts.Coordinator,
environment.provider,
deployment.txDefaults,

View File

@@ -5,11 +5,14 @@ import { assetDataUtils } from '@0x/order-utils';
import { DeploymentManager } from '../utils/deployment_manager';
/**
* Deploys a Forwarder contract configured to work alongside the provided `deployment`.
*/
export async function deployForwarderAsync(
deployment: DeploymentManager,
environment: BlockchainTestsEnvironment,
): Promise<ForwarderContract> {
return await ForwarderContract.deployFrom0xArtifactAsync(
return ForwarderContract.deployFrom0xArtifactAsync(
artifacts.Forwarder,
environment.provider,
deployment.txDefaults,

View File

@@ -19,9 +19,10 @@ import { assetDataUtils, ForwarderRevertErrors } from '@0x/order-utils';
import { BigNumber } from '@0x/utils';
import { Actor, actorAddressesByName, FeeRecipient, Maker } from '../actors';
import { DeploymentManager } from '../utils/deployment_manager';
import { deployForwarderAsync } from './deploy_forwarder';
import { ForwarderTestFactory } from './forwarder_test_factory';
import { DeploymentManager } from '../utils/deployment_manager';
blockchainTests('Forwarder integration tests', env => {
let deployment: DeploymentManager;
@@ -71,7 +72,7 @@ blockchainTests('Forwarder integration tests', env => {
feeRecipientAddress: orderFeeRecipient.address,
makerAssetAmount: toBaseUnitAmount(2),
takerAssetAmount: toBaseUnitAmount(1),
makerAssetData: makerAssetData,
makerAssetData,
takerAssetData: wethAssetData,
takerFee: constants.ZERO_AMOUNT,
makerFeeAssetData: assetDataUtils.encodeERC20AssetData(makerFeeToken.address),
@@ -79,9 +80,9 @@ blockchainTests('Forwarder integration tests', env => {
},
});
maker.configureERC20TokenAsync(makerToken);
maker.configureERC20TokenAsync(makerFeeToken);
maker.configureERC20TokenAsync(anotherErc20Token);
await maker.configureERC20TokenAsync(makerToken);
await maker.configureERC20TokenAsync(makerFeeToken);
await maker.configureERC20TokenAsync(anotherErc20Token);
await forwarder.approveMakerAssetProxy.awaitTransactionSuccessAsync(makerAssetData);
[nftId] = await maker.configureERC721TokenAsync(erc721Token);
@@ -111,7 +112,6 @@ blockchainTests('Forwarder integration tests', env => {
blockchainTests.resets('constructor', () => {
it('should revert if assetProxy is unregistered', async () => {
const chainId = await env.getChainIdAsync();
const wethAssetData = assetDataUtils.encodeERC20AssetData(deployment.tokens.weth.address);
const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
exchangeArtifacts.Exchange,
env.provider,

View File

@@ -1,11 +1,4 @@
import {
blockchainTests,
constants,
expect,
filterLogsToArguments,
getRandomInteger,
hexRandom,
} from '@0x/contracts-test-utils';
import { blockchainTests, constants, expect, filterLogsToArguments, getRandomInteger } from '@0x/contracts-test-utils';
import { BigNumber, StringRevertError } from '@0x/utils';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
@@ -30,10 +23,10 @@ blockchainTests.resets('FunctionAssertion Unit Tests', env => {
it('should call the before function with the provided arguments', async () => {
let sideEffectTarget = ZERO_AMOUNT;
const assertion = new FunctionAssertion(exampleContract.returnInteger, {
before: async (input: BigNumber) => {
before: async (_input: BigNumber) => {
sideEffectTarget = randomInput;
},
after: async (beforeInfo: any, result: Result, input: BigNumber) => {},
after: async (_beforeInfo: any, _result: Result, _input: BigNumber) => null,
});
const randomInput = getRandomInteger(ZERO_AMOUNT, MAX_UINT256);
await assertion.executeAsync(randomInput);
@@ -43,8 +36,8 @@ blockchainTests.resets('FunctionAssertion Unit Tests', env => {
it('should call the after function with the provided arguments', async () => {
let sideEffectTarget = ZERO_AMOUNT;
const assertion = new FunctionAssertion(exampleContract.returnInteger, {
before: async (input: BigNumber) => {},
after: async (beforeInfo: any, result: Result, input: BigNumber) => {
before: async (_input: BigNumber) => null,
after: async (_beforeInfo: any, _result: Result, input: BigNumber) => {
sideEffectTarget = input;
},
});
@@ -55,8 +48,8 @@ blockchainTests.resets('FunctionAssertion Unit Tests', env => {
it('should not fail immediately if the wrapped function fails', async () => {
const assertion = new FunctionAssertion(exampleContract.emptyRevert, {
before: async () => {},
after: async (beforeInfo: any, result: Result) => {},
before: async () => null,
after: async (_beforeInfo: any, _result: Result) => null,
});
await assertion.executeAsync();
});
@@ -65,10 +58,10 @@ blockchainTests.resets('FunctionAssertion Unit Tests', env => {
const randomInput = getRandomInteger(ZERO_AMOUNT, MAX_UINT256);
let sideEffectTarget = ZERO_AMOUNT;
const assertion = new FunctionAssertion(exampleContract.returnInteger, {
before: async (input: BigNumber) => {
before: async (_input: BigNumber) => {
return randomInput;
},
after: async (beforeInfo: any, result: Result, input: BigNumber) => {
after: async (beforeInfo: any, _result: Result, _input: BigNumber) => {
sideEffectTarget = beforeInfo;
},
});
@@ -79,8 +72,8 @@ blockchainTests.resets('FunctionAssertion Unit Tests', env => {
it('should pass the result from the function call to "after"', async () => {
let sideEffectTarget = ZERO_AMOUNT;
const assertion = new FunctionAssertion(exampleContract.returnInteger, {
before: async (input: BigNumber) => {},
after: async (beforeInfo: any, result: Result, input: BigNumber) => {
before: async (_input: BigNumber) => null,
after: async (_beforeInfo: any, result: Result, _input: BigNumber) => {
sideEffectTarget = result.data;
},
});
@@ -90,12 +83,10 @@ blockchainTests.resets('FunctionAssertion Unit Tests', env => {
});
it('should pass the receipt from the function call to "after"', async () => {
let sideEffectTarget = {} as TransactionReceiptWithDecodedLogs;
let sideEffectTarget: TransactionReceiptWithDecodedLogs;
const assertion = new FunctionAssertion(exampleContract.emitEvent, {
before: async (input: string) => {
return {};
},
after: async (beforeInfo: {}, result: Result, input: string) => {
before: async (_input: string) => null,
after: async (_beforeInfo: any, result: Result, _input: string) => {
if (result.receipt) {
sideEffectTarget = result.receipt;
}
@@ -107,7 +98,7 @@ blockchainTests.resets('FunctionAssertion Unit Tests', env => {
// Ensure that the correct events were emitted.
const [event] = filterLogsToArguments<TestFrameworkEventEventArgs>(
sideEffectTarget.logs,
sideEffectTarget!.logs, // tslint:disable-line:no-non-null-assertion
TestFrameworkEvents.Event,
);
expect(event).to.be.deep.eq({ input });
@@ -116,10 +107,8 @@ blockchainTests.resets('FunctionAssertion Unit Tests', env => {
it('should pass the error to "after" if the function call fails', async () => {
let sideEffectTarget: Error;
const assertion = new FunctionAssertion(exampleContract.stringRevert, {
before: async string => {
return {};
},
after: async (any, result: Result, string) => {
before: async _string => null,
after: async (_beforeInfo: any, result: Result, _input: string) => {
sideEffectTarget = result.data;
},
});
@@ -128,7 +117,7 @@ blockchainTests.resets('FunctionAssertion Unit Tests', env => {
const expectedError = new StringRevertError(message);
return expect(
new Promise((resolve, reject) => {
new Promise<Error>((_resolve, reject) => {
reject(sideEffectTarget);
}),
).to.revertWith(expectedError);

View File

@@ -1,4 +1,3 @@
import { blockchainTests, constants, expect } from '@0x/contracts-test-utils';
import { IERC20TokenEvents, IERC20TokenTransferEventArgs } from '@0x/contracts-erc20';
import {
BlockchainBalanceStore,
@@ -14,13 +13,13 @@ import {
IStakingEventsRewardsPaidEventArgs,
IStakingEventsStakingPoolEarnedRewardsInEpochEventArgs,
} from '@0x/contracts-staking';
import { SignedOrder } from '@0x/types';
import { blockchainTests, constants, expect, toBaseUnitAmount, verifyEvents } from '@0x/contracts-test-utils';
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
import { toBaseUnitAmount, verifyEvents } from '@0x/contracts-test-utils';
import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import { Taker, actorAddressesByName, FeeRecipient, Maker, OperatorStakerMaker, StakerKeeper } from '../actors';
import { actorAddressesByName, FeeRecipient, Maker, OperatorStakerMaker, StakerKeeper, Taker } from '../actors';
import { DeploymentManager } from '../utils/deployment_manager';
blockchainTests.resets('fillOrder integration tests', env => {
@@ -78,7 +77,7 @@ blockchainTests.resets('fillOrder integration tests', env => {
await delegator.configureERC20TokenAsync(deployment.tokens.zrx);
// Create a staking pool with the operator as a maker.
poolId = await operator.createStakingPoolAsync(0.95 * stakingConstants.PPM, true);
poolId = await operator.createStakingPoolAsync(stakingConstants.PPM * 0.95, true);
// A vanilla maker joins the pool as well.
await maker.joinStakingPoolAsync(poolId);
@@ -97,8 +96,9 @@ blockchainTests.resets('fillOrder integration tests', env => {
function simulateFill(
order: SignedOrder,
txReceipt: TransactionReceiptWithDecodedLogs,
msgValue: BigNumber = DeploymentManager.protocolFee,
msgValue?: BigNumber,
): LocalBalanceStore {
let remainingValue = msgValue !== undefined ? msgValue : DeploymentManager.protocolFee;
const localBalanceStore = LocalBalanceStore.create(balanceStore);
// Transaction gas cost
localBalanceStore.burnGas(txReceipt.from, DeploymentManager.gasPrice.times(txReceipt.gasUsed));
@@ -109,13 +109,13 @@ blockchainTests.resets('fillOrder integration tests', env => {
localBalanceStore.transferAsset(maker.address, taker.address, order.makerAssetAmount, order.makerAssetData);
// Protocol fee
if (msgValue.isGreaterThanOrEqualTo(DeploymentManager.protocolFee)) {
if (remainingValue.isGreaterThanOrEqualTo(DeploymentManager.protocolFee)) {
localBalanceStore.sendEth(
txReceipt.from,
deployment.staking.stakingProxy.address,
DeploymentManager.protocolFee,
);
msgValue = msgValue.minus(DeploymentManager.protocolFee);
remainingValue = remainingValue.minus(DeploymentManager.protocolFee);
} else {
localBalanceStore.transferAsset(
taker.address,

View File

@@ -7,7 +7,7 @@ import {
StaticCallProxyContract,
} from '@0x/contracts-asset-proxy';
import { artifacts as ERC1155Artifacts, ERC1155MintableContract } from '@0x/contracts-erc1155';
import { DummyERC20TokenContract, artifacts as ERC20Artifacts, WETH9Contract } from '@0x/contracts-erc20';
import { artifacts as ERC20Artifacts, DummyERC20TokenContract, WETH9Contract } from '@0x/contracts-erc20';
import { artifacts as ERC721Artifacts, DummyERC721TokenContract } from '@0x/contracts-erc721';
import {
artifacts as exchangeArtifacts,
@@ -256,8 +256,8 @@ export class DeploymentManager {
/**
* Configures an exchange contract with staking contracts
* @param exchange
* @param staking
* @param exchange The Exchange contract.
* @param staking The Staking contracts.
* @param owner An owner address to use when configuring the asset proxies.
*/
protected static async _configureExchangeWithStakingAsync(
@@ -413,45 +413,39 @@ export class DeploymentManager {
: constants.NUM_DUMMY_ERC1155_CONTRACTS_TO_DEPLOY;
const erc20 = await Promise.all(
_.times(
numErc20TokensToDeploy,
async () =>
await DummyERC20TokenContract.deployFrom0xArtifactAsync(
ERC20Artifacts.DummyERC20Token,
environment.provider,
txDefaults,
ERC20Artifacts,
constants.DUMMY_TOKEN_NAME,
constants.DUMMY_TOKEN_SYMBOL,
constants.DUMMY_TOKEN_DECIMALS,
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
),
_.times(numErc20TokensToDeploy, async () =>
DummyERC20TokenContract.deployFrom0xArtifactAsync(
ERC20Artifacts.DummyERC20Token,
environment.provider,
txDefaults,
ERC20Artifacts,
constants.DUMMY_TOKEN_NAME,
constants.DUMMY_TOKEN_SYMBOL,
constants.DUMMY_TOKEN_DECIMALS,
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
),
),
);
const erc721 = await Promise.all(
_.times(
numErc721TokensToDeploy,
async () =>
await DummyERC721TokenContract.deployFrom0xArtifactAsync(
ERC721Artifacts.DummyERC721Token,
environment.provider,
txDefaults,
ERC721Artifacts,
constants.DUMMY_TOKEN_NAME,
constants.DUMMY_TOKEN_SYMBOL,
),
_.times(numErc721TokensToDeploy, async () =>
DummyERC721TokenContract.deployFrom0xArtifactAsync(
ERC721Artifacts.DummyERC721Token,
environment.provider,
txDefaults,
ERC721Artifacts,
constants.DUMMY_TOKEN_NAME,
constants.DUMMY_TOKEN_SYMBOL,
),
),
);
const erc1155 = await Promise.all(
_.times(
numErc1155TokensToDeploy,
async () =>
await ERC1155MintableContract.deployFrom0xArtifactAsync(
ERC1155Artifacts.ERC1155Mintable,
environment.provider,
txDefaults,
ERC1155Artifacts,
),
_.times(numErc1155TokensToDeploy, async () =>
ERC1155MintableContract.deployFrom0xArtifactAsync(
ERC1155Artifacts.ERC1155Mintable,
environment.provider,
txDefaults,
ERC1155Artifacts,
),
),
);
@@ -492,3 +486,4 @@ export class DeploymentManager {
public txDefaults: Partial<TxData>,
) {}
}
// tslint:disable:max-file-line-count

View File

@@ -74,7 +74,7 @@ export class FunctionAssertion<TBefore> implements Assertion {
const beforeInfo = await this.condition.before(...args);
// Initialize the callResult so that the default success value is true.
let callResult: Result = { success: true };
const callResult: Result = { success: true };
// Try to make the call to the function. If it is successful, pass the
// result and receipt to the after condition.