diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-06-28 08:02:01 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-06-30 08:25:56 +0800 |
commit | 2ef31991c75ae12dd7f3aaada25b58c8d50757e7 (patch) | |
tree | b1fd52683d121b274c4f01f1f4dad4e71761d5b0 /packages/migrations/src | |
parent | d3293a5571b64a2d807f9e71ff87497287e951e0 (diff) | |
download | dexon-sol-tools-2ef31991c75ae12dd7f3aaada25b58c8d50757e7.tar dexon-sol-tools-2ef31991c75ae12dd7f3aaada25b58c8d50757e7.tar.gz dexon-sol-tools-2ef31991c75ae12dd7f3aaada25b58c8d50757e7.tar.bz2 dexon-sol-tools-2ef31991c75ae12dd7f3aaada25b58c8d50757e7.tar.lz dexon-sol-tools-2ef31991c75ae12dd7f3aaada25b58c8d50757e7.tar.xz dexon-sol-tools-2ef31991c75ae12dd7f3aaada25b58c8d50757e7.tar.zst dexon-sol-tools-2ef31991c75ae12dd7f3aaada25b58c8d50757e7.zip |
Add logging and updated artifacts
Diffstat (limited to 'packages/migrations/src')
-rw-r--r-- | packages/migrations/src/2.0.0-beta-testnet/migration.ts | 67 |
1 files changed, 40 insertions, 27 deletions
diff --git a/packages/migrations/src/2.0.0-beta-testnet/migration.ts b/packages/migrations/src/2.0.0-beta-testnet/migration.ts index df41fd401..b8173bac5 100644 --- a/packages/migrations/src/2.0.0-beta-testnet/migration.ts +++ b/packages/migrations/src/2.0.0-beta-testnet/migration.ts @@ -1,3 +1,4 @@ +import { logUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { Provider, TxData } from 'ethereum-types'; @@ -42,22 +43,26 @@ export const runV2TestnetMigrationsAsync = async ( const exchange = await ExchangeContract.deployFrom0xArtifactAsync(artifacts.Exchange, provider, txDefaults); artifactsWriter.saveArtifact(exchange); + let txHash; // Register AssetProxies in Exchange const oldAssetProxy = constants.NULL_ADDRESS; - await web3Wrapper.awaitTransactionSuccessAsync( - await exchange.registerAssetProxy.sendTransactionAsync( - constants.ERC20_PROXY_ID, - erc20proxy.address, - oldAssetProxy, - ), + txHash = await exchange.registerAssetProxy.sendTransactionAsync( + constants.ERC20_PROXY_ID, + erc20proxy.address, + oldAssetProxy, ); - await web3Wrapper.awaitTransactionSuccessAsync( - await exchange.registerAssetProxy.sendTransactionAsync( - constants.ERC721_PROXY_ID, - erc721proxy.address, - oldAssetProxy, - ), + logUtils.log(`transactionHash: ${txHash}`); + logUtils.log('Registering ERC20Proxy'); + await web3Wrapper.awaitTransactionSuccessAsync(txHash); + + txHash = await exchange.registerAssetProxy.sendTransactionAsync( + constants.ERC721_PROXY_ID, + erc721proxy.address, + oldAssetProxy, ); + logUtils.log(`transactionHash: ${txHash}`); + logUtils.log('Registering ERC721Proxy'); + await web3Wrapper.awaitTransactionSuccessAsync(txHash); // Deploy AssetProxyOwner const assetProxyOwner = await AssetProxyOwnerContract.deployFrom0xArtifactAsync( @@ -72,21 +77,29 @@ export const runV2TestnetMigrationsAsync = async ( artifactsWriter.saveArtifact(assetProxyOwner); // Authorize Exchange contracts to call AssetProxies - await web3Wrapper.awaitTransactionSuccessAsync( - await erc20proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address), - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await erc721proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address), - ); + txHash = await erc20proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address); + logUtils.log(`transactionHash: ${txHash}`); + logUtils.log('Authorizing Exchange on ERC20Proxy'); + await web3Wrapper.awaitTransactionSuccessAsync(txHash); + + txHash = await erc721proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address); + logUtils.log(`transactionHash: ${txHash}`); + logUtils.log('Authorizing Exchange on ERC721Proxy'); + await web3Wrapper.awaitTransactionSuccessAsync(txHash); // Transfer ownership of AssetProxies and Exchange to AssetProxyOwner - await web3Wrapper.awaitTransactionSuccessAsync( - await erc20proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address), - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await erc721proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address), - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await exchange.transferOwnership.sendTransactionAsync(assetProxyOwner.address), - ); + txHash = await erc20proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address); + logUtils.log(`transactionHash: ${txHash}`); + logUtils.log('Transferring ownership of ERC20Proxy'); + await web3Wrapper.awaitTransactionSuccessAsync(txHash); + + txHash = await erc721proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address); + logUtils.log(`transactionHash: ${txHash}`); + logUtils.log('Transferring ownership of ERC721Proxy'); + await web3Wrapper.awaitTransactionSuccessAsync(txHash); + + txHash = await exchange.transferOwnership.sendTransactionAsync(assetProxyOwner.address); + logUtils.log(`transactionHash: ${txHash}`); + logUtils.log('Transferring ownership of Exchange'); + await web3Wrapper.awaitTransactionSuccessAsync(txHash); }; |