moving away from extending DeploymentManager in case we want to deploy multiple extensions alongside one another

This commit is contained in:
Michael Zhu 2019-10-21 11:14:43 -07:00
parent 64bc1b0990
commit 3e5d166ec4
3 changed files with 77 additions and 96 deletions

View File

@ -1,4 +1,4 @@
import { SignedCoordinatorApproval } from '@0x/contracts-coordinator'; import { CoordinatorContract, SignedCoordinatorApproval } from '@0x/contracts-coordinator';
import { import {
BlockchainBalanceStore, BlockchainBalanceStore,
LocalBalanceStore, LocalBalanceStore,
@ -17,11 +17,13 @@ import { BigNumber } from '@0x/utils';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import { Actor, actorAddressesByName, FeeRecipient, Maker } from '../actors'; import { Actor, actorAddressesByName, FeeRecipient, Maker } from '../actors';
import { CoordinatorDeploymentManager } from './coordinator_deployment_manager'; import { deployCoordinatorAsync } from './deploy_coordinator';
import { DeploymentManager } from '../deployment/deployment_mananger';
// tslint:disable:no-unnecessary-type-assertion // tslint:disable:no-unnecessary-type-assertion
blockchainTests.resets('Coordinator tests', env => { blockchainTests.resets('Coordinator tests', env => {
let deployment: CoordinatorDeploymentManager; let deployment: DeploymentManager;
let coordinator: CoordinatorContract;
let balanceStore: BlockchainBalanceStore; let balanceStore: BlockchainBalanceStore;
let maker: Maker; let maker: Maker;
@ -29,20 +31,26 @@ blockchainTests.resets('Coordinator tests', env => {
let feeRecipient: FeeRecipient; let feeRecipient: FeeRecipient;
before(async () => { before(async () => {
deployment = await CoordinatorDeploymentManager.deployAsync(env); deployment = await DeploymentManager.deployAsync(env, {
numErc20TokensToDeploy: 4,
numErc721TokensToDeploy: 0,
numErc1155TokensToDeploy: 0,
});
coordinator = await deployCoordinatorAsync(deployment, env);
const [makerToken, takerToken, makerFeeToken, takerFeeToken] = deployment.tokens.erc20; const [makerToken, takerToken, makerFeeToken, takerFeeToken] = deployment.tokens.erc20;
taker = new Actor({ name: 'Taker', deployment }); taker = new Actor({ name: 'Taker', deployment });
feeRecipient = new FeeRecipient({ feeRecipient = new FeeRecipient({
name: 'Fee recipient', name: 'Fee recipient',
deployment, deployment,
verifyingContract: deployment.coordinator, verifyingContract: coordinator,
}); });
maker = new Maker({ maker = new Maker({
name: 'Maker', name: 'Maker',
deployment, deployment,
orderConfig: { orderConfig: {
senderAddress: deployment.coordinator.address, senderAddress: coordinator.address,
feeRecipientAddress: feeRecipient.address, feeRecipientAddress: feeRecipient.address,
makerAssetData: assetDataUtils.encodeERC20AssetData(makerToken.address), makerAssetData: assetDataUtils.encodeERC20AssetData(makerToken.address),
takerAssetData: assetDataUtils.encodeERC20AssetData(takerToken.address), takerAssetData: assetDataUtils.encodeERC20AssetData(takerToken.address),
@ -60,7 +68,7 @@ blockchainTests.resets('Coordinator tests', env => {
balanceStore = new BlockchainBalanceStore( balanceStore = new BlockchainBalanceStore(
{ {
...actorAddressesByName([maker, taker, feeRecipient]), ...actorAddressesByName([maker, taker, feeRecipient]),
Coordinator: deployment.coordinator.address, Coordinator: coordinator.address,
StakingProxy: deployment.staking.stakingProxy.address, StakingProxy: deployment.staking.stakingProxy.address,
}, },
{ erc20: { makerToken, takerToken, makerFeeToken, takerFeeToken, wETH: deployment.tokens.weth } }, { erc20: { makerToken, takerToken, makerFeeToken, takerFeeToken, wETH: deployment.tokens.weth } },
@ -75,7 +83,7 @@ blockchainTests.resets('Coordinator tests', env => {
): LocalBalanceStore { ): LocalBalanceStore {
const localBalanceStore = LocalBalanceStore.create(balanceStore); const localBalanceStore = LocalBalanceStore.create(balanceStore);
// Transaction gas cost // Transaction gas cost
localBalanceStore.burnGas(txReceipt.from, CoordinatorDeploymentManager.gasPrice.times(txReceipt.gasUsed)); localBalanceStore.burnGas(txReceipt.from, DeploymentManager.gasPrice.times(txReceipt.gasUsed));
for (const order of orders) { for (const order of orders) {
// Taker -> Maker // Taker -> Maker
@ -98,18 +106,18 @@ blockchainTests.resets('Coordinator tests', env => {
); );
// Protocol fee // Protocol fee
if (msgValue.isGreaterThanOrEqualTo(CoordinatorDeploymentManager.protocolFee)) { if (msgValue.isGreaterThanOrEqualTo(DeploymentManager.protocolFee)) {
localBalanceStore.sendEth( localBalanceStore.sendEth(
txReceipt.from, txReceipt.from,
deployment.staking.stakingProxy.address, deployment.staking.stakingProxy.address,
CoordinatorDeploymentManager.protocolFee, DeploymentManager.protocolFee,
); );
msgValue = msgValue.minus(CoordinatorDeploymentManager.protocolFee); msgValue = msgValue.minus(DeploymentManager.protocolFee);
} else { } else {
localBalanceStore.transferAsset( localBalanceStore.transferAsset(
taker.address, taker.address,
deployment.staking.stakingProxy.address, deployment.staking.stakingProxy.address,
CoordinatorDeploymentManager.protocolFee, DeploymentManager.protocolFee,
assetDataUtils.encodeERC20AssetData(deployment.tokens.weth.address), assetDataUtils.encodeERC20AssetData(deployment.tokens.weth.address),
); );
} }
@ -132,7 +140,7 @@ blockchainTests.resets('Coordinator tests', env => {
takerAssetFilledAmount: order.takerAssetAmount, takerAssetFilledAmount: order.takerAssetAmount,
makerFeePaid: order.makerFee, makerFeePaid: order.makerFee,
takerFeePaid: order.takerFee, takerFeePaid: order.takerFee,
protocolFeePaid: CoordinatorDeploymentManager.protocolFee, protocolFeePaid: DeploymentManager.protocolFee,
orderHash: orderHashUtils.getOrderHashHex(order), orderHash: orderHashUtils.getOrderHashHex(order),
}; };
} }
@ -149,63 +157,59 @@ blockchainTests.resets('Coordinator tests', env => {
data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, [order]); data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, [order]);
transaction = await taker.signTransactionAsync({ transaction = await taker.signTransactionAsync({
data, data,
gasPrice: CoordinatorDeploymentManager.gasPrice, gasPrice: DeploymentManager.gasPrice,
}); });
approval = feeRecipient.signCoordinatorApproval(transaction, taker.address); approval = feeRecipient.signCoordinatorApproval(transaction, taker.address);
}); });
it(`${fnName} should fill the order with a signed approval`, async () => { it(`${fnName} should fill the order with a signed approval`, async () => {
await balanceStore.updateBalancesAsync(); await balanceStore.updateBalancesAsync();
const txReceipt = await deployment.coordinator.executeTransaction.awaitTransactionSuccessAsync( const txReceipt = await coordinator.executeTransaction.awaitTransactionSuccessAsync(
transaction, transaction,
taker.address, taker.address,
transaction.signature, transaction.signature,
[approval.signature], [approval.signature],
{ from: taker.address, value: CoordinatorDeploymentManager.protocolFee }, { from: taker.address, value: DeploymentManager.protocolFee },
); );
const expectedBalances = simulateFills([order], txReceipt, CoordinatorDeploymentManager.protocolFee); const expectedBalances = simulateFills([order], txReceipt, DeploymentManager.protocolFee);
await balanceStore.updateBalancesAsync(); await balanceStore.updateBalancesAsync();
balanceStore.assertEquals(expectedBalances); balanceStore.assertEquals(expectedBalances);
verifyEvents(txReceipt, [expectedFillEvent(order)], ExchangeEvents.Fill); verifyEvents(txReceipt, [expectedFillEvent(order)], ExchangeEvents.Fill);
}); });
it(`${fnName} should fill the order if called by approver (eth protocol fee, no refund)`, async () => { it(`${fnName} should fill the order if called by approver (eth protocol fee, no refund)`, async () => {
await balanceStore.updateBalancesAsync(); await balanceStore.updateBalancesAsync();
const txReceipt = await deployment.coordinator.executeTransaction.awaitTransactionSuccessAsync( const txReceipt = await coordinator.executeTransaction.awaitTransactionSuccessAsync(
transaction, transaction,
feeRecipient.address, feeRecipient.address,
transaction.signature, transaction.signature,
[], [],
{ from: feeRecipient.address, value: CoordinatorDeploymentManager.protocolFee }, { from: feeRecipient.address, value: DeploymentManager.protocolFee },
); );
const expectedBalances = simulateFills([order], txReceipt, CoordinatorDeploymentManager.protocolFee); const expectedBalances = simulateFills([order], txReceipt, DeploymentManager.protocolFee);
await balanceStore.updateBalancesAsync(); await balanceStore.updateBalancesAsync();
balanceStore.assertEquals(expectedBalances); balanceStore.assertEquals(expectedBalances);
verifyEvents(txReceipt, [expectedFillEvent(order)], ExchangeEvents.Fill); verifyEvents(txReceipt, [expectedFillEvent(order)], ExchangeEvents.Fill);
}); });
it(`${fnName} should fill the order if called by approver (eth protocol fee, refund)`, async () => { it(`${fnName} should fill the order if called by approver (eth protocol fee, refund)`, async () => {
await balanceStore.updateBalancesAsync(); await balanceStore.updateBalancesAsync();
const txReceipt = await deployment.coordinator.executeTransaction.awaitTransactionSuccessAsync( const txReceipt = await coordinator.executeTransaction.awaitTransactionSuccessAsync(
transaction, transaction,
feeRecipient.address, feeRecipient.address,
transaction.signature, transaction.signature,
[], [],
{ from: feeRecipient.address, value: CoordinatorDeploymentManager.protocolFee.plus(1) }, { from: feeRecipient.address, value: DeploymentManager.protocolFee.plus(1) },
); );
const expectedBalances = simulateFills( const expectedBalances = simulateFills([order], txReceipt, DeploymentManager.protocolFee.plus(1));
[order],
txReceipt,
CoordinatorDeploymentManager.protocolFee.plus(1),
);
await balanceStore.updateBalancesAsync(); await balanceStore.updateBalancesAsync();
balanceStore.assertEquals(expectedBalances); balanceStore.assertEquals(expectedBalances);
verifyEvents(txReceipt, [expectedFillEvent(order)], ExchangeEvents.Fill); verifyEvents(txReceipt, [expectedFillEvent(order)], ExchangeEvents.Fill);
}); });
it(`${fnName} should fill the order if called by approver (weth protocol fee, no refund)`, async () => { it(`${fnName} should fill the order if called by approver (weth protocol fee, no refund)`, async () => {
await balanceStore.updateBalancesAsync(); await balanceStore.updateBalancesAsync();
const txReceipt = await deployment.coordinator.executeTransaction.awaitTransactionSuccessAsync( const txReceipt = await coordinator.executeTransaction.awaitTransactionSuccessAsync(
transaction, transaction,
feeRecipient.address, feeRecipient.address,
transaction.signature, transaction.signature,
@ -220,7 +224,7 @@ blockchainTests.resets('Coordinator tests', env => {
}); });
it(`${fnName} should fill the order if called by approver (weth protocol fee, refund)`, async () => { it(`${fnName} should fill the order if called by approver (weth protocol fee, refund)`, async () => {
await balanceStore.updateBalancesAsync(); await balanceStore.updateBalancesAsync();
const txReceipt = await deployment.coordinator.executeTransaction.awaitTransactionSuccessAsync( const txReceipt = await coordinator.executeTransaction.awaitTransactionSuccessAsync(
transaction, transaction,
feeRecipient.address, feeRecipient.address,
transaction.signature, transaction.signature,
@ -235,12 +239,12 @@ blockchainTests.resets('Coordinator tests', env => {
}); });
it(`${fnName} should revert with no approval signature`, async () => { it(`${fnName} should revert with no approval signature`, async () => {
const transactionHash = transactionHashUtils.getTransactionHashHex(transaction); const transactionHash = transactionHashUtils.getTransactionHashHex(transaction);
const tx = deployment.coordinator.executeTransaction.awaitTransactionSuccessAsync( const tx = coordinator.executeTransaction.awaitTransactionSuccessAsync(
transaction, transaction,
taker.address, taker.address,
transaction.signature, transaction.signature,
[], [],
{ from: taker.address, value: CoordinatorDeploymentManager.protocolFee }, { from: taker.address, value: DeploymentManager.protocolFee },
); );
const expectedError = new CoordinatorRevertErrors.InvalidApprovalSignatureError( const expectedError = new CoordinatorRevertErrors.InvalidApprovalSignatureError(
@ -256,12 +260,12 @@ blockchainTests.resets('Coordinator tests', env => {
hexSlice(approval.signature, 6), hexSlice(approval.signature, 6),
); );
const transactionHash = transactionHashUtils.getTransactionHashHex(transaction); const transactionHash = transactionHashUtils.getTransactionHashHex(transaction);
const tx = deployment.coordinator.executeTransaction.awaitTransactionSuccessAsync( const tx = coordinator.executeTransaction.awaitTransactionSuccessAsync(
transaction, transaction,
taker.address, taker.address,
transaction.signature, transaction.signature,
[approvalSignature], [approvalSignature],
{ from: taker.address, value: CoordinatorDeploymentManager.protocolFee }, { from: taker.address, value: DeploymentManager.protocolFee },
); );
const expectedError = new CoordinatorRevertErrors.InvalidApprovalSignatureError( const expectedError = new CoordinatorRevertErrors.InvalidApprovalSignatureError(
@ -271,12 +275,12 @@ blockchainTests.resets('Coordinator tests', env => {
expect(tx).to.revertWith(expectedError); expect(tx).to.revertWith(expectedError);
}); });
it(`${fnName} should revert if not called by tx signer or approver`, async () => { it(`${fnName} should revert if not called by tx signer or approver`, async () => {
const tx = deployment.coordinator.executeTransaction.awaitTransactionSuccessAsync( const tx = coordinator.executeTransaction.awaitTransactionSuccessAsync(
transaction, transaction,
taker.address, taker.address,
transaction.signature, transaction.signature,
[approval.signature], [approval.signature],
{ from: maker.address, value: CoordinatorDeploymentManager.protocolFee }, { from: maker.address, value: DeploymentManager.protocolFee },
); );
const expectedError = new CoordinatorRevertErrors.InvalidOriginError(taker.address); const expectedError = new CoordinatorRevertErrors.InvalidOriginError(taker.address);
@ -296,15 +300,15 @@ blockchainTests.resets('Coordinator tests', env => {
data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders); data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
transaction = await taker.signTransactionAsync({ transaction = await taker.signTransactionAsync({
data, data,
gasPrice: CoordinatorDeploymentManager.gasPrice, gasPrice: DeploymentManager.gasPrice,
}); });
approval = feeRecipient.signCoordinatorApproval(transaction, taker.address); approval = feeRecipient.signCoordinatorApproval(transaction, taker.address);
}); });
it(`${fnName} should fill the orders with a signed approval`, async () => { it(`${fnName} should fill the orders with a signed approval`, async () => {
await balanceStore.updateBalancesAsync(); await balanceStore.updateBalancesAsync();
const value = CoordinatorDeploymentManager.protocolFee.times(orders.length); const value = DeploymentManager.protocolFee.times(orders.length);
const txReceipt = await deployment.coordinator.executeTransaction.awaitTransactionSuccessAsync( const txReceipt = await coordinator.executeTransaction.awaitTransactionSuccessAsync(
transaction, transaction,
taker.address, taker.address,
transaction.signature, transaction.signature,
@ -319,8 +323,8 @@ blockchainTests.resets('Coordinator tests', env => {
}); });
it(`${fnName} should fill the orders if called by approver (eth fee, no refund)`, async () => { it(`${fnName} should fill the orders if called by approver (eth fee, no refund)`, async () => {
await balanceStore.updateBalancesAsync(); await balanceStore.updateBalancesAsync();
const value = CoordinatorDeploymentManager.protocolFee.times(orders.length); const value = DeploymentManager.protocolFee.times(orders.length);
const txReceipt = await deployment.coordinator.executeTransaction.awaitTransactionSuccessAsync( const txReceipt = await coordinator.executeTransaction.awaitTransactionSuccessAsync(
transaction, transaction,
feeRecipient.address, feeRecipient.address,
transaction.signature, transaction.signature,
@ -335,8 +339,8 @@ blockchainTests.resets('Coordinator tests', env => {
}); });
it(`${fnName} should fill the orders if called by approver (mixed fees, refund)`, async () => { it(`${fnName} should fill the orders if called by approver (mixed fees, refund)`, async () => {
await balanceStore.updateBalancesAsync(); await balanceStore.updateBalancesAsync();
const value = CoordinatorDeploymentManager.protocolFee.plus(1); const value = DeploymentManager.protocolFee.plus(1);
const txReceipt = await deployment.coordinator.executeTransaction.awaitTransactionSuccessAsync( const txReceipt = await coordinator.executeTransaction.awaitTransactionSuccessAsync(
transaction, transaction,
feeRecipient.address, feeRecipient.address,
transaction.signature, transaction.signature,
@ -356,12 +360,12 @@ blockchainTests.resets('Coordinator tests', env => {
hexSlice(approval.signature, 6), hexSlice(approval.signature, 6),
); );
const transactionHash = transactionHashUtils.getTransactionHashHex(transaction); const transactionHash = transactionHashUtils.getTransactionHashHex(transaction);
const tx = deployment.coordinator.executeTransaction.awaitTransactionSuccessAsync( const tx = coordinator.executeTransaction.awaitTransactionSuccessAsync(
transaction, transaction,
taker.address, taker.address,
transaction.signature, transaction.signature,
[approvalSignature], [approvalSignature],
{ from: taker.address, value: CoordinatorDeploymentManager.protocolFee.times(orders.length) }, { from: taker.address, value: DeploymentManager.protocolFee.times(orders.length) },
); );
const expectedError = new CoordinatorRevertErrors.InvalidApprovalSignatureError( const expectedError = new CoordinatorRevertErrors.InvalidApprovalSignatureError(
transactionHash, transactionHash,
@ -370,12 +374,12 @@ blockchainTests.resets('Coordinator tests', env => {
expect(tx).to.revertWith(expectedError); expect(tx).to.revertWith(expectedError);
}); });
it(`${fnName} should revert if not called by tx signer or approver`, async () => { it(`${fnName} should revert if not called by tx signer or approver`, async () => {
const tx = deployment.coordinator.executeTransaction.awaitTransactionSuccessAsync( const tx = coordinator.executeTransaction.awaitTransactionSuccessAsync(
transaction, transaction,
taker.address, taker.address,
transaction.signature, transaction.signature,
[approval.signature], [approval.signature],
{ from: maker.address, value: CoordinatorDeploymentManager.protocolFee.times(orders.length) }, { from: maker.address, value: DeploymentManager.protocolFee.times(orders.length) },
); );
const expectedError = new CoordinatorRevertErrors.InvalidOriginError(taker.address); const expectedError = new CoordinatorRevertErrors.InvalidOriginError(taker.address);
expect(tx).to.revertWith(expectedError); expect(tx).to.revertWith(expectedError);
@ -399,9 +403,9 @@ blockchainTests.resets('Coordinator tests', env => {
const data = exchangeDataEncoder.encodeOrdersToExchangeData(ExchangeFunctionName.CancelOrder, [order]); const data = exchangeDataEncoder.encodeOrdersToExchangeData(ExchangeFunctionName.CancelOrder, [order]);
const transaction = await maker.signTransactionAsync({ const transaction = await maker.signTransactionAsync({
data, data,
gasPrice: CoordinatorDeploymentManager.gasPrice, gasPrice: DeploymentManager.gasPrice,
}); });
const txReceipt = await deployment.coordinator.executeTransaction.awaitTransactionSuccessAsync( const txReceipt = await coordinator.executeTransaction.awaitTransactionSuccessAsync(
transaction, transaction,
maker.address, maker.address,
transaction.signature, transaction.signature,
@ -416,9 +420,9 @@ blockchainTests.resets('Coordinator tests', env => {
const data = exchangeDataEncoder.encodeOrdersToExchangeData(ExchangeFunctionName.BatchCancelOrders, orders); const data = exchangeDataEncoder.encodeOrdersToExchangeData(ExchangeFunctionName.BatchCancelOrders, orders);
const transaction = await maker.signTransactionAsync({ const transaction = await maker.signTransactionAsync({
data, data,
gasPrice: CoordinatorDeploymentManager.gasPrice, gasPrice: DeploymentManager.gasPrice,
}); });
const txReceipt = await deployment.coordinator.executeTransaction.awaitTransactionSuccessAsync( const txReceipt = await coordinator.executeTransaction.awaitTransactionSuccessAsync(
transaction, transaction,
maker.address, maker.address,
transaction.signature, transaction.signature,
@ -432,9 +436,9 @@ blockchainTests.resets('Coordinator tests', env => {
const data = exchangeDataEncoder.encodeOrdersToExchangeData(ExchangeFunctionName.CancelOrdersUpTo, []); const data = exchangeDataEncoder.encodeOrdersToExchangeData(ExchangeFunctionName.CancelOrdersUpTo, []);
const transaction = await maker.signTransactionAsync({ const transaction = await maker.signTransactionAsync({
data, data,
gasPrice: CoordinatorDeploymentManager.gasPrice, gasPrice: DeploymentManager.gasPrice,
}); });
const txReceipt = await deployment.coordinator.executeTransaction.awaitTransactionSuccessAsync( const txReceipt = await coordinator.executeTransaction.awaitTransactionSuccessAsync(
transaction, transaction,
maker.address, maker.address,
transaction.signature, transaction.signature,
@ -444,7 +448,7 @@ blockchainTests.resets('Coordinator tests', env => {
const expectedEvent: ExchangeCancelUpToEventArgs = { const expectedEvent: ExchangeCancelUpToEventArgs = {
makerAddress: maker.address, makerAddress: maker.address,
orderSenderAddress: deployment.coordinator.address, orderSenderAddress: coordinator.address,
orderEpoch: new BigNumber(1), orderEpoch: new BigNumber(1),
}; };
verifyEvents(txReceipt, [expectedEvent], ExchangeEvents.CancelUpTo); verifyEvents(txReceipt, [expectedEvent], ExchangeEvents.CancelUpTo);

View File

@ -1,43 +0,0 @@
import { artifacts, CoordinatorContract } from '@0x/contracts-coordinator';
import { artifacts as exchangeArtifacts } from '@0x/contracts-exchange';
import { BlockchainTestsEnvironment } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { DeploymentManager, DeploymentOptions } from '../deployment/deployment_mananger';
export class CoordinatorDeploymentManager extends DeploymentManager {
public coordinator: CoordinatorContract;
public static async deployAsync(
environment: BlockchainTestsEnvironment,
options: Partial<DeploymentOptions> = {},
): Promise<CoordinatorDeploymentManager> {
const baseDeploymentManager = await super.deployAsync(environment, options);
const coordinator = await CoordinatorContract.deployFrom0xArtifactAsync(
artifacts.Coordinator,
environment.provider,
baseDeploymentManager.txDefaults,
{ ...exchangeArtifacts, ...artifacts },
baseDeploymentManager.exchange.address,
new BigNumber(baseDeploymentManager.chainId),
);
return new CoordinatorDeploymentManager(baseDeploymentManager, coordinator);
}
private constructor(baseDeploymentManager: DeploymentManager, coordinator: CoordinatorContract) {
const {
assetProxies,
assetProxyOwner,
exchange,
staking,
tokens,
chainId,
accounts,
txDefaults,
} = baseDeploymentManager;
super(assetProxies, assetProxyOwner, exchange, staking, tokens, chainId, accounts, txDefaults);
this.coordinator = coordinator;
}
}

View File

@ -0,0 +1,20 @@
import { artifacts, CoordinatorContract } from '@0x/contracts-coordinator';
import { artifacts as exchangeArtifacts } from '@0x/contracts-exchange';
import { BlockchainTestsEnvironment } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { DeploymentManager } from '../deployment/deployment_mananger';
export async function deployCoordinatorAsync(
deployment: DeploymentManager,
environment: BlockchainTestsEnvironment,
): Promise<CoordinatorContract> {
return await CoordinatorContract.deployFrom0xArtifactAsync(
artifacts.Coordinator,
environment.provider,
deployment.txDefaults,
{ ...exchangeArtifacts, ...artifacts },
deployment.exchange.address,
new BigNumber(deployment.chainId),
);
}