aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/abi-gen-wrappers/CHANGELOG.json9
-rw-r--r--packages/abi-gen-wrappers/package.json2
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts824
-rw-r--r--packages/abi-gen-wrappers/src/index.ts1
-rw-r--r--packages/contract-addresses/CHANGELOG.json9
-rw-r--r--packages/contract-addresses/src/index.ts10
-rw-r--r--packages/contract-artifacts/CHANGELOG.json9
-rw-r--r--packages/contract-artifacts/artifacts/MultiAssetProxy.json263
-rw-r--r--packages/contract-artifacts/src/index.ts4
-rw-r--r--packages/contract-artifacts/tsconfig.json1
-rw-r--r--packages/contract-wrappers/test/utils/token_utils.ts12
-rw-r--r--packages/migrations/CHANGELOG.json9
-rw-r--r--packages/migrations/src/migration.ts123
13 files changed, 1222 insertions, 54 deletions
diff --git a/packages/abi-gen-wrappers/CHANGELOG.json b/packages/abi-gen-wrappers/CHANGELOG.json
index 028415b9c..1879d7696 100644
--- a/packages/abi-gen-wrappers/CHANGELOG.json
+++ b/packages/abi-gen-wrappers/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.2.0",
+ "changes": [
+ {
+ "note": "Added `MultiAssetProxy`",
+ "pr": 1503
+ }
+ ]
+ },
+ {
"timestamp": 1547225310,
"version": "2.1.1",
"changes": [
diff --git a/packages/abi-gen-wrappers/package.json b/packages/abi-gen-wrappers/package.json
index c97810548..14aa64e9e 100644
--- a/packages/abi-gen-wrappers/package.json
+++ b/packages/abi-gen-wrappers/package.json
@@ -18,7 +18,7 @@
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output src/generated-wrappers --backend ethers"
},
"config": {
- "abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DutchAuction|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IValidator|IWallet|OrderValidator|WETH9|ZRXToken).json"
+ "abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DutchAuction|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IValidator|IWallet|MultiAssetProxy|OrderValidator|WETH9|ZRXToken).json"
},
"repository": {
"type": "git",
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts
new file mode 100644
index 000000000..b43a345ae
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts
@@ -0,0 +1,824 @@
+// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
+// tslint:disable:no-unused-variable
+// tslint:disable:no-unbound-method
+import { BaseContract } from '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type MultiAssetProxyEventArgs =
+ | MultiAssetProxyAuthorizedAddressAddedEventArgs
+ | MultiAssetProxyAuthorizedAddressRemovedEventArgs
+ | MultiAssetProxyAssetProxyRegisteredEventArgs;
+
+export enum MultiAssetProxyEvents {
+ AuthorizedAddressAdded = 'AuthorizedAddressAdded',
+ AuthorizedAddressRemoved = 'AuthorizedAddressRemoved',
+ AssetProxyRegistered = 'AssetProxyRegistered',
+}
+
+export interface MultiAssetProxyAuthorizedAddressAddedEventArgs extends DecodedLogArgs {
+ target: string;
+ caller: string;
+}
+
+export interface MultiAssetProxyAuthorizedAddressRemovedEventArgs extends DecodedLogArgs {
+ target: string;
+ caller: string;
+}
+
+export interface MultiAssetProxyAssetProxyRegisteredEventArgs extends DecodedLogArgs {
+ id: string;
+ assetProxy: string;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class MultiAssetProxyContract extends BaseContract {
+ public assetProxies = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ const functionSignature = 'assetProxies(bytes4)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.assetProxies;
+ const encodedData = ethersFunction.encode([index_0
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'assetProxies'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public addAuthorizedAddress = {
+ async sendTransactionAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target
+ ]);
+ const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.addAuthorizedAddress.estimateGasAsync.bind(
+ self,
+ target
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ target: string,
+ ): string {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ target: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ const functionSignature = 'addAuthorizedAddress(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addAuthorizedAddress;
+ const encodedData = ethersFunction.encode([target
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'addAuthorizedAddress'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public authorities = {
+ async callAsync(
+ index_0: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ const functionSignature = 'authorities(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorities;
+ const encodedData = ethersFunction.encode([index_0
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'authorities'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public getAssetProxy = {
+ async callAsync(
+ assetProxyId: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ const functionSignature = 'getAssetProxy(bytes4)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [assetProxyId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAssetProxy;
+ const encodedData = ethersFunction.encode([assetProxyId
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getAssetProxy'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public removeAuthorizedAddress = {
+ async sendTransactionAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target
+ ]);
+ const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.removeAuthorizedAddress.estimateGasAsync.bind(
+ self,
+ target
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ target: string,
+ ): string {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ target: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ const functionSignature = 'removeAuthorizedAddress(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddress;
+ const encodedData = ethersFunction.encode([target
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddress'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public owner = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ const functionSignature = 'owner()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public removeAuthorizedAddressAtIndex = {
+ async sendTransactionAsync(
+ target: string,
+ index: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
+ [target,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ index
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
+ index
+ ]);
+ const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
+ index
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(
+ self,
+ target,
+ index
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ target: string,
+ index: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
+ [target,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ index
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
+ index
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ target: string,
+ index: BigNumber,
+ ): string {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
+ [target,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ index
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
+ index
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ target: string,
+ index: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ const functionSignature = 'removeAuthorizedAddressAtIndex(address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [target,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ index
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
+ index
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddressAtIndex;
+ const encodedData = ethersFunction.encode([target,
+ index
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddressAtIndex'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public getProxyId = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ const functionSignature = 'getProxyId()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getProxyId;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getProxyId'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public authorized = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ const functionSignature = 'authorized(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [index_0
+ ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorized;
+ const encodedData = ethersFunction.encode([index_0
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'authorized'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public registerAssetProxy = {
+ async sendTransactionAsync(
+ assetProxy: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs;
+ [assetProxy
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxy
+ ]);
+ const encodedData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.registerAssetProxy.estimateGasAsync.bind(
+ self,
+ assetProxy
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ assetProxy: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs;
+ [assetProxy
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ assetProxy: string,
+ ): string {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs;
+ [assetProxy
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ assetProxy: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ const functionSignature = 'registerAssetProxy(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [assetProxy
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxy
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.registerAssetProxy;
+ const encodedData = ethersFunction.encode([assetProxy
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'registerAssetProxy'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public getAuthorizedAddresses = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string[]
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ const functionSignature = 'getAuthorizedAddresses()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuthorizedAddresses;
+ const encodedData = ethersFunction.encode([]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'getAuthorizedAddresses'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray[0];
+ },
+ };
+ public transferOwnership = {
+ async sendTransactionAsync(
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
+ ]);
+ const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transferOwnership.estimateGasAsync.bind(
+ self,
+ newOwner
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ newOwner: string,
+ ): string {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ newOwner: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ const functionSignature = 'transferOwnership(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
+ const encodedData = ethersFunction.encode([newOwner
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
+ BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ let resultArray = ethersFunction.decode(rawCallResult);
+ const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact | SimpleContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<MultiAssetProxyContract> {
+ if (_.isUndefined(artifact.compilerOutput)) {
+ throw new Error('Compiler output not found in the artifact file');
+ }
+ const bytecode = artifact.compilerOutput.evm.bytecode.object;
+ const abi = artifact.compilerOutput.abi;
+ return MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<MultiAssetProxyContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, []);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {data: txData},
+ txDefaults,
+ web3Wrapper.estimateGasAsync.bind(web3Wrapper),
+ );
+ const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ logUtils.log(`transactionHash: ${txHash}`);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ logUtils.log(`MultiAssetProxy successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new MultiAssetProxyContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('MultiAssetProxy', abi, address, provider, txDefaults);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
+ }
+} // tslint:disable:max-file-line-count
+// tslint:enable:no-unbound-method
diff --git a/packages/abi-gen-wrappers/src/index.ts b/packages/abi-gen-wrappers/src/index.ts
index b5a7d0cfe..1a81c0187 100644
--- a/packages/abi-gen-wrappers/src/index.ts
+++ b/packages/abi-gen-wrappers/src/index.ts
@@ -10,6 +10,7 @@ export * from './generated-wrappers/exchange';
export * from './generated-wrappers/forwarder';
export * from './generated-wrappers/i_validator';
export * from './generated-wrappers/i_wallet';
+export * from './generated-wrappers/multi_asset_proxy';
export * from './generated-wrappers/order_validator';
export * from './generated-wrappers/weth9';
export * from './generated-wrappers/zrx_token';
diff --git a/packages/contract-addresses/CHANGELOG.json b/packages/contract-addresses/CHANGELOG.json
index 36684d443..014495351 100644
--- a/packages/contract-addresses/CHANGELOG.json
+++ b/packages/contract-addresses/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.2.0",
+ "changes": [
+ {
+ "note": "Added migration for `MultiAssetProxy` contract",
+ "pr": 1503
+ }
+ ]
+ },
+ {
"version": "2.1.0",
"changes": [
{
diff --git a/packages/contract-addresses/src/index.ts b/packages/contract-addresses/src/index.ts
index d181a1bec..4f580e825 100644
--- a/packages/contract-addresses/src/index.ts
+++ b/packages/contract-addresses/src/index.ts
@@ -70,15 +70,15 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
},
// NetworkId 50 represents our Ganache snapshot generated from migrations.
50: {
- exchange: '0x48bacb9266a570d521063ef5dd96e61686dbe788',
erc20Proxy: '0x1dc4c1cefef38a777b15aa20260a54e584b16c48',
erc721Proxy: '0x1d7022f5b17d2f8b695918fb48fa1089c9f85401',
zrxToken: '0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c',
etherToken: '0x0b1ba0af832d7c05fd64161e0db78e85978e8082',
- assetProxyOwner: '0x34d402f14d58e001d8efbe6585051bf9706aa064',
- forwarder: '0xb69e673309512a9d726f87304c6984054f87a93b',
- orderValidator: '0xe86bb98fcf9bff3512c74589b78fb168200cc546',
- dutchAuction: '0xdc688d29394a3f1e6f1e5100862776691afaf3d2',
+ exchange: '0x48bacb9266a570d521063ef5dd96e61686dbe788',
+ assetProxyOwner: '0x04b5dadd2c0d6a261bfafbc964e0cac48585def3',
+ forwarder: '0x6000eca38b8b5bba64986182fe2a69c57f6b5414',
+ orderValidator: '0x32eecaf51dfea9618e9bc94e9fbfddb1bbdcba15',
+ dutchAuction: '0x7e3f4e1deb8d3a05d9d2da87d9521268d0ec3239',
},
};
diff --git a/packages/contract-artifacts/CHANGELOG.json b/packages/contract-artifacts/CHANGELOG.json
index 237014d09..fcd99fc3b 100644
--- a/packages/contract-artifacts/CHANGELOG.json
+++ b/packages/contract-artifacts/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "1.3.0",
+ "changes": [
+ {
+ "note": "Added artifact for `MultiAssetProxy` contract",
+ "pr": 1503
+ }
+ ]
+ },
+ {
"version": "1.2.0",
"changes": [
{
diff --git a/packages/contract-artifacts/artifacts/MultiAssetProxy.json b/packages/contract-artifacts/artifacts/MultiAssetProxy.json
new file mode 100644
index 000000000..f143cd817
--- /dev/null
+++ b/packages/contract-artifacts/artifacts/MultiAssetProxy.json
@@ -0,0 +1,263 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "MultiAssetProxy",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "bytes4"
+ }
+ ],
+ "name": "assetProxies",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ }
+ ],
+ "name": "addAuthorizedAddress",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "authorities",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "assetProxyId",
+ "type": "bytes4"
+ }
+ ],
+ "name": "getAssetProxy",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ }
+ ],
+ "name": "removeAuthorizedAddress",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "name": "index",
+ "type": "uint256"
+ }
+ ],
+ "name": "removeAuthorizedAddressAtIndex",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getProxyId",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes4"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "authorized",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "assetProxy",
+ "type": "address"
+ }
+ ],
+ "name": "registerAssetProxy",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getAuthorizedAddresses",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "fallback"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "caller",
+ "type": "address"
+ }
+ ],
+ "name": "AuthorizedAddressAdded",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "caller",
+ "type": "address"
+ }
+ ],
+ "name": "AuthorizedAddressRemoved",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "id",
+ "type": "bytes4"
+ },
+ {
+ "indexed": false,
+ "name": "assetProxy",
+ "type": "address"
+ }
+ ],
+ "name": "AssetProxyRegistered",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405260008054600160a060020a03191633179055611527806100256000396000f3006080604052600436106100b95763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633fd3c997811461048457806342f1181e146104e7578063494503d414610517578063607041081461052f57806370712939146105695780638da5cb5b146105975780639ad26744146105ac578063ae25532e146105dd578063b918161114610627578063c585bb9314610669578063d39de6e914610697578063f2fde38b146106fc575b3480156100c557600080fd5b507fffffffff00000000000000000000000000000000000000000000000000000000600035167fa85e59e40000000000000000000000000000000000000000000000000000000081141561047f573360005260026020526040600020541515610199577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1553454e4445525f4e4f545f415554484f52495a454400000000000000604052600060605260646000fd5b600435602881013560488201356048820183016020810335604883018501602081033580830315610235577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0f4c454e4754485f4d49534d4154434800000000000000000000000000604052600060605260646000fd5b60646000803760806004526064356020840260008060005b8381101561047c5780890135858102818782041487151715156102db577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1055494e543235365f4f564552464c4f57000000000000000000000000604052600060605260646000fd5b8060645282890135606881018d018f01602081038035600481101561038a577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1e4c454e4754485f475245415445525f5448414e5f335f5245515549526040527f454400000000000000000000000000000000000000000000000000000000000060605260646000fd5b7fffffffff00000000000000000000000000000000000000000000000000000000833516898103156103cb5780995089608452600160a45260406084205498505b881515610443577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1a41535345545f50524f58595f444f45535f4e4f545f45584953540000604052600060605260646000fd5b60208201836084376000808360a4016000808d5af1801515610469573d6000803e3d6000fd5b505050505050505060208101905061024d565b50005b600080fd5b34801561049057600080fd5b506104be7fffffffff000000000000000000000000000000000000000000000000000000006004351661072a565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156104f357600080fd5b5061051573ffffffffffffffffffffffffffffffffffffffff60043516610752565b005b34801561052357600080fd5b506104be60043561093e565b34801561053b57600080fd5b506104be7fffffffff0000000000000000000000000000000000000000000000000000000060043516610973565b34801561057557600080fd5b5061051573ffffffffffffffffffffffffffffffffffffffff600435166109bd565b3480156105a357600080fd5b506104be610cb6565b3480156105b857600080fd5b5061051573ffffffffffffffffffffffffffffffffffffffff60043516602435610cd2565b3480156105e957600080fd5b506105f2611087565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b34801561063357600080fd5b5061065573ffffffffffffffffffffffffffffffffffffffff600435166110bd565b604080519115158252519081900360200190f35b34801561067557600080fd5b5061051573ffffffffffffffffffffffffffffffffffffffff600435166110d2565b3480156106a357600080fd5b506106ac61135f565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156106e85781810151838201526020016106d0565b505050509050019250505060405180910390f35b34801561070857600080fd5b5061051573ffffffffffffffffffffffffffffffffffffffff600435166113ce565b60016020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1633146107d857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526002602052604090205460ff161561086d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5441524745545f414c52454144595f415554484f52495a454400000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b600380548290811061094c57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b7fffffffff000000000000000000000000000000000000000000000000000000001660009081526001602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b6000805473ffffffffffffffffffffffffffffffffffffffff163314610a4457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526002602052604090205460ff161515610ada57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff8116600090815260026020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b600354811015610c6f578173ffffffffffffffffffffffffffffffffffffffff16600382815481101515610b5757fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415610c6757600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610baf57fe5b6000918252602090912001546003805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610be257fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610c6190826114b4565b50610c6f565b600101610b27565b604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d5857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526002602052604090205460ff161515610dee57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b6003548110610e5e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e4445585f4f55545f4f465f424f554e445300000000000000000000000000604482015290519081900360640190fd5b8173ffffffffffffffffffffffffffffffffffffffff16600382815481101515610e8457fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614610f1257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f415554484f52495a45445f414444524553535f4d49534d415443480000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610f8d57fe5b6000918252602090912001546003805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610fc057fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019061103f90826114b4565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b604080517f4d756c746941737365742875696e743235365b5d2c62797465735b5d290000008152905190819003601d0190205b90565b60026020526000908152604090205460ff1681565b600080548190819073ffffffffffffffffffffffffffffffffffffffff16331461115d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b8392508273ffffffffffffffffffffffffffffffffffffffff1663ae25532e6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156111c457600080fd5b505af11580156111d8573d6000803e3d6000fd5b505050506040513d60208110156111ee57600080fd5b50517fffffffff00000000000000000000000000000000000000000000000000000000811660009081526001602052604090205490925073ffffffffffffffffffffffffffffffffffffffff16905080156112aa57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f41535345545f50524f58595f414c52454144595f455849535453000000000000604482015290519081900360640190fd5b7fffffffff00000000000000000000000000000000000000000000000000000000821660008181526001602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88811691909117909155825193845287169083015280517fd2c6b762299c609bdb96520b58a49bfb80186934d4f71a86a367571a15c031949281900390910190a150505050565b606060038054806020026020016040519081016040528092919081815260200182805480156113c457602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611399575b5050505050905090565b60005473ffffffffffffffffffffffffffffffffffffffff16331461145457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116156114b157600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b8154818355818111156114d8576000838152602090206114d89181019083016114dd565b505050565b6110ba91905b808211156114f757600081556001016114e3565b50905600a165627a7a72305820edc27b59aaf514c0deebc8a00d0f17f092fc6e8b8544bcccb6f7e8f4a81c781d0029"
+ }
+ }
+ },
+ "networks": {}
+}
diff --git a/packages/contract-artifacts/src/index.ts b/packages/contract-artifacts/src/index.ts
index bd5f8fee3..1cbda9518 100644
--- a/packages/contract-artifacts/src/index.ts
+++ b/packages/contract-artifacts/src/index.ts
@@ -1,7 +1,7 @@
import * as AssetProxyOwner from '../artifacts/AssetProxyOwner.json';
-import * as DutchAuction from '../artifacts/DutchAuction.json';
import * as DummyERC20Token from '../artifacts/DummyERC20Token.json';
import * as DummyERC721Token from '../artifacts/DummyERC721Token.json';
+import * as DutchAuction from '../artifacts/DutchAuction.json';
import * as ERC20Proxy from '../artifacts/ERC20Proxy.json';
import * as ERC20Token from '../artifacts/ERC20Token.json';
import * as ERC721Proxy from '../artifacts/ERC721Proxy.json';
@@ -10,6 +10,7 @@ import * as Exchange from '../artifacts/Exchange.json';
import * as Forwarder from '../artifacts/Forwarder.json';
import * as IValidator from '../artifacts/IValidator.json';
import * as IWallet from '../artifacts/IWallet.json';
+import * as MultiAssetProxy from '../artifacts/MultiAssetProxy.json';
import * as OrderValidator from '../artifacts/OrderValidator.json';
import * as WETH9 from '../artifacts/WETH9.json';
import * as ZRXToken from '../artifacts/ZRXToken.json';
@@ -27,6 +28,7 @@ export {
Forwarder,
IValidator,
IWallet,
+ MultiAssetProxy,
OrderValidator,
WETH9,
ZRXToken,
diff --git a/packages/contract-artifacts/tsconfig.json b/packages/contract-artifacts/tsconfig.json
index 59169fceb..1aef41bb8 100644
--- a/packages/contract-artifacts/tsconfig.json
+++ b/packages/contract-artifacts/tsconfig.json
@@ -19,6 +19,7 @@
"./artifacts/Forwarder.json",
"./artifacts/IValidator.json",
"./artifacts/IWallet.json",
+ "./artifacts/MultiAssetProxy.json",
"./artifacts/OrderValidator.json",
"./artifacts/WETH9.json",
"./artifacts/ZRXToken.json"
diff --git a/packages/contract-wrappers/test/utils/token_utils.ts b/packages/contract-wrappers/test/utils/token_utils.ts
index f8a88637f..e390d2775 100644
--- a/packages/contract-wrappers/test/utils/token_utils.ts
+++ b/packages/contract-wrappers/test/utils/token_utils.ts
@@ -9,14 +9,14 @@ import { provider, txDefaults, web3Wrapper } from './web3_wrapper';
// Before we were fetching them from the TokenRegistry but now we can't as it's deprecated and removed.
// TODO(albrow): Import these from the migrations package instead of hard-coding them.
const DUMMY_ERC_20_ADRESSES = [
- '0x6dfff22588be9b3ef8cf0ad6dc9b84796f9fb45f',
- '0xcfc18cec799fbd1793b5c43e773c98d4d61cc2db',
- '0xf22469f31527adc53284441bae1665a7b9214dba',
- '0x10add991de718a69dec2117cb6aa28098836511b',
- '0x8d61158a366019ac78db4149d75fff9dda51160d',
+ '0x34d402f14d58e001d8efbe6585051bf9706aa064',
+ '0x25b8fe1de9daf8ba351890744ff28cf7dfa8f5e3',
+ '0xcdb594a32b1cc3479d8746279712c39d18a07fc0',
+ '0x1e2f9e10d02a6b8f8f69fcbf515e75039d2ea30d',
+ '0xbe0037eaf2d64fe5529bca93c18c9702d3930376',
];
-const DUMMY_ERC_721_ADRESSES = ['0x131855dda0aaff096f6854854c55a4debf61077a'];
+const DUMMY_ERC_721_ADRESSES = ['0x07f96aa816c1f244cbc6ef114bb2b023ba54a2eb'];
export const tokenUtils = {
getDummyERC20TokenAddresses(): string[] {
diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json
index 13aca373b..6a7df758b 100644
--- a/packages/migrations/CHANGELOG.json
+++ b/packages/migrations/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.4.0",
+ "changes": [
+ {
+ "note": "Added migrations for `MultiAssetProxy` contract",
+ "pr": 1503
+ }
+ ]
+ },
+ {
"timestamp": 1547225310,
"version": "2.3.1",
"changes": [
diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts
index 99d1719f1..e0f245017 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,22 +52,35 @@ 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];
+ // Dummy ERC20 tokens
+ for (const token of erc20TokenInfo) {
+ const totalSupply = new BigNumber(1000000000000000000000000000);
+ // tslint:disable-next-line:no-unused-variable
+ const dummyErc20Token = await wrappers.DummyERC20TokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyERC20Token,
+ provider,
+ txDefaults,
+ token.name,
+ token.symbol,
+ token.decimals,
+ totalSupply,
+ );
+ }
- // AssetProxyOwner
- const assetProxyOwner = await wrappers.AssetProxyOwnerContract.deployFrom0xArtifactAsync(
- artifacts.AssetProxyOwner,
+ // ERC721
+ // tslint:disable-next-line:no-unused-variable
+ const cryptoKittieToken = await wrappers.DummyERC721TokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyERC721Token,
+ provider,
+ txDefaults,
+ erc721TokenInfo[0].name,
+ erc721TokenInfo[0].symbol,
+ );
+
+ const multiAssetProxy = await wrappers.MultiAssetProxyContract.deployFrom0xArtifactAsync(
+ artifacts.MultiAssetProxy,
provider,
txDefaults,
- owners,
- [erc20Proxy.address, erc721Proxy.address],
- confirmationsRequired,
- secondsRequired,
);
await web3Wrapper.awaitTransactionSuccessAsync(
@@ -74,20 +89,33 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
}),
);
await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
from: owner,
}),
);
await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
+ await multiAssetProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
from: owner,
}),
);
+
+ // MultiAssetProxy
await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, {
from: owner,
}),
);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, {
+ from: owner,
+ }),
+ );
+ 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(
@@ -96,30 +124,8 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
await web3Wrapper.awaitTransactionSuccessAsync(
await exchange.registerAssetProxy.sendTransactionAsync(erc721Proxy.address),
);
-
- // Dummy ERC20 tokens
- for (const token of erc20TokenInfo) {
- const totalSupply = new BigNumber(1000000000000000000000000000);
- // tslint:disable-next-line:no-unused-variable
- const dummyErc20Token = await wrappers.DummyERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC20Token,
- provider,
- txDefaults,
- token.name,
- token.symbol,
- token.decimals,
- totalSupply,
- );
- }
-
- // ERC721
- // tslint:disable-next-line:no-unused-variable
- const cryptoKittieToken = await wrappers.DummyERC721TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC721Token,
- provider,
- txDefaults,
- erc721TokenInfo[0].name,
- erc721TokenInfo[0].symbol,
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await exchange.registerAssetProxy.sendTransactionAsync(multiAssetProxy.address),
);
// Forwarder
@@ -149,6 +155,39 @@ 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, {
+ from: owner,
+ }),
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
+ from: owner,
+ }),
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await multiAssetProxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
+ from: owner,
+ }),
+ );
+
// Fund the Forwarder with ZRX
const zrxDecimals = await zrxToken.decimals.callAsync();
const zrxForwarderAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(5000), zrxDecimals);
@@ -156,7 +195,7 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
await zrxToken.transfer.sendTransactionAsync(forwarder.address, zrxForwarderAmount, txDefaults),
);
- return {
+ const contractAddresses = {
erc20Proxy: erc20Proxy.address,
erc721Proxy: erc721Proxy.address,
zrxToken: zrxToken.address,
@@ -167,6 +206,8 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
orderValidator: orderValidator.address,
dutchAuction: dutchAuction.address,
};
+
+ return contractAddresses;
}
let _cachedContractAddresses: ContractAddresses;