diff options
author | Jacob Evans <jacob@dekz.net> | 2019-01-11 06:29:53 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2019-01-12 15:50:04 +0800 |
commit | 34cce04c434cf34c7fc742aa1a3ccdb8c6f06a56 (patch) | |
tree | 0a4411c04d0300e69b49d399dbb528c7fc242a62 /packages/migrations/src | |
parent | 6aae0c5b78a0af9718bc2e00018344d390613536 (diff) | |
download | dexon-sol-tools-34cce04c434cf34c7fc742aa1a3ccdb8c6f06a56.tar dexon-sol-tools-34cce04c434cf34c7fc742aa1a3ccdb8c6f06a56.tar.gz dexon-sol-tools-34cce04c434cf34c7fc742aa1a3ccdb8c6f06a56.tar.bz2 dexon-sol-tools-34cce04c434cf34c7fc742aa1a3ccdb8c6f06a56.tar.lz dexon-sol-tools-34cce04c434cf34c7fc742aa1a3ccdb8c6f06a56.tar.xz dexon-sol-tools-34cce04c434cf34c7fc742aa1a3ccdb8c6f06a56.tar.zst dexon-sol-tools-34cce04c434cf34c7fc742aa1a3ccdb8c6f06a56.zip |
Register ERC20/721 into MAP
Diffstat (limited to 'packages/migrations/src')
-rw-r--r-- | packages/migrations/src/migration.ts | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts index 3d97409e6..8e6ae7726 100644 --- a/packages/migrations/src/migration.ts +++ b/packages/migrations/src/migration.ts @@ -18,6 +18,8 @@ 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]; // Proxies const erc20Proxy = await wrappers.ERC20ProxyContract.deployFrom0xArtifactAsync( @@ -50,24 +52,6 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial zrxAssetData, ); - // Multisigs - const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync(); - const owners = [accounts[0], accounts[1]]; - const confirmationsRequired = new BigNumber(2); - const secondsRequired = new BigNumber(0); - const owner = accounts[0]; - - // AssetProxyOwner - const assetProxyOwner = await wrappers.AssetProxyOwnerContract.deployFrom0xArtifactAsync( - artifacts.AssetProxyOwner, - provider, - txDefaults, - owners, - [erc20Proxy.address, erc721Proxy.address], - confirmationsRequired, - secondsRequired, - ); - // Dummy ERC20 tokens for (const token of erc20TokenInfo) { const totalSupply = new BigNumber(1000000000000000000000000000); @@ -122,6 +106,14 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial }), ); + // Register Asset Proxies to the MultiAssetProxy + await web3Wrapper.awaitTransactionSuccessAsync( + await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc20Proxy.address), + ); + await web3Wrapper.awaitTransactionSuccessAsync( + await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc721Proxy.address), + ); + // Register the Asset Proxies to the Exchange await web3Wrapper.awaitTransactionSuccessAsync( await exchange.registerAssetProxy.sendTransactionAsync(erc20Proxy.address), @@ -160,6 +152,22 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial exchange.address, ); + // Multisigs + const owners = [accounts[0], accounts[1]]; + const confirmationsRequired = new BigNumber(2); + const secondsRequired = new BigNumber(0); + + // AssetProxyOwner + const assetProxyOwner = await wrappers.AssetProxyOwnerContract.deployFrom0xArtifactAsync( + artifacts.AssetProxyOwner, + provider, + txDefaults, + owners, + [erc20Proxy.address, erc721Proxy.address, multiAssetProxy.address], + confirmationsRequired, + secondsRequired, + ); + // Transfer Ownership to the Asset Proxy Owner await web3Wrapper.awaitTransactionSuccessAsync( await erc20Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, { |