aboutsummaryrefslogtreecommitdiffstats
path: root/packages/migrations/src/migration.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/migrations/src/migration.ts')
-rw-r--r--packages/migrations/src/migration.ts54
1 files changed, 17 insertions, 37 deletions
diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts
index e0f245017..7668ec923 100644
--- a/packages/migrations/src/migration.ts
+++ b/packages/migrations/src/migration.ts
@@ -16,10 +16,8 @@ import { erc20TokenInfo, erc721TokenInfo } from './utils/token_info';
* @param txDefaults Default transaction values to use when deploying contracts (e.g., specify the desired contract creator with the `from` parameter).
* @returns The addresses of the contracts that were deployed.
*/
-export async function runMigrationsAsync(provider: Provider, txDefaults: Partial<TxData>): Promise<ContractAddresses> {
+export async function runMigrationsAsync(provider: Provider, txDefaults: TxData): Promise<ContractAddresses> {
const web3Wrapper = new Web3Wrapper(provider);
- const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync();
- const owner = accounts[0];
// Proxies
const erc20Proxy = await wrappers.ERC20ProxyContract.deployFrom0xArtifactAsync(
@@ -84,48 +82,38 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
);
await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- }),
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- }),
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
- await multiAssetProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- }),
+ await multiAssetProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, txDefaults),
);
// MultiAssetProxy
await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, {
- from: owner,
- }),
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, {
- from: owner,
- }),
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
- await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc20Proxy.address),
+ await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
- await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc721Proxy.address),
+ await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc721Proxy.address, txDefaults),
);
// Register the Asset Proxies to the Exchange
await web3Wrapper.awaitTransactionSuccessAsync(
- await exchange.registerAssetProxy.sendTransactionAsync(erc20Proxy.address),
+ await exchange.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
- await exchange.registerAssetProxy.sendTransactionAsync(erc721Proxy.address),
+ await exchange.registerAssetProxy.sendTransactionAsync(erc721Proxy.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
- await exchange.registerAssetProxy.sendTransactionAsync(multiAssetProxy.address),
+ await exchange.registerAssetProxy.sendTransactionAsync(multiAssetProxy.address, txDefaults),
);
// Forwarder
@@ -156,7 +144,8 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
);
// Multisigs
- const owners = [accounts[0], accounts[1]];
+ const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync();
+ const owners = _.uniq([accounts[0], accounts[1], txDefaults.from]);
const confirmationsRequired = new BigNumber(2);
const secondsRequired = new BigNumber(0);
@@ -173,19 +162,13 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
// Transfer Ownership to the Asset Proxy Owner
await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
- from: owner,
- }),
+ await erc20Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
- from: owner,
- }),
+ await erc721Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, txDefaults),
);
await web3Wrapper.awaitTransactionSuccessAsync(
- await multiAssetProxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
- from: owner,
- }),
+ await multiAssetProxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, txDefaults),
);
// Fund the Forwarder with ZRX
@@ -220,10 +203,7 @@ let _cachedContractAddresses: ContractAddresses;
* @param txDefaults Default transaction values to use when deploying contracts (e.g., specify the desired contract creator with the `from` parameter).
* @returns The addresses of the contracts that were deployed.
*/
-export async function runMigrationsOnceAsync(
- provider: Provider,
- txDefaults: Partial<TxData>,
-): Promise<ContractAddresses> {
+export async function runMigrationsOnceAsync(provider: Provider, txDefaults: TxData): Promise<ContractAddresses> {
if (!_.isUndefined(_cachedContractAddresses)) {
return _cachedContractAddresses;
}