diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2018-08-22 11:43:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-22 11:43:23 +0800 |
commit | 80e52464a6fdf9576776214f77e46d441b959b06 (patch) | |
tree | 964c5c3cb0eeacf70bece4e485b5fddceea2adb4 /packages/migrations/src | |
parent | f53157414f144a7ea8c24126c9d75d3168228130 (diff) | |
parent | 3760eb5bafcc0980b3a42dd5f10e745390702b16 (diff) | |
download | dexon-sol-tools-80e52464a6fdf9576776214f77e46d441b959b06.tar dexon-sol-tools-80e52464a6fdf9576776214f77e46d441b959b06.tar.gz dexon-sol-tools-80e52464a6fdf9576776214f77e46d441b959b06.tar.bz2 dexon-sol-tools-80e52464a6fdf9576776214f77e46d441b959b06.tar.lz dexon-sol-tools-80e52464a6fdf9576776214f77e46d441b959b06.tar.xz dexon-sol-tools-80e52464a6fdf9576776214f77e46d441b959b06.tar.zst dexon-sol-tools-80e52464a6fdf9576776214f77e46d441b959b06.zip |
Merge pull request #985 from 0xProject/feature/contracts/orderValidator
[contracts] Add contract for batch validating orders
Diffstat (limited to 'packages/migrations/src')
-rw-r--r-- | packages/migrations/src/2.0.0-beta-testnet/artifacts.ts | 2 | ||||
-rw-r--r-- | packages/migrations/src/2.0.0-beta-testnet/migration.ts | 11 | ||||
-rw-r--r-- | packages/migrations/src/2.0.0/artifacts.ts | 2 | ||||
-rw-r--r-- | packages/migrations/src/2.0.0/migration.ts | 15 |
4 files changed, 29 insertions, 1 deletions
diff --git a/packages/migrations/src/2.0.0-beta-testnet/artifacts.ts b/packages/migrations/src/2.0.0-beta-testnet/artifacts.ts index c9a341eb3..5fcf14328 100644 --- a/packages/migrations/src/2.0.0-beta-testnet/artifacts.ts +++ b/packages/migrations/src/2.0.0-beta-testnet/artifacts.ts @@ -4,10 +4,12 @@ import * as AssetProxyOwner from '../../artifacts/2.0.0-beta-testnet/AssetProxyO import * as ERC20Proxy from '../../artifacts/2.0.0-beta-testnet/ERC20Proxy.json'; import * as ERC721Proxy from '../../artifacts/2.0.0-beta-testnet/ERC721Proxy.json'; import * as Exchange from '../../artifacts/2.0.0-beta-testnet/Exchange.json'; +import * as OrderValidator from '../../artifacts/2.0.0-beta-testnet/OrderValidator.json'; export const artifacts = { AssetProxyOwner: (AssetProxyOwner as any) as ContractArtifact, Exchange: (Exchange as any) as ContractArtifact, ERC20Proxy: (ERC20Proxy as any) as ContractArtifact, ERC721Proxy: (ERC721Proxy as any) as ContractArtifact, + OrderValidator: (OrderValidator as any) as ContractArtifact, }; 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 19fe5f02c..cc9f5a859 100644 --- a/packages/migrations/src/2.0.0-beta-testnet/migration.ts +++ b/packages/migrations/src/2.0.0-beta-testnet/migration.ts @@ -12,6 +12,7 @@ import { AssetProxyOwnerContract } from './contract_wrappers/asset_proxy_owner'; import { ERC20ProxyContract } from './contract_wrappers/erc20_proxy'; import { ERC721ProxyContract } from './contract_wrappers/erc721_proxy'; import { ExchangeContract } from './contract_wrappers/exchange'; +import { OrderValidatorContract } from './contract_wrappers/order_validator'; /** * Custom migrations should be defined in this function. This will be called with the CLI 'migrate:v2-beta-testnet' command. @@ -75,6 +76,16 @@ export const runV2TestnetMigrationsAsync = async ( ); artifactsWriter.saveArtifact(assetProxyOwner); + // Deploy OrderValidator + const orderValidator = await OrderValidatorContract.deployFrom0xArtifactAsync( + artifacts.OrderValidator, + provider, + txDefaults, + exchange.address, + zrxAssetData, + ); + artifactsWriter.saveArtifact(orderValidator); + // Authorize Exchange contracts to call AssetProxies txHash = await erc20proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address); logUtils.log(`transactionHash: ${txHash}`); diff --git a/packages/migrations/src/2.0.0/artifacts.ts b/packages/migrations/src/2.0.0/artifacts.ts index 8bbd1fcd9..da0dec6c0 100644 --- a/packages/migrations/src/2.0.0/artifacts.ts +++ b/packages/migrations/src/2.0.0/artifacts.ts @@ -7,6 +7,7 @@ import * as ERC20Proxy from '../../artifacts/2.0.0/ERC20Proxy.json'; import * as ERC721Proxy from '../../artifacts/2.0.0/ERC721Proxy.json'; import * as Exchange from '../../artifacts/2.0.0/Exchange.json'; import * as Forwarder from '../../artifacts/2.0.0/Forwarder.json'; +import * as OrderValidator from '../../artifacts/2.0.0/OrderValidator.json'; import * as WETH9 from '../../artifacts/2.0.0/WETH9.json'; import * as ZRX from '../../artifacts/2.0.0/ZRXToken.json'; @@ -20,4 +21,5 @@ export const artifacts = { ERC20Proxy: (ERC20Proxy as any) as ContractArtifact, ERC721Proxy: (ERC721Proxy as any) as ContractArtifact, Forwarder: (Forwarder as any) as ContractArtifact, + OrderValidator: (OrderValidator as any) as ContractArtifact, }; diff --git a/packages/migrations/src/2.0.0/migration.ts b/packages/migrations/src/2.0.0/migration.ts index 0566e67e8..e1dcea8b0 100644 --- a/packages/migrations/src/2.0.0/migration.ts +++ b/packages/migrations/src/2.0.0/migration.ts @@ -14,6 +14,7 @@ import { ERC20ProxyContract } from './contract_wrappers/erc20_proxy'; import { ERC721ProxyContract } from './contract_wrappers/erc721_proxy'; import { ExchangeContract } from './contract_wrappers/exchange'; import { ForwarderContract } from './contract_wrappers/forwarder'; +import { OrderValidatorContract } from './contract_wrappers/order_validator'; import { WETH9Contract } from './contract_wrappers/weth9'; import { ZRXTokenContract } from './contract_wrappers/zrx_token'; @@ -49,11 +50,12 @@ export const runV2MigrationsAsync = async (provider: Provider, artifactsDir: str artifactsWriter.saveArtifact(etherToken); // Exchange + const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address); const exchange = await ExchangeContract.deployFrom0xArtifactAsync( artifacts.Exchange, provider, txDefaults, - assetDataUtils.encodeERC20AssetData(zrxToken.address), + zrxAssetData, ); artifactsWriter.saveArtifact(exchange); @@ -75,6 +77,7 @@ export const runV2MigrationsAsync = async (provider: Provider, artifactsDir: str secondsRequired, ); artifactsWriter.saveArtifact(assetProxyOwner); + await web3Wrapper.awaitTransactionSuccessAsync( await erc20proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner, @@ -139,4 +142,14 @@ export const runV2MigrationsAsync = async (provider: Provider, artifactsDir: str assetDataUtils.encodeERC20AssetData(etherToken.address), ); artifactsWriter.saveArtifact(forwarder); + + // OrderValidator + const orderValidator = await OrderValidatorContract.deployFrom0xArtifactAsync( + artifacts.OrderValidator, + provider, + txDefaults, + exchange.address, + zrxAssetData, + ); + artifactsWriter.saveArtifact(orderValidator); }; |