diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-06-09 04:30:06 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-06-09 05:56:46 +0800 |
commit | 88a3f8e4aa8a48aea4fd92a15f6e872de8ee4a6a (patch) | |
tree | 2014c457652cdea55fbeb72d46b1116655413f21 /packages/migrations/src/v1 | |
parent | 1c3dc757c3332dad39f47e25cbbbdc60ce2540da (diff) | |
download | dexon-sol-tools-88a3f8e4aa8a48aea4fd92a15f6e872de8ee4a6a.tar dexon-sol-tools-88a3f8e4aa8a48aea4fd92a15f6e872de8ee4a6a.tar.gz dexon-sol-tools-88a3f8e4aa8a48aea4fd92a15f6e872de8ee4a6a.tar.bz2 dexon-sol-tools-88a3f8e4aa8a48aea4fd92a15f6e872de8ee4a6a.tar.lz dexon-sol-tools-88a3f8e4aa8a48aea4fd92a15f6e872de8ee4a6a.tar.xz dexon-sol-tools-88a3f8e4aa8a48aea4fd92a15f6e872de8ee4a6a.tar.zst dexon-sol-tools-88a3f8e4aa8a48aea4fd92a15f6e872de8ee4a6a.zip |
Await transactions in migrations
Diffstat (limited to 'packages/migrations/src/v1')
-rw-r--r-- | packages/migrations/src/v1/migration.ts | 81 |
1 files changed, 46 insertions, 35 deletions
diff --git a/packages/migrations/src/v1/migration.ts b/packages/migrations/src/v1/migration.ts index 7c1cda506..3398537e5 100644 --- a/packages/migrations/src/v1/migration.ts +++ b/packages/migrations/src/v1/migration.ts @@ -68,8 +68,13 @@ export const runV1MigrationsAsync = async (provider: Provider, artifactsDir: str artifactsWriter.saveArtifact(multiSig); const owner = accounts[0]; - await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner }); - await tokenTransferProxy.transferOwnership.sendTransactionAsync(multiSig.address, { from: owner }); + + await web3Wrapper.awaitTransactionSuccessAsync( + await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner }), + ); + await web3Wrapper.awaitTransactionSuccessAsync( + await tokenTransferProxy.transferOwnership.sendTransactionAsync(multiSig.address, { from: owner }), + ); const addTokenGasEstimate = await tokenReg.addToken.estimateGasAsync( zrxToken.address, erc20TokenInfo[0].name, @@ -80,29 +85,33 @@ export const runV1MigrationsAsync = async (provider: Provider, artifactsDir: str { from: owner }, ); const decimals = 18; - await tokenReg.addToken.sendTransactionAsync( - zrxToken.address, - '0x Protocol Token', - 'ZRX', - decimals, - NULL_BYTES, - NULL_BYTES, - { - from: owner, - gas: addTokenGasEstimate, - }, + await web3Wrapper.awaitTransactionSuccessAsync( + await tokenReg.addToken.sendTransactionAsync( + zrxToken.address, + '0x Protocol Token', + 'ZRX', + decimals, + NULL_BYTES, + NULL_BYTES, + { + from: owner, + gas: addTokenGasEstimate, + }, + ), ); - await tokenReg.addToken.sendTransactionAsync( - etherToken.address, - 'Ether Token', - 'WETH', - decimals, - NULL_BYTES, - NULL_BYTES, - { - from: owner, - gas: addTokenGasEstimate, - }, + await web3Wrapper.awaitTransactionSuccessAsync( + await tokenReg.addToken.sendTransactionAsync( + etherToken.address, + 'Ether Token', + 'WETH', + decimals, + NULL_BYTES, + NULL_BYTES, + { + from: owner, + gas: addTokenGasEstimate, + }, + ), ); for (const token of erc20TokenInfo) { const totalSupply = new BigNumber(100000000000000000000); @@ -115,17 +124,19 @@ export const runV1MigrationsAsync = async (provider: Provider, artifactsDir: str token.decimals, totalSupply, ); - await tokenReg.addToken.sendTransactionAsync( - dummyToken.address, - token.name, - token.symbol, - token.decimals, - token.ipfsHash, - token.swarmHash, - { - from: owner, - gas: addTokenGasEstimate, - }, + await web3Wrapper.awaitTransactionSuccessAsync( + await tokenReg.addToken.sendTransactionAsync( + dummyToken.address, + token.name, + token.symbol, + token.decimals, + token.ipfsHash, + token.swarmHash, + { + from: owner, + gas: addTokenGasEstimate, + }, + ), ); } }; |