diff options
author | Jacob Evans <jacob@dekz.net> | 2019-01-21 12:16:16 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2019-01-21 12:16:16 +0800 |
commit | ebbb4df227d5e290b4bd392322405440dded6e4c (patch) | |
tree | eaa6273b71145ba02aa802092a0c0dc295e8f542 /packages/migrations | |
parent | b5fd3c72a08aaa6957917d74c333387a16edf66b (diff) | |
download | dexon-0x-contracts-ebbb4df227d5e290b4bd392322405440dded6e4c.tar dexon-0x-contracts-ebbb4df227d5e290b4bd392322405440dded6e4c.tar.gz dexon-0x-contracts-ebbb4df227d5e290b4bd392322405440dded6e4c.tar.bz2 dexon-0x-contracts-ebbb4df227d5e290b4bd392322405440dded6e4c.tar.lz dexon-0x-contracts-ebbb4df227d5e290b4bd392322405440dded6e4c.tar.xz dexon-0x-contracts-ebbb4df227d5e290b4bd392322405440dded6e4c.tar.zst dexon-0x-contracts-ebbb4df227d5e290b4bd392322405440dded6e4c.zip |
Remove owner from migrations
Diffstat (limited to 'packages/migrations')
-rw-r--r-- | packages/migrations/src/migration.ts | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts index e0f245017..f33d6337a 100644 --- a/packages/migrations/src/migration.ts +++ b/packages/migrations/src/migration.ts @@ -18,8 +18,9 @@ import { erc20TokenInfo, erc721TokenInfo } from './utils/token_info'; */ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial<TxData>): Promise<ContractAddresses> { const web3Wrapper = new Web3Wrapper(provider); - const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync(); - const owner = accounts[0]; + if (_.isUndefined(txDefaults.from)) { + throw new Error('from address must be specified'); + } // Proxies const erc20Proxy = await wrappers.ERC20ProxyContract.deployFrom0xArtifactAsync( @@ -84,48 +85,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 +147,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 +165,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 |