From 4ed111a7d4bf8656aa7bbdba1f6512f549fa5df8 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sat, 8 Jun 2019 16:27:09 -0700 Subject: [PATCH 01/16] Implement StaticCallProxy --- .../contracts/src/StaticCallProxy.sol | 207 ++++++++++++++++++ .../contracts/src/interfaces/IAssetData.sol | 8 +- .../contracts/src/libs/LibAssetProxyIds.sol | 3 + 3 files changed, 217 insertions(+), 1 deletion(-) create mode 100644 contracts/asset-proxy/contracts/src/StaticCallProxy.sol diff --git a/contracts/asset-proxy/contracts/src/StaticCallProxy.sol b/contracts/asset-proxy/contracts/src/StaticCallProxy.sol new file mode 100644 index 0000000000..577fcdc03b --- /dev/null +++ b/contracts/asset-proxy/contracts/src/StaticCallProxy.sol @@ -0,0 +1,207 @@ +/* + + Copyright 2018 ZeroEx Intl. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +pragma solidity ^0.5.5; + + +contract StaticCallProxy { + + // Id of this proxy. + bytes4 constant internal PROXY_ID = bytes4(keccak256("StaticCall(address,bytes,bytes32)")); + + // solhint-disable-next-line payable-fallback + function () + external + { + assembly { + // The first 4 bytes of calldata holds the function selector + let selector := and(calldataload(0), 0xffffffff00000000000000000000000000000000000000000000000000000000) + + // `transferFrom` will be called with the following parameters: + // assetData Encoded byte array. + // from Address to transfer asset from. + // to Address to transfer asset to. + // amount Amount of asset to transfer. + // bytes4(keccak256("transferFrom(bytes,address,address,uint256)")) = 0xa85e59e4 + if eq(selector, 0xa85e59e400000000000000000000000000000000000000000000000000000000) { + + // `transferFrom`. + // The function is marked `external`, so no abi decoding is done for + // us. Instead, we expect the `calldata` memory to contain the + // following: + // + // | Area | Offset | Length | Contents | + // |----------|--------|---------|-------------------------------------| + // | Header | 0 | 4 | function selector | + // | Params | | 4 * 32 | function parameters: | + // | | 4 | | 1. offset to assetData (*) | + // | | 36 | | 2. from | + // | | 68 | | 3. to | + // | | 100 | | 4. amount | + // | Data | | | assetData: | + // | | 132 | 32 | assetData Length | + // | | 164 | ** | assetData Contents | + // + // (*): offset is computed from start of function parameters, so offset + // by an additional 4 bytes in the calldata. + // + // (**): see table below to compute length of assetData Contents + // (***): Note that the `from`, `to`, and `amount` params in calldata are ignored in this function. + // + // WARNING: The ABIv2 specification allows additional padding between + // the Params and Data section. This will result in a larger + // offset to assetData. + + // Load offset to `assetData` + let assetDataOffset := add(calldataload(4), 4) + + // Validate length of `assetData` + let assetDataLen := calldataload(assetDataOffset) + if or(lt(assetDataLen, 100), mod(sub(assetDataLen, 4), 32)) { + // Revert with `Error("INVALID_ASSET_DATA_LENGTH")` + mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) + mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) + mstore(64, 0x00000019494e56414c49445f41535345545f444154415f4c454e475448000000) + mstore(96, 0) + revert(0, 100) + } + + // Ensure that `assetData` ends inside of calldata + let assetDataEnd := add(assetDataOffset, add(assetDataLen, 32)) + if gt(assetDataEnd, calldatasize()) { + // Revert with `Error("INVALID_ASSET_DATA_END")` + mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) + mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) + mstore(64, 0x00000016494e56414c49445f41535345545f444154415f454e44000000000000) + mstore(96, 0) + revert(0, 100) + } + + // Asset data is encoded as follows: + // | Area | Offset | Length | Contents | + // |----------|-------------|---------|--------------------------------------| + // | Header | 0 | 4 | assetProxyId | + // | Params | | 4 * 32 | function parameters: | + // | | 4 | | 1. address of callTarget | + // | | 36 | | 2. offset to staticCallData (*) | + // | | 68 | | 3. expected 32 byte hash of output | + // | Data | | | staticCallData: | + // | | 100 | 32 | 1. staticCallData Length | + // | | 132 | a | 2. staticCallData Contents | + + // In order to find the offset to `staticCallData`, we must add: + // assetDataOffset + // + 32 (assetData len) + // + 4 (proxyId) + // + 32 (callTarget) + let paramsInAssetDataOffset := add(assetDataOffset, 36) + let staticCallDataOffset := add(paramsInAssetDataOffset, calldataload(add(assetDataOffset, 68))) + + // Load length of `staticCallData` + let staticCallDataLen := calldataload(staticCallDataOffset) + + // Ensure `staticCallData` does not begin to outside of `assetData` + let staticCallDataBegin := add(staticCallDataOffset, 32) + let staticCallDataEnd := add(staticCallDataBegin, staticCallDataLen) + if gt(staticCallDataEnd, assetDataEnd) { + // Revert with `Error("INVALID_STATIC_CALL_DATA_OFFSET")` + mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) + mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) + mstore(64, 0x0000001f494e56414c49445f5354415449435f43414c4c5f444154415f4f4646) + mstore(96, 0x5345540000000000000000000000000000000000000000000000000000000000) + revert(0, 100) + } + + // Copy `staticCallData` into memory + calldatacopy( + 0, // memory can be safely overwritten from beginning + staticCallDataBegin, // start of `staticCallData` + staticCallDataLen // copy the entire `staticCallData` + ) + + // In order to find the offset to `callTarget`, we must add: + // assetDataOffset + // + 32 (assetData len) + // + 4 (proxyId) + let callTarget := and( + calldataload(add(assetDataOffset, 36)), + 0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff + ) + + // Perform `callTarget.staticcall(staticCallData)` + let success := staticcall( + gas, // forward all gas + callTarget, // call address `callTarget` + 0, // pointer to start of input + staticCallDataLen, // length of input + 0, // start of memory can be safely overwritten + 0 // don't copy output to memory + ) + + // Copy entire output to start of memory + let outputLen := returndatasize() + returndatacopy( + 0, // copy to memory at 0 + 0, // copy from return data at 0 + outputLen // copy all return data + ) + + // Revert with reason given by `callTarget` if staticcall is unsuccessful + if iszero(success) { + revert(0, outputLen) + } + + // Calculate hash of output + let callResultHash := keccak256(0, outputLen) + + // In order to find the offset to `expectedCallResultHash`, we must add: + // assetDataOffset + // + 32 (assetData len) + // + 4 (proxyId) + // + 32 (callTarget) + // + 32 (assetDataOffset) + let expectedResultHash := calldataload(add(assetDataOffset, 100)) + + if sub(callResultHash, expectedResultHash) { + // Revert with `Error("UNEXPECTED_STATIC_CALL_RESULT")` + mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) + mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) + mstore(64, 0x0000001d554e45585045435445445f5354415449435f43414c4c5f524553554c) + mstore(96, 0x5400000000000000000000000000000000000000000000000000000000000000) + revert(0, 100) + } + + // Return if output matched expected output + return(0, 0) + } + + // Revert if undefined function is called + revert(0, 0) + } + } + + /// @dev Gets the proxy id associated with the proxy address. + /// @return Proxy id. + function getProxyId() + external + pure + returns (bytes4) + { + return PROXY_ID; + } +} \ No newline at end of file diff --git a/contracts/asset-proxy/contracts/src/interfaces/IAssetData.sol b/contracts/asset-proxy/contracts/src/interfaces/IAssetData.sol index b66c4600d7..ba8254aa6a 100644 --- a/contracts/asset-proxy/contracts/src/interfaces/IAssetData.sol +++ b/contracts/asset-proxy/contracts/src/interfaces/IAssetData.sol @@ -48,5 +48,11 @@ interface IAssetData { bytes[] calldata nestedAssetData ) external; - + + function StaticCall( + address callTarget, + bytes calldata staticCallData, + bytes32 callResultHash + ) + external; } diff --git a/contracts/asset-proxy/contracts/src/libs/LibAssetProxyIds.sol b/contracts/asset-proxy/contracts/src/libs/LibAssetProxyIds.sol index 9ea157357e..d4fa173afd 100644 --- a/contracts/asset-proxy/contracts/src/libs/LibAssetProxyIds.sol +++ b/contracts/asset-proxy/contracts/src/libs/LibAssetProxyIds.sol @@ -34,4 +34,7 @@ contract LibAssetProxyIds { // MultiAsset(uint256[],bytes[]) bytes4 constant public MULTI_ASSET_PROXY_ID = 0x94cfcdd7; + + // StaticCall(address,bytes,bytes32) + bytes4 constant public STATIC_CALL_PROXY_ID = 0xc339d10a; } From f0ecda1a487c73a722ea73b8e6daf90963d16d56 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sun, 9 Jun 2019 19:13:48 -0700 Subject: [PATCH 02/16] Use more specific revert reason in ERC1155Proxy --- contracts/asset-proxy/contracts/src/ERC1155Proxy.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/asset-proxy/contracts/src/ERC1155Proxy.sol b/contracts/asset-proxy/contracts/src/ERC1155Proxy.sol index 2089000a32..48a0324ec4 100644 --- a/contracts/asset-proxy/contracts/src/ERC1155Proxy.sol +++ b/contracts/asset-proxy/contracts/src/ERC1155Proxy.sol @@ -179,10 +179,10 @@ contract ERC1155Proxy is // +32 for length field let assetDataEnd := add(assetDataOffset, add(assetDataLength, 32)) if gt(assetDataEnd, calldatasize()) { - // Revert with `Error("INVALID_ASSET_DATA")` + // Revert with `Error("INVALID_ASSET_DATA_END")` mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) - mstore(64, 0x00000012494e56414c49445f41535345545f4441544100000000000000000000) + mstore(64, 0x00000016494e56414c49445f41535345545f444154415f454e44000000000000) mstore(96, 0) revert(0, 100) } From 720d335b094181f781c01a685b0d7a623de235de Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sat, 8 Jun 2019 16:31:05 -0700 Subject: [PATCH 03/16] Add StaticCallProxy types and move 1155 method ABI into order-utils --- packages/0x.js/src/index.ts | 1 - packages/order-utils/src/constants.ts | 31 +++++++++++++++++++++++++++ packages/types/src/index.ts | 17 ++++++++------- 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 3b7e0591a2..e312d73397 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -95,7 +95,6 @@ export { ERC20AssetData, ERC721AssetData, ERC1155AssetData, - ERC1155AssetDataAbi, MultiAssetData, MultiAssetDataWithRecursiveDecoding, SignatureType, diff --git a/packages/order-utils/src/constants.ts b/packages/order-utils/src/constants.ts index 30e8cad634..5391cf2322 100644 --- a/packages/order-utils/src/constants.ts +++ b/packages/order-utils/src/constants.ts @@ -54,6 +54,35 @@ const MULTI_ASSET_METHOD_ABI: MethodAbi = { type: 'function', }; +const ERC1155_METHOD_ABI: MethodAbi = { + constant: false, + inputs: [ + { name: 'tokenAddress', type: 'address' }, + { name: 'tokenIds', type: 'uint256[]' }, + { name: 'tokenValues', type: 'uint256[]' }, + { name: 'callbackData', type: 'bytes' }, + ], + name: 'ERC1155Assets', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', +}; + +const STATIC_CALL_METHOD_ABI: MethodAbi = { + constant: false, + inputs: [ + { name: 'callTarget', type: 'address' }, + { name: 'staticCallData', type: 'bytes' }, + { name: 'callResultHash', type: 'bytes32' }, + ], + name: 'StaticCall', + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'function', +}; + export const constants = { NULL_ADDRESS: '0x0000000000000000000000000000000000000000', NULL_BYTES: '0x', @@ -117,4 +146,6 @@ export const constants = { ERC20_METHOD_ABI, ERC721_METHOD_ABI, MULTI_ASSET_METHOD_ABI, + ERC1155_METHOD_ABI, + STATIC_CALL_METHOD_ABI, }; diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 560ebf3c61..0e70969b2b 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -164,6 +164,7 @@ export enum AssetProxyId { ERC721 = '0x02571792', MultiAsset = '0x94cfcdd7', ERC1155 = '0xa7cb5fb7', + StaticCall = '0xc339d10a', } export interface ERC20AssetData { @@ -185,6 +186,13 @@ export interface ERC1155AssetData { callbackData: string; } +export interface StaticCallAssetData { + assetProxyId: string; + callTarget: string; + staticCallData: string; + callResultHash: string; +} + export interface ERC1155AssetDataNoProxyId { tokenAddress: string; tokenValues: BigNumber[]; @@ -192,14 +200,7 @@ export interface ERC1155AssetDataNoProxyId { callbackData: string; } -export const ERC1155AssetDataAbi = [ - { name: 'tokenAddress', type: 'address' }, - { name: 'tokenIds', type: 'uint256[]' }, - { name: 'tokenValues', type: 'uint256[]' }, - { name: 'callbackData', type: 'bytes' }, -]; - -export type SingleAssetData = ERC20AssetData | ERC721AssetData | ERC1155AssetData; +export type SingleAssetData = ERC20AssetData | ERC721AssetData | ERC1155AssetData | StaticCallAssetData; export interface MultiAssetData { assetProxyId: string; From 570c1e18092acce2158fdaae14acf1ba6419f43b Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sat, 8 Jun 2019 16:33:19 -0700 Subject: [PATCH 04/16] Add StaticCallAssetData encoding and decoding --- packages/order-utils/src/asset_data_utils.ts | 62 ++++++++++++++++--- packages/order-utils/src/index.ts | 1 - .../order-utils/test/asset_data_utils_test.ts | 11 ++-- 3 files changed, 60 insertions(+), 14 deletions(-) diff --git a/packages/order-utils/src/asset_data_utils.ts b/packages/order-utils/src/asset_data_utils.ts index 799716a6d4..64ca45a84e 100644 --- a/packages/order-utils/src/asset_data_utils.ts +++ b/packages/order-utils/src/asset_data_utils.ts @@ -1,13 +1,13 @@ import { AssetProxyId, ERC1155AssetData, - ERC1155AssetDataAbi, ERC1155AssetDataNoProxyId, ERC20AssetData, ERC721AssetData, MultiAssetData, MultiAssetDataWithRecursiveDecoding, SingleAssetData, + StaticCallAssetData, } from '@0x/types'; import { AbiEncoder, BigNumber } from '@0x/utils'; import * as _ from 'lodash'; @@ -31,7 +31,7 @@ export const assetDataUtils = { return assetData; }, /** - * Decodes an ERC20 assetData hex string into it's corresponding ERC20 tokenAddress & assetProxyId + * Decodes an ERC20 assetData hex string into its corresponding ERC20 tokenAddress & assetProxyId * @param assetData Hex encoded assetData string to decode * @return An object containing the decoded tokenAddress & assetProxyId */ @@ -60,7 +60,7 @@ export const assetDataUtils = { return assetData; }, /** - * Decodes an ERC721 assetData hex string into it's corresponding ERC721 tokenAddress, tokenId & assetProxyId + * Decodes an ERC721 assetData hex string into its corresponding ERC721 tokenAddress, tokenId & assetProxyId * @param assetData Hex encoded assetData string to decode * @return An object containing the decoded tokenAddress, tokenId & assetProxyId */ @@ -91,13 +91,13 @@ export const assetDataUtils = { tokenValues: BigNumber[], callbackData: string, ): string { - const abiEncoder = AbiEncoder.createMethod('ERC1155Assets', ERC1155AssetDataAbi); + const abiEncoder = AbiEncoder.createMethod('ERC1155Assets', constants.ERC1155_METHOD_ABI.inputs); const args = [tokenAddress, tokenIds, tokenValues, callbackData]; const assetData = abiEncoder.encode(args, encodingRules); return assetData; }, /** - * Decodes an ERC1155 assetData hex string into it's corresponding ERC1155 components. + * Decodes an ERC1155 assetData hex string into its corresponding ERC1155 components. * @param assetData Hex encoded assetData string to decode * @return An object containing the decoded tokenAddress, tokenIds, tokenValues, callbackData & assetProxyId */ @@ -106,7 +106,7 @@ export const assetDataUtils = { if (assetProxyId !== AssetProxyId.ERC1155) { throw new Error(`Invalid assetProxyId. Expected '${AssetProxyId.ERC1155}', got '${assetProxyId}'`); } - const abiEncoder = AbiEncoder.createMethod('ERC1155Assets', ERC1155AssetDataAbi); + const abiEncoder = AbiEncoder.createMethod('ERC1155Assets', constants.ERC1155_METHOD_ABI.inputs); // tslint:disable-next-line:no-unnecessary-type-assertion const decodedAssetData = abiEncoder.decode(assetData, decodingRules) as ERC1155AssetDataNoProxyId; return { @@ -139,7 +139,7 @@ export const assetDataUtils = { return assetData; }, /** - * Decodes a MultiAsset assetData hex string into it's corresponding amounts and nestedAssetData + * Decodes a MultiAsset assetData hex string into its corresponding amounts and nestedAssetData * @param assetData Hex encoded assetData string to decode * @return An object containing the decoded amounts and nestedAssetData */ @@ -165,7 +165,7 @@ export const assetDataUtils = { }; }, /** - * Decodes a MultiAsset assetData hex string into it's corresponding amounts and decoded nestedAssetData elements (all nested elements are flattened) + * Decodes a MultiAsset assetData hex string into its corresponding amounts and decoded nestedAssetData elements (all nested elements are flattened) * @param assetData Hex encoded assetData string to decode * @return An object containing the decoded amounts and nestedAssetData */ @@ -201,6 +201,35 @@ export const assetDataUtils = { nestedAssetData: flattenedDecodedNestedAssetData as SingleAssetData[], }; }, + /** + * Encodes StaticCallProxy data into an assetData hex string + * @param callTarget Address of contract to call from StaticCallProxy + * @param staticCallData The function data that will be called on the callTarget contract + * @param callResultHash The keccak256 hash of the ABI encoded expected output of the static call + * @return The hex encoded assetData string + */ + encodeStaticCallAssetData(callTarget: string, staticCallData: string, callResultHash: string): string { + const abiEncoder = AbiEncoder.createMethod('StaticCall', constants.STATIC_CALL_METHOD_ABI.inputs); + const args = [callTarget, staticCallData, callResultHash]; + const assetData = abiEncoder.encode(args, encodingRules); + return assetData; + }, + /** + * Decoded StaticCall assetData into its corresponding callTarget, staticCallData, and expected callResultHash + * @param assetData Hex encoded assetData string to decode + * @return An object containing the decoded callTarget, staticCallData, and expected callResultHash + */ + decodeStaticCallAssetData(assetData: string): StaticCallAssetData { + const abiEncoder = AbiEncoder.createMethod('StaticCall', constants.STATIC_CALL_METHOD_ABI.inputs); + const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData); + const decodedAssetData = abiEncoder.decode(assetData, decodingRules) as any; + return { + assetProxyId, + callTarget: decodedAssetData.callTarget, + callResultHash: decodedAssetData.callResultHash, + staticCallData: decodedAssetData.staticCallData, + }; + }, /** * Decode and return the assetProxyId from the assetData * @param assetData Hex encoded assetData string to decode @@ -219,6 +248,7 @@ export const assetDataUtils = { assetProxyId !== AssetProxyId.ERC20 && assetProxyId !== AssetProxyId.ERC721 && assetProxyId !== AssetProxyId.ERC1155 && + assetProxyId !== AssetProxyId.StaticCall && assetProxyId !== AssetProxyId.MultiAsset ) { throw new Error(`Invalid assetProxyId: ${assetProxyId}`); @@ -253,6 +283,13 @@ export const assetDataUtils = { isMultiAssetData(decodedAssetData: SingleAssetData | MultiAssetData): decodedAssetData is MultiAssetData { return decodedAssetData.assetProxyId === AssetProxyId.MultiAsset; }, + /** + * Checks if the decoded asset data is valid StaticCall data + * @param decodedAssetData The decoded asset data to check + */ + isStaticCallAssetData(decodedAssetData: SingleAssetData | MultiAssetData): decodedAssetData is StaticCallAssetData { + return decodedAssetData.assetProxyId === AssetProxyId.StaticCall; + }, /** * Throws if the length or assetProxyId are invalid for the ERC20Proxy. * @param assetData Hex encoded assetData string @@ -324,6 +361,13 @@ export const assetDataUtils = { ); } }, + /** + * Throws if the assetData is not StaticCallData. + * @param assetData Hex encoded assetData string + */ + assertIsStaticCallAssetData(assetData: string): void { + assetDataUtils.decodeStaticCallAssetData(assetData); + }, /** * Throws if the length or assetProxyId are invalid for the corresponding AssetProxy. * @param assetData Hex encoded assetData string @@ -348,7 +392,7 @@ export const assetDataUtils = { } }, /** - * Decode any assetData into it's corresponding assetData object + * Decode any assetData into its corresponding assetData object * @param assetData Hex encoded assetData string to decode * @return Either a ERC20, ERC721, ERC1155, or MultiAsset assetData object */ diff --git a/packages/order-utils/src/index.ts b/packages/order-utils/src/index.ts index e22cf09236..59c78120e5 100644 --- a/packages/order-utils/src/index.ts +++ b/packages/order-utils/src/index.ts @@ -48,7 +48,6 @@ export { ERC20AssetData, ERC721AssetData, ERC1155AssetData, - ERC1155AssetDataAbi, MultiAssetData, MultiAssetDataWithRecursiveDecoding, AssetProxyId, diff --git a/packages/order-utils/test/asset_data_utils_test.ts b/packages/order-utils/test/asset_data_utils_test.ts index 96ea36307a..ab168e9fa9 100644 --- a/packages/order-utils/test/asset_data_utils_test.ts +++ b/packages/order-utils/test/asset_data_utils_test.ts @@ -1,6 +1,6 @@ import * as chai from 'chai'; -import { AssetProxyId, ERC1155AssetData, ERC721AssetData } from '@0x/types'; +import { AssetProxyId, ERC1155AssetData, ERC20AssetData, ERC721AssetData } from '@0x/types'; import { BigNumber } from '@0x/utils'; import { assetDataUtils } from '../src/asset_data_utils'; @@ -98,7 +98,8 @@ describe('assetDataUtils', () => { expect(decodedAssetData.assetProxyId).to.equal(AssetProxyId.MultiAsset); expect(decodedAssetData.amounts).to.deep.equal(KNOWN_MULTI_ASSET_ENCODING.amounts); expect(decodedAssetData.nestedAssetData.length).to.equal(3); - const decodedErc20AssetData = decodedAssetData.nestedAssetData[0]; + // tslint:disable-next-line:no-unnecessary-type-assertion + const decodedErc20AssetData = decodedAssetData.nestedAssetData[0] as ERC20AssetData; expect(decodedErc20AssetData.tokenAddress).to.equal(KNOWN_ERC20_ENCODING.address); expect(decodedErc20AssetData.assetProxyId).to.equal(AssetProxyId.ERC20); // tslint:disable-next-line:no-unnecessary-type-assertion @@ -144,7 +145,8 @@ describe('assetDataUtils', () => { expect(decodedAssetData.nestedAssetData.length).to.be.equal(expectedNestedAssetDataLength); // validate nested asset data (outer) let nestedAssetDataIndex = 0; - const decodedErc20AssetData1 = decodedAssetData.nestedAssetData[nestedAssetDataIndex++]; + // tslint:disable-next-line:no-unnecessary-type-assertion + const decodedErc20AssetData1 = decodedAssetData.nestedAssetData[nestedAssetDataIndex++] as ERC20AssetData; expect(decodedErc20AssetData1.tokenAddress).to.equal(KNOWN_ERC20_ENCODING.address); expect(decodedErc20AssetData1.assetProxyId).to.equal(AssetProxyId.ERC20); // tslint:disable-next-line:no-unnecessary-type-assertion @@ -158,7 +160,8 @@ describe('assetDataUtils', () => { expect(decodedErc1155AssetData1.tokenIds).to.be.deep.equal(KNOWN_ERC1155_ENCODING.tokenIds); expect(decodedErc1155AssetData1.callbackData).to.be.equal(KNOWN_ERC1155_ENCODING.callbackData); // validate nested asset data (inner) - const decodedErc20AssetData2 = decodedAssetData.nestedAssetData[nestedAssetDataIndex++]; + // tslint:disable-next-line:no-unnecessary-type-assertion + const decodedErc20AssetData2 = decodedAssetData.nestedAssetData[nestedAssetDataIndex++] as ERC20AssetData; expect(decodedErc20AssetData2.tokenAddress).to.equal(KNOWN_ERC20_ENCODING.address); expect(decodedErc20AssetData2.assetProxyId).to.equal(AssetProxyId.ERC20); // tslint:disable-next-line:no-unnecessary-type-assertion From 7d9e43b2e103b4c5a08bdec4f64a4c894fcfea58 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sat, 8 Jun 2019 16:36:46 -0700 Subject: [PATCH 05/16] Add TestStaticCallTarget for testing StaticCallProxy --- .../contracts/test/TestStaticCallTarget.sol | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 contracts/asset-proxy/contracts/test/TestStaticCallTarget.sol diff --git a/contracts/asset-proxy/contracts/test/TestStaticCallTarget.sol b/contracts/asset-proxy/contracts/test/TestStaticCallTarget.sol new file mode 100644 index 0000000000..4179d148b1 --- /dev/null +++ b/contracts/asset-proxy/contracts/test/TestStaticCallTarget.sol @@ -0,0 +1,73 @@ +/* + + Copyright 2018 ZeroEx Intl. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +pragma solidity ^0.5.5; + + +contract TestStaticCallTarget { + + uint256 internal _state; + + function updateState() + external + { + _state++; + } + + function assertEvenNumber(uint256 target) + external + pure + { + require( + target % 2 == 0, + "TARGET_NOT_EVEN" + ); + } + + function isOddNumber(uint256 target) + external + pure + returns (bool isOdd) + { + isOdd = target % 2 == 1; + return isOdd; + } + + function noInputFunction() + external + pure + {} + + function dynamicInputFunction(bytes calldata a) + external + pure + {} + + function returnComplexType(uint256 a, uint256 b) + external + view + returns (bytes memory result) + { + result = abi.encodePacked( + address(this), + a, + b + ); + return result; + } +} \ No newline at end of file From 5345f7c9836e2bd26d1a67c0bd140f6dea82b0ab Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sat, 8 Jun 2019 16:38:17 -0700 Subject: [PATCH 06/16] Add boilerplate for StaticCallProxy --- contracts/asset-proxy/compiler.json | 4 +++- contracts/asset-proxy/package.json | 2 +- contracts/asset-proxy/src/artifacts.ts | 4 ++++ contracts/asset-proxy/src/wrappers.ts | 2 ++ contracts/asset-proxy/tsconfig.json | 4 +++- 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/contracts/asset-proxy/compiler.json b/contracts/asset-proxy/compiler.json index c09706f307..f2f6909e09 100644 --- a/contracts/asset-proxy/compiler.json +++ b/contracts/asset-proxy/compiler.json @@ -28,8 +28,10 @@ "src/ERC721Proxy.sol", "src/MixinAuthorizable.sol", "src/MultiAssetProxy.sol", + "src/StaticCallProxy.sol", "src/interfaces/IAssetData.sol", "src/interfaces/IAssetProxy.sol", - "src/interfaces/IAuthorizable.sol" + "src/interfaces/IAuthorizable.sol", + "test/TestStaticCallTarget.sol" ] } diff --git a/contracts/asset-proxy/package.json b/contracts/asset-proxy/package.json index 2bdba923c3..f685edec95 100644 --- a/contracts/asset-proxy/package.json +++ b/contracts/asset-proxy/package.json @@ -34,7 +34,7 @@ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol" }, "config": { - "abis": "./generated-artifacts/@(ERC1155Proxy|ERC20Proxy|ERC721Proxy|IAssetData|IAssetProxy|IAuthorizable|MixinAuthorizable|MultiAssetProxy).json", + "abis": "./generated-artifacts/@(ERC1155Proxy|ERC20Proxy|ERC721Proxy|IAssetData|IAssetProxy|IAuthorizable|MixinAuthorizable|MultiAssetProxy|StaticCallProxy|TestStaticCallTarget).json", "abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually." }, "repository": { diff --git a/contracts/asset-proxy/src/artifacts.ts b/contracts/asset-proxy/src/artifacts.ts index 7fc2b38cda..6942df8793 100644 --- a/contracts/asset-proxy/src/artifacts.ts +++ b/contracts/asset-proxy/src/artifacts.ts @@ -13,13 +13,17 @@ import * as IAssetProxy from '../generated-artifacts/IAssetProxy.json'; import * as IAuthorizable from '../generated-artifacts/IAuthorizable.json'; import * as MixinAuthorizable from '../generated-artifacts/MixinAuthorizable.json'; import * as MultiAssetProxy from '../generated-artifacts/MultiAssetProxy.json'; +import * as StaticCallProxy from '../generated-artifacts/StaticCallProxy.json'; +import * as TestStaticCallTarget from '../generated-artifacts/TestStaticCallTarget.json'; export const artifacts = { ERC1155Proxy: ERC1155Proxy as ContractArtifact, ERC20Proxy: ERC20Proxy as ContractArtifact, ERC721Proxy: ERC721Proxy as ContractArtifact, MixinAuthorizable: MixinAuthorizable as ContractArtifact, MultiAssetProxy: MultiAssetProxy as ContractArtifact, + StaticCallProxy: StaticCallProxy as ContractArtifact, IAssetData: IAssetData as ContractArtifact, IAssetProxy: IAssetProxy as ContractArtifact, IAuthorizable: IAuthorizable as ContractArtifact, + TestStaticCallTarget: TestStaticCallTarget as ContractArtifact, }; diff --git a/contracts/asset-proxy/src/wrappers.ts b/contracts/asset-proxy/src/wrappers.ts index 3412cb0266..4a7968fc12 100644 --- a/contracts/asset-proxy/src/wrappers.ts +++ b/contracts/asset-proxy/src/wrappers.ts @@ -11,3 +11,5 @@ export * from '../generated-wrappers/i_asset_proxy'; export * from '../generated-wrappers/i_authorizable'; export * from '../generated-wrappers/mixin_authorizable'; export * from '../generated-wrappers/multi_asset_proxy'; +export * from '../generated-wrappers/static_call_proxy'; +export * from '../generated-wrappers/test_static_call_target'; diff --git a/contracts/asset-proxy/tsconfig.json b/contracts/asset-proxy/tsconfig.json index 31358217c9..c410288969 100644 --- a/contracts/asset-proxy/tsconfig.json +++ b/contracts/asset-proxy/tsconfig.json @@ -10,7 +10,9 @@ "generated-artifacts/IAssetProxy.json", "generated-artifacts/IAuthorizable.json", "generated-artifacts/MixinAuthorizable.json", - "generated-artifacts/MultiAssetProxy.json" + "generated-artifacts/MultiAssetProxy.json", + "generated-artifacts/StaticCallProxy.json", + "generated-artifacts/TestStaticCallTarget.json" ], "exclude": ["./deploy/solc/solc_bin"] } From f51c4f961716ba30ef797fc94fbdb7be7e023eb3 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sun, 9 Jun 2019 19:17:14 -0700 Subject: [PATCH 07/16] Allow getABIEncodedTransactionData to be called for read only contract methods --- .../abi-gen-templates/partials/callAsync.handlebars | 10 ++++++++++ packages/abi-gen-templates/partials/tx.handlebars | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/abi-gen-templates/partials/callAsync.handlebars b/packages/abi-gen-templates/partials/callAsync.handlebars index ce969189ab..6ab09169d7 100644 --- a/packages/abi-gen-templates/partials/callAsync.handlebars +++ b/packages/abi-gen-templates/partials/callAsync.handlebars @@ -32,3 +32,13 @@ async callAsync( // tslint:enable boolean-naming return result; }, +getABIEncodedTransactionData( + {{> typed_params inputs=inputs}} + ): string { + {{#each inputs}} + {{#assertionType name type}}{{/assertionType}} + {{/each}} + const self = this as any as {{contractName}}Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]); + return abiEncodedTransactionData; +}, diff --git a/packages/abi-gen-templates/partials/tx.handlebars b/packages/abi-gen-templates/partials/tx.handlebars index 3c508f4288..ab00fbcd5d 100644 --- a/packages/abi-gen-templates/partials/tx.handlebars +++ b/packages/abi-gen-templates/partials/tx.handlebars @@ -70,15 +70,5 @@ public {{this.tsName}} = { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - {{> typed_params inputs=inputs}} - ): string { - {{#each inputs}} - {{#assertionType name type}}{{/assertionType}} - {{/each}} - const self = this as any as {{contractName}}Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]); - return abiEncodedTransactionData; - }, {{> callAsync}} }; From 0c8bb2e675409c0722b5cb94a8c05f84d68b4bb5 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sun, 9 Jun 2019 19:20:47 -0700 Subject: [PATCH 08/16] Add unit tests for StaticCallProxy --- contracts/asset-proxy/test/erc1155_proxy.ts | 4 +- .../asset-proxy/test/static_call_proxy.ts | 255 ++++++++++++++++++ contracts/test-utils/src/constants.ts | 1 + packages/types/src/index.ts | 6 +- 4 files changed, 263 insertions(+), 3 deletions(-) create mode 100644 contracts/asset-proxy/test/static_call_proxy.ts diff --git a/contracts/asset-proxy/test/erc1155_proxy.ts b/contracts/asset-proxy/test/erc1155_proxy.ts index 54057eb574..1b0808d115 100644 --- a/contracts/asset-proxy/test/erc1155_proxy.ts +++ b/contracts/asset-proxy/test/erc1155_proxy.ts @@ -121,7 +121,7 @@ describe('ERC1155Proxy', () => { }), ); }); - it('should have an id of 0x9645780d', async () => { + it('should have an id of 0xa7cb5fb7', async () => { const proxyId = await erc1155Proxy.getProxyId.callAsync(); const expectedProxyId = AssetProxyId.ERC1155; expect(proxyId).to.equal(expectedProxyId); @@ -1572,7 +1572,7 @@ describe('ERC1155Proxy', () => { // execute transfer await expectTransactionFailedAsync( erc1155ProxyWrapper.transferFromRawAsync(badTxData, authorized), - RevertReason.InvalidAssetData, + RevertReason.InvalidAssetDataEnd, ); }); it('should revert if length of assetData, excluding the selector, is not a multiple of 32', async () => { diff --git a/contracts/asset-proxy/test/static_call_proxy.ts b/contracts/asset-proxy/test/static_call_proxy.ts new file mode 100644 index 0000000000..1e8da3efed --- /dev/null +++ b/contracts/asset-proxy/test/static_call_proxy.ts @@ -0,0 +1,255 @@ +import { + chaiSetup, + constants, + expectTransactionFailedAsync, + expectTransactionFailedWithoutReasonAsync, + provider, + txDefaults, + web3Wrapper, +} from '@0x/contracts-test-utils'; +import { BlockchainLifecycle } from '@0x/dev-utils'; +import { assetDataUtils } from '@0x/order-utils'; +import { AssetProxyId, RevertReason } from '@0x/types'; +import { AbiEncoder, BigNumber } from '@0x/utils'; +import * as chai from 'chai'; +import * as ethUtil from 'ethereumjs-util'; + +import { artifacts, IAssetProxyContract, StaticCallProxyContract, TestStaticCallTargetContract } from '../src'; + +chaiSetup.configure(); +const expect = chai.expect; +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); + +describe('StaticCallProxy', () => { + const amount = constants.ZERO_AMOUNT; + let fromAddress: string; + let toAddress: string; + + let staticCallProxy: IAssetProxyContract; + let staticCallTarget: TestStaticCallTargetContract; + + before(async () => { + await blockchainLifecycle.startAsync(); + }); + after(async () => { + await blockchainLifecycle.revertAsync(); + }); + before(async () => { + const accounts = await web3Wrapper.getAvailableAddressesAsync(); + [fromAddress, toAddress] = accounts.slice(0, 2); + const staticCallProxyWithoutTransferFrom = await StaticCallProxyContract.deployFrom0xArtifactAsync( + artifacts.StaticCallProxy, + provider, + txDefaults, + ); + staticCallProxy = new IAssetProxyContract( + artifacts.IAssetProxy.compilerOutput.abi, + staticCallProxyWithoutTransferFrom.address, + provider, + txDefaults, + ); + staticCallTarget = await TestStaticCallTargetContract.deployFrom0xArtifactAsync( + artifacts.TestStaticCallTarget, + provider, + txDefaults, + ); + }); + beforeEach(async () => { + await blockchainLifecycle.startAsync(); + }); + afterEach(async () => { + await blockchainLifecycle.revertAsync(); + }); + + describe('general', () => { + it('should revert if undefined function is called', async () => { + const undefinedSelector = '0x01020304'; + await expectTransactionFailedWithoutReasonAsync( + web3Wrapper.sendTransactionAsync({ + from: fromAddress, + to: staticCallProxy.address, + value: constants.ZERO_AMOUNT, + data: undefinedSelector, + }), + ); + }); + it('should have an id of 0xc339d10a', async () => { + const proxyId = await staticCallProxy.getProxyId.callAsync(); + const expectedProxyId = AssetProxyId.StaticCall; + expect(proxyId).to.equal(expectedProxyId); + }); + }); + describe('transferFrom', () => { + it('should revert if assetData lies outside the bounds of calldata', async () => { + const staticCallData = staticCallTarget.noInputFunction.getABIEncodedTransactionData(); + const expectedResultHash = constants.KECCAK256_NULL; + const assetData = assetDataUtils.encodeStaticCallAssetData( + staticCallTarget.address, + staticCallData, + expectedResultHash, + ); + const txData = staticCallProxy.transferFrom.getABIEncodedTransactionData( + assetData, + fromAddress, + toAddress, + amount, + ); + const offsetToAssetData = '0000000000000000000000000000000000000000000000000000000000000080'; + const txDataEndBuffer = ethUtil.toBuffer((txData.length - 2) / 2 - 4); + const paddedTxDataEndBuffer = ethUtil.setLengthLeft(txDataEndBuffer, 32); + const invalidOffsetToAssetData = ethUtil.bufferToHex(paddedTxDataEndBuffer).slice(2); + const newAssetData = '0000000000000000000000000000000000000000000000000000000000000304'; + const badTxData = `${txData.replace(offsetToAssetData, invalidOffsetToAssetData)}${newAssetData}`; + await expectTransactionFailedAsync( + web3Wrapper.sendTransactionAsync({ + to: staticCallProxy.address, + from: fromAddress, + data: badTxData, + }), + RevertReason.InvalidAssetDataEnd, + ); + }); + it('should revert if the length of assetData, excluding the proxyId, is not a multiple of 32', async () => { + const staticCallData = staticCallTarget.noInputFunction.getABIEncodedTransactionData(); + const expectedResultHash = constants.KECCAK256_NULL; + const assetData = `${assetDataUtils.encodeStaticCallAssetData( + staticCallTarget.address, + staticCallData, + expectedResultHash, + )}01`; + await expectTransactionFailedAsync( + staticCallProxy.transferFrom.sendTransactionAsync(assetData, fromAddress, toAddress, amount), + RevertReason.InvalidAssetDataLength, + ); + }); + it('should revert if the length of assetData is less than 100 bytes', async () => { + const staticCallData = constants.NULL_BYTES; + const expectedResultHash = constants.KECCAK256_NULL; + const assetData = assetDataUtils + .encodeStaticCallAssetData(staticCallTarget.address, staticCallData, expectedResultHash) + .slice(0, -128); + const assetDataByteLen = (assetData.length - 2) / 2; + expect((assetDataByteLen - 4) % 32).to.equal(0); + await expectTransactionFailedAsync( + staticCallProxy.transferFrom.sendTransactionAsync(assetData, fromAddress, toAddress, amount), + RevertReason.InvalidAssetDataLength, + ); + }); + it('should revert if the offset to `staticCallData` points to outside of assetData', async () => { + const staticCallData = staticCallTarget.noInputFunction.getABIEncodedTransactionData(); + const expectedResultHash = constants.KECCAK256_NULL; + const assetData = assetDataUtils.encodeStaticCallAssetData( + staticCallTarget.address, + staticCallData, + expectedResultHash, + ); + const offsetToStaticCallData = '0000000000000000000000000000000000000000000000000000000000000060'; + const assetDataEndBuffer = ethUtil.toBuffer((assetData.length - 2) / 2 - 4); + const paddedAssetDataEndBuffer = ethUtil.setLengthLeft(assetDataEndBuffer, 32); + const invalidOffsetToStaticCallData = ethUtil.bufferToHex(paddedAssetDataEndBuffer).slice(2); + const newStaticCallData = '0000000000000000000000000000000000000000000000000000000000000304'; + const badAssetData = `${assetData.replace( + offsetToStaticCallData, + invalidOffsetToStaticCallData, + )}${newStaticCallData}`; + await expectTransactionFailedAsync( + staticCallProxy.transferFrom.sendTransactionAsync(badAssetData, fromAddress, toAddress, amount), + RevertReason.InvalidStaticCallDataOffset, + ); + }); + it('should revert if the callTarget attempts to write to state', async () => { + const staticCallData = staticCallTarget.updateState.getABIEncodedTransactionData(); + const expectedResultHash = constants.KECCAK256_NULL; + const assetData = assetDataUtils.encodeStaticCallAssetData( + staticCallTarget.address, + staticCallData, + expectedResultHash, + ); + await expectTransactionFailedWithoutReasonAsync( + staticCallProxy.transferFrom.sendTransactionAsync(assetData, fromAddress, toAddress, amount), + ); + }); + it('should revert with data provided by the callTarget if the staticcall reverts', async () => { + const staticCallData = staticCallTarget.assertEvenNumber.getABIEncodedTransactionData(new BigNumber(1)); + const expectedResultHash = constants.KECCAK256_NULL; + const assetData = assetDataUtils.encodeStaticCallAssetData( + staticCallTarget.address, + staticCallData, + expectedResultHash, + ); + await expectTransactionFailedAsync( + staticCallProxy.transferFrom.sendTransactionAsync(assetData, fromAddress, toAddress, amount), + RevertReason.TargetNotEven, + ); + }); + it('should revert if the hash of the output is different than expected expected', async () => { + const staticCallData = staticCallTarget.isOddNumber.getABIEncodedTransactionData(new BigNumber(0)); + const trueAsBuffer = ethUtil.toBuffer('0x0000000000000000000000000000000000000000000000000000000000000001'); + const expectedResultHash = ethUtil.bufferToHex(ethUtil.sha3(trueAsBuffer)); + const assetData = assetDataUtils.encodeStaticCallAssetData( + staticCallTarget.address, + staticCallData, + expectedResultHash, + ); + await expectTransactionFailedAsync( + staticCallProxy.transferFrom.sendTransactionAsync(assetData, fromAddress, toAddress, amount), + RevertReason.UnexpectedStaticCallResult, + ); + }); + it('should be successful if a function call with no inputs is successful', async () => { + const staticCallData = staticCallTarget.noInputFunction.getABIEncodedTransactionData(); + const expectedResultHash = constants.KECCAK256_NULL; + const assetData = assetDataUtils.encodeStaticCallAssetData( + staticCallTarget.address, + staticCallData, + expectedResultHash, + ); + await staticCallProxy.transferFrom.awaitTransactionSuccessAsync(assetData, fromAddress, toAddress, amount); + }); + it('should be successful if a function call with one static input returns the correct value', async () => { + const staticCallData = staticCallTarget.isOddNumber.getABIEncodedTransactionData(new BigNumber(1)); + const trueAsBuffer = ethUtil.toBuffer('0x0000000000000000000000000000000000000000000000000000000000000001'); + const expectedResultHash = ethUtil.bufferToHex(ethUtil.sha3(trueAsBuffer)); + const assetData = assetDataUtils.encodeStaticCallAssetData( + staticCallTarget.address, + staticCallData, + expectedResultHash, + ); + await staticCallProxy.transferFrom.awaitTransactionSuccessAsync(assetData, fromAddress, toAddress, amount); + }); + it('should be successful if a function with one dynamic input is successful', async () => { + const dynamicInput = '0x0102030405060708'; + const staticCallData = staticCallTarget.dynamicInputFunction.getABIEncodedTransactionData(dynamicInput); + const expectedResultHash = constants.KECCAK256_NULL; + const assetData = assetDataUtils.encodeStaticCallAssetData( + staticCallTarget.address, + staticCallData, + expectedResultHash, + ); + await staticCallProxy.transferFrom.awaitTransactionSuccessAsync(assetData, fromAddress, toAddress, amount); + }); + it('should be successful if a function call returns a complex type', async () => { + const a = new BigNumber(1); + const b = new BigNumber(2); + const staticCallData = staticCallTarget.returnComplexType.getABIEncodedTransactionData(a, b); + const abiEncoder = new AbiEncoder.DynamicBytes({ + name: '', + type: 'bytes', + }); + const aHex = '0000000000000000000000000000000000000000000000000000000000000001'; + const bHex = '0000000000000000000000000000000000000000000000000000000000000002'; + const expectedResults = `${staticCallTarget.address}${aHex}${bHex}`; + const offset = '0000000000000000000000000000000000000000000000000000000000000020'; + const encodedExpectedResultWithOffset = `0x${offset}${abiEncoder.encode(expectedResults).slice(2)}`; + const expectedResultHash = ethUtil.bufferToHex( + ethUtil.sha3(ethUtil.toBuffer(encodedExpectedResultWithOffset)), + ); + const assetData = assetDataUtils.encodeStaticCallAssetData( + staticCallTarget.address, + staticCallData, + expectedResultHash, + ); + await staticCallProxy.transferFrom.awaitTransactionSuccessAsync(assetData, fromAddress, toAddress, amount); + }); + }); +}); diff --git a/contracts/test-utils/src/constants.ts b/contracts/test-utils/src/constants.ts index 199042edc0..f09e554941 100644 --- a/contracts/test-utils/src/constants.ts +++ b/contracts/test-utils/src/constants.ts @@ -70,4 +70,5 @@ export const constants = { 'CANCEL_ORDERS_UP_TO', 'SET_SIGNATURE_VALIDATOR_APPROVAL', ], + KECCAK256_NULL: ethUtil.addHexPrefix(ethUtil.bufferToHex(ethUtil.SHA3_NULL)), }; diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 0e70969b2b..e841621650 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -291,7 +291,7 @@ export enum RevertReason { AuctionExpired = 'AUCTION_EXPIRED', AuctionNotStarted = 'AUCTION_NOT_STARTED', AuctionInvalidBeginTime = 'INVALID_BEGIN_TIME', - InvalidAssetData = 'INVALID_ASSET_DATA', + InvalidAssetDataEnd = 'INVALID_ASSET_DATA_END', // Balance Threshold Filter InvalidOrBlockedExchangeSelector = 'INVALID_OR_BLOCKED_EXCHANGE_SELECTOR', BalanceQueryFailed = 'BALANCE_QUERY_FAILED', @@ -317,6 +317,10 @@ export enum RevertReason { InvalidValuesOffset = 'INVALID_VALUES_OFFSET', InvalidDataOffset = 'INVALID_DATA_OFFSET', InvalidAssetDataLength = 'INVALID_ASSET_DATA_LENGTH', + // StaticCall + InvalidStaticCallDataOffset = 'INVALID_STATIC_CALL_DATA_OFFSET', + TargetNotEven = 'TARGET_NOT_EVEN', + UnexpectedStaticCallResult = 'UNEXPECTED_STATIC_CALL_RESULT', } export enum StatusCodes { From f2cbf4a561d3d4200b4bcd1059a23ea21d9e0436 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sun, 9 Jun 2019 19:36:16 -0700 Subject: [PATCH 09/16] Regenerate abi-gen-wrappers --- .../generated-wrappers/asset_proxy_owner.ts | 366 ++++++--- .../src/generated-wrappers/coordinator.ts | 454 ++++++----- .../coordinator_registry.ts | 27 +- .../generated-wrappers/dummy_erc20_token.ts | 195 +++-- .../generated-wrappers/dummy_erc721_token.ts | 267 ++++--- .../src/generated-wrappers/dutch_auction.ts | 78 +- .../src/generated-wrappers/erc20_proxy.ts | 114 ++- .../src/generated-wrappers/erc20_token.ts | 105 ++- .../src/generated-wrappers/erc721_proxy.ts | 114 ++- .../src/generated-wrappers/erc721_token.ts | 183 +++-- .../src/generated-wrappers/exchange.ts | 710 +++++++++++------- .../src/generated-wrappers/forwarder.ts | 150 ++-- .../src/generated-wrappers/i_asset_proxy.ts | 126 ++-- .../src/generated-wrappers/i_validator.ts | 15 + .../src/generated-wrappers/i_wallet.ts | 12 + .../generated-wrappers/multi_asset_proxy.ts | 150 ++-- .../src/generated-wrappers/order_validator.ts | 88 ++- .../src/generated-wrappers/weth9.ts | 153 ++-- .../src/generated-wrappers/zrx_token.ts | 123 ++- packages/types/src/index.ts | 1 + 20 files changed, 2163 insertions(+), 1268 deletions(-) diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts b/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts index 64051565c1..46a303444b 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts @@ -146,6 +146,15 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { + assert.isBigNumber('index_0', index_0); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('owners(uint256)', [index_0 + ]); + return abiEncodedTransactionData; + }, }; public removeOwner = { async sendTransactionAsync( @@ -212,15 +221,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - owner: string, - ): string { - assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeOwner(address)', [owner - ]); - return abiEncodedTransactionData; - }, async callAsync( owner: string, callData: Partial = {}, @@ -256,6 +256,15 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + owner: string, + ): string { + assert.isString('owner', owner); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeOwner(address)', [owner + ]); + return abiEncodedTransactionData; + }, }; public revokeConfirmation = { async sendTransactionAsync( @@ -322,15 +331,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId - ]); - return abiEncodedTransactionData; - }, async callAsync( transactionId: BigNumber, callData: Partial = {}, @@ -366,6 +366,15 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId + ]); + return abiEncodedTransactionData; + }, }; public isOwner = { async callAsync( @@ -403,6 +412,15 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: string, + ): string { + assert.isString('index_0', index_0); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isOwner(address)', [index_0 + ]); + return abiEncodedTransactionData; + }, }; public confirmations = { async callAsync( @@ -443,6 +461,18 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: BigNumber, + index_1: string, + ): string { + assert.isBigNumber('index_0', index_0); + assert.isString('index_1', index_1); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('confirmations(uint256,address)', [index_0, + index_1 + ]); + return abiEncodedTransactionData; + }, }; public executeRemoveAuthorizedAddressAtIndex = { async sendTransactionAsync( @@ -509,15 +539,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId - ]); - return abiEncodedTransactionData; - }, async callAsync( transactionId: BigNumber, callData: Partial = {}, @@ -553,6 +574,15 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId + ]); + return abiEncodedTransactionData; + }, }; public secondsTimeLocked = { async callAsync( @@ -587,6 +617,12 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('secondsTimeLocked()', []); + return abiEncodedTransactionData; + }, }; public getTransactionCount = { async callAsync( @@ -627,6 +663,18 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + pending: boolean, + executed: boolean, + ): string { + assert.isBoolean('pending', pending); + assert.isBoolean('executed', executed); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [pending, + executed + ]); + return abiEncodedTransactionData; + }, }; public registerAssetProxy = { async sendTransactionAsync( @@ -703,18 +751,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - assetProxyContract: string, - isRegistered: boolean, - ): string { - assert.isString('assetProxyContract', assetProxyContract); - assert.isBoolean('isRegistered', isRegistered); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract, - isRegistered - ]); - return abiEncodedTransactionData; - }, async callAsync( assetProxyContract: string, isRegistered: boolean, @@ -753,6 +789,18 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + assetProxyContract: string, + isRegistered: boolean, + ): string { + assert.isString('assetProxyContract', assetProxyContract); + assert.isBoolean('isRegistered', isRegistered); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract, + isRegistered + ]); + return abiEncodedTransactionData; + }, }; public addOwner = { async sendTransactionAsync( @@ -819,15 +867,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - owner: string, - ): string { - assert.isString('owner', owner); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addOwner(address)', [owner - ]); - return abiEncodedTransactionData; - }, async callAsync( owner: string, callData: Partial = {}, @@ -863,6 +902,15 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + owner: string, + ): string { + assert.isString('owner', owner); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addOwner(address)', [owner + ]); + return abiEncodedTransactionData; + }, }; public isConfirmed = { async callAsync( @@ -900,6 +948,15 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId + ]); + return abiEncodedTransactionData; + }, }; public changeTimeLock = { async sendTransactionAsync( @@ -966,15 +1023,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _secondsTimeLocked: BigNumber, - ): string { - assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked - ]); - return abiEncodedTransactionData; - }, async callAsync( _secondsTimeLocked: BigNumber, callData: Partial = {}, @@ -1010,6 +1058,15 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _secondsTimeLocked: BigNumber, + ): string { + assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked + ]); + return abiEncodedTransactionData; + }, }; public isAssetProxyRegistered = { async callAsync( @@ -1047,6 +1104,15 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: string, + ): string { + assert.isString('index_0', index_0); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0 + ]); + return abiEncodedTransactionData; + }, }; public getConfirmationCount = { async callAsync( @@ -1084,6 +1150,15 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmationCount(uint256)', [transactionId + ]); + return abiEncodedTransactionData; + }, }; public transactions = { async callAsync( @@ -1121,6 +1196,15 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { + assert.isBigNumber('index_0', index_0); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transactions(uint256)', [index_0 + ]); + return abiEncodedTransactionData; + }, }; public getOwners = { async callAsync( @@ -1155,6 +1239,12 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getOwners()', []); + return abiEncodedTransactionData; + }, }; public getTransactionIds = { async callAsync( @@ -1201,6 +1291,24 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + from: BigNumber, + to: BigNumber, + pending: boolean, + executed: boolean, + ): string { + assert.isBigNumber('from', from); + assert.isBigNumber('to', to); + assert.isBoolean('pending', pending); + assert.isBoolean('executed', executed); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionIds(uint256,uint256,bool,bool)', [from, + to, + pending, + executed + ]); + return abiEncodedTransactionData; + }, }; public getConfirmations = { async callAsync( @@ -1238,6 +1346,15 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId + ]); + return abiEncodedTransactionData; + }, }; public transactionCount = { async callAsync( @@ -1272,6 +1389,12 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transactionCount()', []); + return abiEncodedTransactionData; + }, }; public changeRequirement = { async sendTransactionAsync( @@ -1338,15 +1461,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _required: BigNumber, - ): string { - assert.isBigNumber('_required', _required); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('changeRequirement(uint256)', [_required - ]); - return abiEncodedTransactionData; - }, async callAsync( _required: BigNumber, callData: Partial = {}, @@ -1382,6 +1496,15 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _required: BigNumber, + ): string { + assert.isBigNumber('_required', _required); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('changeRequirement(uint256)', [_required + ]); + return abiEncodedTransactionData; + }, }; public confirmTransaction = { async sendTransactionAsync( @@ -1448,15 +1571,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId - ]); - return abiEncodedTransactionData; - }, async callAsync( transactionId: BigNumber, callData: Partial = {}, @@ -1492,6 +1606,15 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId + ]); + return abiEncodedTransactionData; + }, }; public submitTransaction = { async sendTransactionAsync( @@ -1578,21 +1701,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - destination: string, - value: BigNumber, - data: string, - ): string { - assert.isString('destination', destination); - assert.isBigNumber('value', value); - assert.isString('data', data); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination, - value, - data - ]); - return abiEncodedTransactionData; - }, async callAsync( destination: string, value: BigNumber, @@ -1634,6 +1742,21 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + destination: string, + value: BigNumber, + data: string, + ): string { + assert.isString('destination', destination); + assert.isBigNumber('value', value); + assert.isString('data', data); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination, + value, + data + ]); + return abiEncodedTransactionData; + }, }; public confirmationTimes = { async callAsync( @@ -1671,6 +1794,15 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { + assert.isBigNumber('index_0', index_0); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0 + ]); + return abiEncodedTransactionData; + }, }; public MAX_OWNER_COUNT = { async callAsync( @@ -1705,6 +1837,12 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('MAX_OWNER_COUNT()', []); + return abiEncodedTransactionData; + }, }; public required = { async callAsync( @@ -1739,6 +1877,12 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('required()', []); + return abiEncodedTransactionData; + }, }; public replaceOwner = { async sendTransactionAsync( @@ -1815,18 +1959,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - owner: string, - newOwner: string, - ): string { - assert.isString('owner', owner); - assert.isString('newOwner', newOwner); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('replaceOwner(address,address)', [owner, - newOwner - ]); - return abiEncodedTransactionData; - }, async callAsync( owner: string, newOwner: string, @@ -1865,6 +1997,18 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + owner: string, + newOwner: string, + ): string { + assert.isString('owner', owner); + assert.isString('newOwner', newOwner); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('replaceOwner(address,address)', [owner, + newOwner + ]); + return abiEncodedTransactionData; + }, }; public executeTransaction = { async sendTransactionAsync( @@ -1931,15 +2075,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - assert.isBigNumber('transactionId', transactionId); - const self = this as any as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId - ]); - return abiEncodedTransactionData; - }, async callAsync( transactionId: BigNumber, callData: Partial = {}, @@ -1975,6 +2110,15 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + transactionId: BigNumber, + ): string { + assert.isBigNumber('transactionId', transactionId); + const self = this as any as AssetProxyOwnerContract; + const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId + ]); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts index eba1e902d9..d167408d0c 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts @@ -23,6 +23,7 @@ import { assert } from '@0x/assert'; import * as ethers from 'ethers'; // tslint:enable:no-unused-variable + /* istanbul ignore next */ // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name @@ -33,7 +34,8 @@ export class CoordinatorContract extends BaseContract { signature: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { assert.isString('hash', hash); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -44,8 +46,10 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, signature]); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, + signature + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -58,17 +62,32 @@ export class CoordinatorContract extends BaseContract { BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getSignerAddress(bytes32,bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + hash: string, + signature: string, + ): string { + assert.isString('hash', hash); + assert.isString('signature', signature); + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash, + signature + ]); + return abiEncodedTransactionData; + }, }; public getTransactionHash = { async callAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -77,10 +96,9 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [ - transaction, - ]); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [transaction + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -93,22 +111,29 @@ export class CoordinatorContract extends BaseContract { BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getTransactionHash((uint256,address,bytes))'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + transaction: {salt: BigNumber;signerAddress: string;data: string}, + ): string { + + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [transaction + ]); + return abiEncodedTransactionData; + }, }; public getCoordinatorApprovalHash = { async callAsync( - approval: { - txOrigin: string; - transactionHash: string; - transactionSignature: string; - approvalExpirationTimeSeconds: BigNumber; - }, + approval: {txOrigin: string;transactionHash: string;transactionSignature: string;approvalExpirationTimeSeconds: BigNumber}, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -117,11 +142,9 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments( - 'getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', - [approval], - ); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', [approval + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -134,50 +157,63 @@ export class CoordinatorContract extends BaseContract { BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + approval: {txOrigin: string;transactionHash: string;transactionSignature: string;approvalExpirationTimeSeconds: BigNumber}, + ): string { + + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', [approval + ]); + return abiEncodedTransactionData; + }, }; public executeTransaction = { async sendTransactionAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], - txData?: Partial | undefined, + txData?: Partial | undefined, ): Promise { - assert.isString('txOrigin', txOrigin); - assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); - assert.isArray('approvalSignatures', approvalSignatures); - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [transaction, txOrigin, transactionSignature, approvalExpirationTimeSeconds, approvalSignatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind( - self, - transaction, - txOrigin, - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; + + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); + assert.isArray('approvalSignatures', approvalSignatures); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin, + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + self.executeTransaction.estimateGasAsync.bind( + self, + transaction, + txOrigin, + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ), + ); + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); + return txHash; }, awaitTransactionSuccessAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], @@ -186,86 +222,72 @@ export class CoordinatorContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - assert.isString('txOrigin', txOrigin); - assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); - assert.isArray('approvalSignatures', approvalSignatures); - const self = (this as any) as CoordinatorContract; - const txHashPromise = self.executeTransaction.sendTransactionAsync( - transaction, - txOrigin, - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - txData, - ); - return new PromiseWithTransactionHash( - txHashPromise, - (async (): Promise => { - // When the transaction hash resolves, wait for it to be mined. - return self._web3Wrapper.awaitTransactionSuccessAsync( - await txHashPromise, - pollingIntervalMs, - timeoutMs, - ); - })(), - ); + + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); + assert.isArray('approvalSignatures', approvalSignatures); + const self = this as any as CoordinatorContract; + const txHashPromise = self.executeTransaction.sendTransactionAsync(transaction, + txOrigin, + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + , txData); + return new PromiseWithTransactionHash( + txHashPromise, + (async (): Promise => { + // When the transaction hash resolves, wait for it to be mined. + return self._web3Wrapper.awaitTransactionSuccessAsync( + await txHashPromise, + pollingIntervalMs, + timeoutMs, + ); + })(), + ); }, async estimateGasAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], txData?: Partial | undefined, ): Promise { - assert.isString('txOrigin', txOrigin); - assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); - assert.isArray('approvalSignatures', approvalSignatures); - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [transaction, txOrigin, transactionSignature, approvalExpirationTimeSeconds, approvalSignatures], - ); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - transaction: { salt: BigNumber; signerAddress: string; data: string }, - txOrigin: string, - transactionSignature: string, - approvalExpirationTimeSeconds: BigNumber[], - approvalSignatures: string[], - ): string { - assert.isString('txOrigin', txOrigin); - assert.isString('transactionSignature', transactionSignature); - assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); - assert.isArray('approvalSignatures', approvalSignatures); - const self = (this as any) as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [transaction, txOrigin, transactionSignature, approvalExpirationTimeSeconds, approvalSignatures], - ); - return abiEncodedTransactionData; + + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); + assert.isArray('approvalSignatures', approvalSignatures); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin, + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, async callAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { + assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); @@ -278,11 +300,13 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [transaction, txOrigin, transactionSignature, approvalExpirationTimeSeconds, approvalSignatures], - ); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin, + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -293,17 +317,41 @@ export class CoordinatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + transaction: {salt: BigNumber;signerAddress: string;data: string}, + txOrigin: string, + transactionSignature: string, + approvalExpirationTimeSeconds: BigNumber[], + approvalSignatures: string[], + ): string { + + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); + assert.isArray('approvalSignatures', approvalSignatures); + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin, + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); + return abiEncodedTransactionData; + }, }; public EIP712_EXCHANGE_DOMAIN_HASH = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -312,7 +360,7 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; + const self = this as any as CoordinatorContract; const encodedData = self._strictEncodeArguments('EIP712_EXCHANGE_DOMAIN_HASH()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -326,21 +374,30 @@ export class CoordinatorContract extends BaseContract { BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('EIP712_EXCHANGE_DOMAIN_HASH()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_EXCHANGE_DOMAIN_HASH()', []); + return abiEncodedTransactionData; + }, }; public assertValidCoordinatorApprovals = { async callAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, + transaction: {salt: BigNumber;signerAddress: string;data: string}, txOrigin: string, transactionSignature: string, approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise { + ): Promise { + assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); @@ -353,11 +410,13 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments( - 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', - [transaction, txOrigin, transactionSignature, approvalExpirationTimeSeconds, approvalSignatures], - ); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin, + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -368,35 +427,41 @@ export class CoordinatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', - ); + const abiEncoder = self._lookupAbiEncoder('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + transaction: {salt: BigNumber;signerAddress: string;data: string}, + txOrigin: string, + transactionSignature: string, + approvalExpirationTimeSeconds: BigNumber[], + approvalSignatures: string[], + ): string { + + assert.isString('txOrigin', txOrigin); + assert.isString('transactionSignature', transactionSignature); + assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds); + assert.isArray('approvalSignatures', approvalSignatures); + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction, + txOrigin, + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures + ]); + return abiEncodedTransactionData; + }, }; public decodeOrdersFromFillData = { async callAsync( data: string, callData: Partial = {}, defaultBlock?: BlockParam, - ): Promise< - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }> + ): Promise > { assert.isString('data', data); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -407,8 +472,9 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data]); + const self = this as any as CoordinatorContract; + const encodedData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data + ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -421,28 +487,27 @@ export class CoordinatorContract extends BaseContract { BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decodeOrdersFromFillData(bytes)'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue< - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }> - >(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue + >(rawCallResult); // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + data: string, + ): string { + assert.isString('data', data); + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data + ]); + return abiEncodedTransactionData; + }, }; public EIP712_COORDINATOR_DOMAIN_HASH = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + async callAsync( + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -451,7 +516,7 @@ export class CoordinatorContract extends BaseContract { if (defaultBlock !== undefined) { assert.isBlockParam('defaultBlock', defaultBlock); } - const self = (this as any) as CoordinatorContract; + const self = this as any as CoordinatorContract; const encodedData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -465,16 +530,23 @@ export class CoordinatorContract extends BaseContract { BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_HASH()'); // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as CoordinatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - _exchange: string, + _exchange: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -487,14 +559,15 @@ export class CoordinatorContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return CoordinatorContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange); + return CoordinatorContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange +); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - _exchange: string, + _exchange: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -504,17 +577,20 @@ export class CoordinatorContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange] = BaseContract._formatABIDataItemList( + [_exchange +] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [_exchange], + [_exchange +], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange]); + const txData = deployInfo.encode(bytecode, [_exchange +]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { data: txData }, + {data: txData}, txDefaults, web3Wrapper.estimateGasAsync.bind(web3Wrapper), ); @@ -522,13 +598,9 @@ export class CoordinatorContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`Coordinator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new CoordinatorContract( - abi, - txReceipt.contractAddress as string, - provider, - txDefaults, - ); - contractInstance.constructorArgs = [_exchange]; + const contractInstance = new CoordinatorContract(abi, txReceipt.contractAddress as string, provider, txDefaults); + contractInstance.constructorArgs = [_exchange +]; return contractInstance; } constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial) { diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts index a046b03936..3ef94cddfd 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts @@ -105,15 +105,6 @@ export class CoordinatorRegistryContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - coordinatorEndpoint: string, - ): string { - assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const self = this as any as CoordinatorRegistryContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint - ]); - return abiEncodedTransactionData; - }, async callAsync( coordinatorEndpoint: string, callData: Partial = {}, @@ -149,6 +140,15 @@ export class CoordinatorRegistryContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + coordinatorEndpoint: string, + ): string { + assert.isString('coordinatorEndpoint', coordinatorEndpoint); + const self = this as any as CoordinatorRegistryContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint + ]); + return abiEncodedTransactionData; + }, }; public getCoordinatorEndpoint = { async callAsync( @@ -186,6 +186,15 @@ export class CoordinatorRegistryContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + coordinatorOperator: string, + ): string { + assert.isString('coordinatorOperator', coordinatorOperator); + const self = this as any as CoordinatorRegistryContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [coordinatorOperator + ]); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts index 9f7a74233a..92630757ce 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts @@ -82,6 +82,12 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); + return abiEncodedTransactionData; + }, }; public approve = { async sendTransactionAsync( @@ -158,18 +164,6 @@ export class DummyERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _spender: string, - _value: BigNumber, - ): string { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender, - _value - ]); - return abiEncodedTransactionData; - }, async callAsync( _spender: string, _value: BigNumber, @@ -208,6 +202,18 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _spender: string, + _value: BigNumber, + ): string { + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender, + _value + ]); + return abiEncodedTransactionData; + }, }; public totalSupply = { async callAsync( @@ -242,6 +248,12 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); + return abiEncodedTransactionData; + }, }; public transferFrom = { async sendTransactionAsync( @@ -328,21 +340,6 @@ export class DummyERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _value: BigNumber, - ): string { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, - _to, - _value - ]); - return abiEncodedTransactionData; - }, async callAsync( _from: string, _to: string, @@ -384,6 +381,21 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _from: string, + _to: string, + _value: BigNumber, + ): string { + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, + _to, + _value + ]); + return abiEncodedTransactionData; + }, }; public decimals = { async callAsync( @@ -418,6 +430,12 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); + return abiEncodedTransactionData; + }, }; public balanceOf = { async callAsync( @@ -455,6 +473,15 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _owner: string, + ): string { + assert.isString('_owner', _owner); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner + ]); + return abiEncodedTransactionData; + }, }; public owner = { async callAsync( @@ -489,6 +516,12 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); + return abiEncodedTransactionData; + }, }; public symbol = { async callAsync( @@ -523,6 +556,12 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); + return abiEncodedTransactionData; + }, }; public mint = { async sendTransactionAsync( @@ -589,15 +628,6 @@ export class DummyERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _value: BigNumber, - ): string { - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('mint(uint256)', [_value - ]); - return abiEncodedTransactionData; - }, async callAsync( _value: BigNumber, callData: Partial = {}, @@ -633,6 +663,15 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _value: BigNumber, + ): string { + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('mint(uint256)', [_value + ]); + return abiEncodedTransactionData; + }, }; public transfer = { async sendTransactionAsync( @@ -709,18 +748,6 @@ export class DummyERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _to: string, - _value: BigNumber, - ): string { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to, - _value - ]); - return abiEncodedTransactionData; - }, async callAsync( _to: string, _value: BigNumber, @@ -759,6 +786,18 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _to: string, + _value: BigNumber, + ): string { + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to, + _value + ]); + return abiEncodedTransactionData; + }, }; public allowance = { async callAsync( @@ -799,6 +838,18 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _owner: string, + _spender: string, + ): string { + assert.isString('_owner', _owner); + assert.isString('_spender', _spender); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [_owner, + _spender + ]); + return abiEncodedTransactionData; + }, }; public setBalance = { async sendTransactionAsync( @@ -875,18 +926,6 @@ export class DummyERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _target: string, - _value: BigNumber, - ): string { - assert.isString('_target', _target); - assert.isBigNumber('_value', _value); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setBalance(address,uint256)', [_target, - _value - ]); - return abiEncodedTransactionData; - }, async callAsync( _target: string, _value: BigNumber, @@ -925,6 +964,18 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _target: string, + _value: BigNumber, + ): string { + assert.isString('_target', _target); + assert.isBigNumber('_value', _value); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setBalance(address,uint256)', [_target, + _value + ]); + return abiEncodedTransactionData; + }, }; public transferOwnership = { async sendTransactionAsync( @@ -991,15 +1042,6 @@ export class DummyERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - assert.isString('newOwner', newOwner); - const self = this as any as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner - ]); - return abiEncodedTransactionData; - }, async callAsync( newOwner: string, callData: Partial = {}, @@ -1035,6 +1077,15 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + newOwner: string, + ): string { + assert.isString('newOwner', newOwner); + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner + ]); + return abiEncodedTransactionData; + }, }; public MAX_MINT_AMOUNT = { async callAsync( @@ -1069,6 +1120,12 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('MAX_MINT_AMOUNT()', []); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts index cca9e48444..36d35038d5 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts @@ -90,6 +90,12 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); + return abiEncodedTransactionData; + }, }; public getApproved = { async callAsync( @@ -127,6 +133,15 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _tokenId: BigNumber, + ): string { + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId + ]); + return abiEncodedTransactionData; + }, }; public approve = { async sendTransactionAsync( @@ -203,18 +218,6 @@ export class DummyERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _approved: string, - _tokenId: BigNumber, - ): string { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved, - _tokenId - ]); - return abiEncodedTransactionData; - }, async callAsync( _approved: string, _tokenId: BigNumber, @@ -253,6 +256,18 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _approved: string, + _tokenId: BigNumber, + ): string { + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved, + _tokenId + ]); + return abiEncodedTransactionData; + }, }; public transferFrom = { async sendTransactionAsync( @@ -339,21 +354,6 @@ export class DummyERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - ): string { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, - _to, - _tokenId - ]); - return abiEncodedTransactionData; - }, async callAsync( _from: string, _to: string, @@ -395,6 +395,21 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + ): string { + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, + _to, + _tokenId + ]); + return abiEncodedTransactionData; + }, }; public mint = { async sendTransactionAsync( @@ -471,18 +486,6 @@ export class DummyERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _to: string, - _tokenId: BigNumber, - ): string { - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('mint(address,uint256)', [_to, - _tokenId - ]); - return abiEncodedTransactionData; - }, async callAsync( _to: string, _tokenId: BigNumber, @@ -521,6 +524,18 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _to: string, + _tokenId: BigNumber, + ): string { + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('mint(address,uint256)', [_to, + _tokenId + ]); + return abiEncodedTransactionData; + }, }; public safeTransferFrom1 = { async sendTransactionAsync( @@ -607,21 +622,6 @@ export class DummyERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - ): string { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from, - _to, - _tokenId - ]); - return abiEncodedTransactionData; - }, async callAsync( _from: string, _to: string, @@ -663,6 +663,21 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + ): string { + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from, + _to, + _tokenId + ]); + return abiEncodedTransactionData; + }, }; public ownerOf = { async callAsync( @@ -700,6 +715,15 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _tokenId: BigNumber, + ): string { + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId + ]); + return abiEncodedTransactionData; + }, }; public balanceOf = { async callAsync( @@ -737,6 +761,15 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _owner: string, + ): string { + assert.isString('_owner', _owner); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner + ]); + return abiEncodedTransactionData; + }, }; public owner = { async callAsync( @@ -771,6 +804,12 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); + return abiEncodedTransactionData; + }, }; public symbol = { async callAsync( @@ -805,6 +844,12 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); + return abiEncodedTransactionData; + }, }; public burn = { async sendTransactionAsync( @@ -881,18 +926,6 @@ export class DummyERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _owner: string, - _tokenId: BigNumber, - ): string { - assert.isString('_owner', _owner); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('burn(address,uint256)', [_owner, - _tokenId - ]); - return abiEncodedTransactionData; - }, async callAsync( _owner: string, _tokenId: BigNumber, @@ -931,6 +964,18 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _owner: string, + _tokenId: BigNumber, + ): string { + assert.isString('_owner', _owner); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('burn(address,uint256)', [_owner, + _tokenId + ]); + return abiEncodedTransactionData; + }, }; public setApprovalForAll = { async sendTransactionAsync( @@ -1007,18 +1052,6 @@ export class DummyERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _operator: string, - _approved: boolean, - ): string { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, - _approved - ]); - return abiEncodedTransactionData; - }, async callAsync( _operator: string, _approved: boolean, @@ -1057,6 +1090,18 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _operator: string, + _approved: boolean, + ): string { + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, + _approved + ]); + return abiEncodedTransactionData; + }, }; public safeTransferFrom2 = { async sendTransactionAsync( @@ -1153,24 +1198,6 @@ export class DummyERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - _data: string, - ): string { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from, - _to, - _tokenId, - _data - ]); - return abiEncodedTransactionData; - }, async callAsync( _from: string, _to: string, @@ -1215,6 +1242,24 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + _data: string, + ): string { + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from, + _to, + _tokenId, + _data + ]); + return abiEncodedTransactionData; + }, }; public isApprovedForAll = { async callAsync( @@ -1255,6 +1300,18 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _owner: string, + _operator: string, + ): string { + assert.isString('_owner', _owner); + assert.isString('_operator', _operator); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner, + _operator + ]); + return abiEncodedTransactionData; + }, }; public transferOwnership = { async sendTransactionAsync( @@ -1321,15 +1378,6 @@ export class DummyERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - assert.isString('newOwner', newOwner); - const self = this as any as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner - ]); - return abiEncodedTransactionData; - }, async callAsync( newOwner: string, callData: Partial = {}, @@ -1365,6 +1413,15 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + newOwner: string, + ): string { + assert.isString('newOwner', newOwner); + const self = this as any as DummyERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner + ]); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts index 145d660385..451029f08c 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts @@ -33,7 +33,7 @@ export class DutchAuctionContract extends BaseContract { order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, txData?: Partial | undefined, ): Promise { - + const self = this as any as DutchAuctionContract; const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order ]); @@ -58,7 +58,7 @@ export class DutchAuctionContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - + const self = this as any as DutchAuctionContract; const txHashPromise = self.getAuctionDetails.sendTransactionAsync(order , txData); @@ -78,7 +78,7 @@ export class DutchAuctionContract extends BaseContract { order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, txData?: Partial | undefined, ): Promise { - + const self = this as any as DutchAuctionContract; const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order ]); @@ -93,22 +93,13 @@ export class DutchAuctionContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - ): string { - - const self = this as any as DutchAuctionContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); - return abiEncodedTransactionData; - }, async callAsync( order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, callData: Partial = {}, defaultBlock?: BlockParam, ): Promise<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber} > { - + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -137,6 +128,15 @@ export class DutchAuctionContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + ): string { + + const self = this as any as DutchAuctionContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); + return abiEncodedTransactionData; + }, }; public matchOrders = { async sendTransactionAsync( @@ -146,8 +146,8 @@ export class DutchAuctionContract extends BaseContract { sellSignature: string, txData?: Partial | undefined, ): Promise { - - + + assert.isString('buySignature', buySignature); assert.isString('sellSignature', sellSignature); const self = this as any as DutchAuctionContract; @@ -183,8 +183,8 @@ export class DutchAuctionContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - + + assert.isString('buySignature', buySignature); assert.isString('sellSignature', sellSignature); const self = this as any as DutchAuctionContract; @@ -212,8 +212,8 @@ export class DutchAuctionContract extends BaseContract { sellSignature: string, txData?: Partial | undefined, ): Promise { - - + + assert.isString('buySignature', buySignature); assert.isString('sellSignature', sellSignature); const self = this as any as DutchAuctionContract; @@ -233,24 +233,6 @@ export class DutchAuctionContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - buySignature: string, - sellSignature: string, - ): string { - - - assert.isString('buySignature', buySignature); - assert.isString('sellSignature', sellSignature); - const self = this as any as DutchAuctionContract; - const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, - sellOrder, - buySignature, - sellSignature - ]); - return abiEncodedTransactionData; - }, async callAsync( buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, @@ -260,8 +242,8 @@ export class DutchAuctionContract extends BaseContract { defaultBlock?: BlockParam, ): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} > { - - + + assert.isString('buySignature', buySignature); assert.isString('sellSignature', sellSignature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -295,6 +277,24 @@ export class DutchAuctionContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + buySignature: string, + sellSignature: string, + ): string { + + + assert.isString('buySignature', buySignature); + assert.isString('sellSignature', sellSignature); + const self = this as any as DutchAuctionContract; + const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder, + sellOrder, + buySignature, + sellSignature + ]); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts index c9de7652db..d967dd17fb 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts @@ -112,15 +112,6 @@ export class ERC20ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - target: string, - ): string { - assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target - ]); - return abiEncodedTransactionData; - }, async callAsync( target: string, callData: Partial = {}, @@ -156,6 +147,15 @@ export class ERC20ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + target: string, + ): string { + assert.isString('target', target); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target + ]); + return abiEncodedTransactionData; + }, }; public authorities = { async callAsync( @@ -193,6 +193,15 @@ export class ERC20ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { + assert.isBigNumber('index_0', index_0); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0 + ]); + return abiEncodedTransactionData; + }, }; public removeAuthorizedAddress = { async sendTransactionAsync( @@ -259,15 +268,6 @@ export class ERC20ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - target: string, - ): string { - assert.isString('target', target); - const self = this as any as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target - ]); - return abiEncodedTransactionData; - }, async callAsync( target: string, callData: Partial = {}, @@ -303,6 +303,15 @@ export class ERC20ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + target: string, + ): string { + assert.isString('target', target); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target + ]); + return abiEncodedTransactionData; + }, }; public owner = { async callAsync( @@ -337,6 +346,12 @@ export class ERC20ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); + return abiEncodedTransactionData; + }, }; public removeAuthorizedAddressAtIndex = { async sendTransactionAsync( @@ -413,18 +428,6 @@ export class ERC20ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - target: string, - index: BigNumber, - ): string { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target, - index - ]); - return abiEncodedTransactionData; - }, async callAsync( target: string, index: BigNumber, @@ -463,6 +466,18 @@ export class ERC20ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + target: string, + index: BigNumber, + ): string { + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target, + index + ]); + return abiEncodedTransactionData; + }, }; public getProxyId = { async callAsync( @@ -497,6 +512,12 @@ export class ERC20ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); + return abiEncodedTransactionData; + }, }; public authorized = { async callAsync( @@ -534,6 +555,15 @@ export class ERC20ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: string, + ): string { + assert.isString('index_0', index_0); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0 + ]); + return abiEncodedTransactionData; + }, }; public getAuthorizedAddresses = { async callAsync( @@ -568,6 +598,12 @@ export class ERC20ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); + return abiEncodedTransactionData; + }, }; public transferOwnership = { async sendTransactionAsync( @@ -634,15 +670,6 @@ export class ERC20ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - assert.isString('newOwner', newOwner); - const self = this as any as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner - ]); - return abiEncodedTransactionData; - }, async callAsync( newOwner: string, callData: Partial = {}, @@ -678,6 +705,15 @@ export class ERC20ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + newOwner: string, + ): string { + assert.isString('newOwner', newOwner); + const self = this as any as ERC20ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner + ]); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts index f0b71c3741..33e58a225b 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts @@ -124,18 +124,6 @@ export class ERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _spender: string, - _value: BigNumber, - ): string { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender, - _value - ]); - return abiEncodedTransactionData; - }, async callAsync( _spender: string, _value: BigNumber, @@ -174,6 +162,18 @@ export class ERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _spender: string, + _value: BigNumber, + ): string { + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender, + _value + ]); + return abiEncodedTransactionData; + }, }; public totalSupply = { async callAsync( @@ -208,6 +208,12 @@ export class ERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); + return abiEncodedTransactionData; + }, }; public transferFrom = { async sendTransactionAsync( @@ -294,21 +300,6 @@ export class ERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _value: BigNumber, - ): string { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, - _to, - _value - ]); - return abiEncodedTransactionData; - }, async callAsync( _from: string, _to: string, @@ -350,6 +341,21 @@ export class ERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _from: string, + _to: string, + _value: BigNumber, + ): string { + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, + _to, + _value + ]); + return abiEncodedTransactionData; + }, }; public balanceOf = { async callAsync( @@ -387,6 +393,15 @@ export class ERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _owner: string, + ): string { + assert.isString('_owner', _owner); + const self = this as any as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner + ]); + return abiEncodedTransactionData; + }, }; public transfer = { async sendTransactionAsync( @@ -463,18 +478,6 @@ export class ERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _to: string, - _value: BigNumber, - ): string { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to, - _value - ]); - return abiEncodedTransactionData; - }, async callAsync( _to: string, _value: BigNumber, @@ -513,6 +516,18 @@ export class ERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _to: string, + _value: BigNumber, + ): string { + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to, + _value + ]); + return abiEncodedTransactionData; + }, }; public allowance = { async callAsync( @@ -553,6 +568,18 @@ export class ERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _owner: string, + _spender: string, + ): string { + assert.isString('_owner', _owner); + assert.isString('_spender', _spender); + const self = this as any as ERC20TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [_owner, + _spender + ]); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts index af29c8f854..d8fe3c68d5 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts @@ -112,15 +112,6 @@ export class ERC721ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - target: string, - ): string { - assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target - ]); - return abiEncodedTransactionData; - }, async callAsync( target: string, callData: Partial = {}, @@ -156,6 +147,15 @@ export class ERC721ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + target: string, + ): string { + assert.isString('target', target); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target + ]); + return abiEncodedTransactionData; + }, }; public authorities = { async callAsync( @@ -193,6 +193,15 @@ export class ERC721ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { + assert.isBigNumber('index_0', index_0); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0 + ]); + return abiEncodedTransactionData; + }, }; public removeAuthorizedAddress = { async sendTransactionAsync( @@ -259,15 +268,6 @@ export class ERC721ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - target: string, - ): string { - assert.isString('target', target); - const self = this as any as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target - ]); - return abiEncodedTransactionData; - }, async callAsync( target: string, callData: Partial = {}, @@ -303,6 +303,15 @@ export class ERC721ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + target: string, + ): string { + assert.isString('target', target); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target + ]); + return abiEncodedTransactionData; + }, }; public owner = { async callAsync( @@ -337,6 +346,12 @@ export class ERC721ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); + return abiEncodedTransactionData; + }, }; public removeAuthorizedAddressAtIndex = { async sendTransactionAsync( @@ -413,18 +428,6 @@ export class ERC721ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - target: string, - index: BigNumber, - ): string { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target, - index - ]); - return abiEncodedTransactionData; - }, async callAsync( target: string, index: BigNumber, @@ -463,6 +466,18 @@ export class ERC721ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + target: string, + index: BigNumber, + ): string { + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target, + index + ]); + return abiEncodedTransactionData; + }, }; public getProxyId = { async callAsync( @@ -497,6 +512,12 @@ export class ERC721ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); + return abiEncodedTransactionData; + }, }; public authorized = { async callAsync( @@ -534,6 +555,15 @@ export class ERC721ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: string, + ): string { + assert.isString('index_0', index_0); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0 + ]); + return abiEncodedTransactionData; + }, }; public getAuthorizedAddresses = { async callAsync( @@ -568,6 +598,12 @@ export class ERC721ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); + return abiEncodedTransactionData; + }, }; public transferOwnership = { async sendTransactionAsync( @@ -634,15 +670,6 @@ export class ERC721ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - assert.isString('newOwner', newOwner); - const self = this as any as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner - ]); - return abiEncodedTransactionData; - }, async callAsync( newOwner: string, callData: Partial = {}, @@ -678,6 +705,15 @@ export class ERC721ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + newOwner: string, + ): string { + assert.isString('newOwner', newOwner); + const self = this as any as ERC721ProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner + ]); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts index 7662120ac0..905ced0b75 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts @@ -93,6 +93,15 @@ export class ERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _tokenId: BigNumber, + ): string { + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId + ]); + return abiEncodedTransactionData; + }, }; public approve = { async sendTransactionAsync( @@ -169,18 +178,6 @@ export class ERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _approved: string, - _tokenId: BigNumber, - ): string { - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved, - _tokenId - ]); - return abiEncodedTransactionData; - }, async callAsync( _approved: string, _tokenId: BigNumber, @@ -219,6 +216,18 @@ export class ERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _approved: string, + _tokenId: BigNumber, + ): string { + assert.isString('_approved', _approved); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved, + _tokenId + ]); + return abiEncodedTransactionData; + }, }; public transferFrom = { async sendTransactionAsync( @@ -305,21 +314,6 @@ export class ERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - ): string { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, - _to, - _tokenId - ]); - return abiEncodedTransactionData; - }, async callAsync( _from: string, _to: string, @@ -361,6 +355,21 @@ export class ERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + ): string { + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, + _to, + _tokenId + ]); + return abiEncodedTransactionData; + }, }; public safeTransferFrom1 = { async sendTransactionAsync( @@ -447,21 +456,6 @@ export class ERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - ): string { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from, - _to, - _tokenId - ]); - return abiEncodedTransactionData; - }, async callAsync( _from: string, _to: string, @@ -503,6 +497,21 @@ export class ERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + ): string { + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from, + _to, + _tokenId + ]); + return abiEncodedTransactionData; + }, }; public ownerOf = { async callAsync( @@ -540,6 +549,15 @@ export class ERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _tokenId: BigNumber, + ): string { + assert.isBigNumber('_tokenId', _tokenId); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId + ]); + return abiEncodedTransactionData; + }, }; public balanceOf = { async callAsync( @@ -577,6 +595,15 @@ export class ERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _owner: string, + ): string { + assert.isString('_owner', _owner); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner + ]); + return abiEncodedTransactionData; + }, }; public setApprovalForAll = { async sendTransactionAsync( @@ -653,18 +680,6 @@ export class ERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _operator: string, - _approved: boolean, - ): string { - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, - _approved - ]); - return abiEncodedTransactionData; - }, async callAsync( _operator: string, _approved: boolean, @@ -703,6 +718,18 @@ export class ERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _operator: string, + _approved: boolean, + ): string { + assert.isString('_operator', _operator); + assert.isBoolean('_approved', _approved); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, + _approved + ]); + return abiEncodedTransactionData; + }, }; public safeTransferFrom2 = { async sendTransactionAsync( @@ -799,24 +826,6 @@ export class ERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - _data: string, - ): string { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const self = this as any as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from, - _to, - _tokenId, - _data - ]); - return abiEncodedTransactionData; - }, async callAsync( _from: string, _to: string, @@ -861,6 +870,24 @@ export class ERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _from: string, + _to: string, + _tokenId: BigNumber, + _data: string, + ): string { + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_tokenId', _tokenId); + assert.isString('_data', _data); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from, + _to, + _tokenId, + _data + ]); + return abiEncodedTransactionData; + }, }; public isApprovedForAll = { async callAsync( @@ -901,6 +928,18 @@ export class ERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _owner: string, + _operator: string, + ): string { + assert.isString('_owner', _owner); + assert.isString('_operator', _operator); + const self = this as any as ERC721TokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner, + _operator + ]); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts index 08e20ecb26..0c2ed366a6 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts @@ -119,6 +119,15 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: string, + ): string { + assert.isString('index_0', index_0); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('filled(bytes32)', [index_0 + ]); + return abiEncodedTransactionData; + }, }; public batchFillOrders = { async sendTransactionAsync( @@ -205,21 +214,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); - return abiEncodedTransactionData; - }, async callAsync( orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], @@ -261,6 +255,21 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAssetFillAmounts: BigNumber[], + signatures: string[], + ): string { + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); + return abiEncodedTransactionData; + }, }; public cancelled = { async callAsync( @@ -298,6 +307,15 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: string, + ): string { + assert.isString('index_0', index_0); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('cancelled(bytes32)', [index_0 + ]); + return abiEncodedTransactionData; + }, }; public preSign = { async sendTransactionAsync( @@ -384,21 +402,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - hash: string, - signerAddress: string, - signature: string, - ): string { - assert.isString('hash', hash); - assert.isString('signerAddress', signerAddress); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, - signerAddress, - signature - ]); - return abiEncodedTransactionData; - }, async callAsync( hash: string, signerAddress: string, @@ -440,6 +443,21 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + hash: string, + signerAddress: string, + signature: string, + ): string { + assert.isString('hash', hash); + assert.isString('signerAddress', signerAddress); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash, + signerAddress, + signature + ]); + return abiEncodedTransactionData; + }, }; public matchOrders = { async sendTransactionAsync( @@ -449,8 +467,8 @@ export class ExchangeContract extends BaseContract { rightSignature: string, txData?: Partial | undefined, ): Promise { - - + + assert.isString('leftSignature', leftSignature); assert.isString('rightSignature', rightSignature); const self = this as any as ExchangeContract; @@ -486,8 +504,8 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - - + + assert.isString('leftSignature', leftSignature); assert.isString('rightSignature', rightSignature); const self = this as any as ExchangeContract; @@ -515,8 +533,8 @@ export class ExchangeContract extends BaseContract { rightSignature: string, txData?: Partial | undefined, ): Promise { - - + + assert.isString('leftSignature', leftSignature); assert.isString('rightSignature', rightSignature); const self = this as any as ExchangeContract; @@ -536,24 +554,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - leftSignature: string, - rightSignature: string, - ): string { - - - assert.isString('leftSignature', leftSignature); - assert.isString('rightSignature', rightSignature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - return abiEncodedTransactionData; - }, async callAsync( leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, @@ -563,8 +563,8 @@ export class ExchangeContract extends BaseContract { defaultBlock?: BlockParam, ): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} > { - - + + assert.isString('leftSignature', leftSignature); assert.isString('rightSignature', rightSignature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -598,6 +598,24 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + leftSignature: string, + rightSignature: string, + ): string { + + + assert.isString('leftSignature', leftSignature); + assert.isString('rightSignature', rightSignature); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder, + rightOrder, + leftSignature, + rightSignature + ]); + return abiEncodedTransactionData; + }, }; public fillOrderNoThrow = { async sendTransactionAsync( @@ -606,7 +624,7 @@ export class ExchangeContract extends BaseContract { signature: string, txData?: Partial | undefined, ): Promise { - + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); const self = this as any as ExchangeContract; @@ -639,7 +657,7 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); const self = this as any as ExchangeContract; @@ -665,7 +683,7 @@ export class ExchangeContract extends BaseContract { signature: string, txData?: Partial | undefined, ): Promise { - + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); const self = this as any as ExchangeContract; @@ -684,21 +702,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); - return abiEncodedTransactionData; - }, async callAsync( order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, @@ -707,7 +710,7 @@ export class ExchangeContract extends BaseContract { defaultBlock?: BlockParam, ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} > { - + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -740,6 +743,21 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + takerAssetFillAmount: BigNumber, + signature: string, + ): string { + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); + return abiEncodedTransactionData; + }, }; public assetProxies = { async callAsync( @@ -777,6 +795,15 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: string, + ): string { + assert.isString('index_0', index_0); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 + ]); + return abiEncodedTransactionData; + }, }; public batchCancelOrders = { async sendTransactionAsync( @@ -843,15 +870,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - ): string { - assert.isArray('orders', orders); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders - ]); - return abiEncodedTransactionData; - }, async callAsync( orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, callData: Partial = {}, @@ -887,6 +905,15 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + ): string { + assert.isArray('orders', orders); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders + ]); + return abiEncodedTransactionData; + }, }; public batchFillOrKillOrders = { async sendTransactionAsync( @@ -973,21 +1000,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); - return abiEncodedTransactionData; - }, async callAsync( orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], @@ -1029,6 +1041,21 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAssetFillAmounts: BigNumber[], + signatures: string[], + ): string { + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); + return abiEncodedTransactionData; + }, }; public cancelOrdersUpTo = { async sendTransactionAsync( @@ -1095,15 +1122,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - targetOrderEpoch: BigNumber, - ): string { - assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch - ]); - return abiEncodedTransactionData; - }, async callAsync( targetOrderEpoch: BigNumber, callData: Partial = {}, @@ -1139,6 +1157,15 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + targetOrderEpoch: BigNumber, + ): string { + assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch + ]); + return abiEncodedTransactionData; + }, }; public batchFillOrdersNoThrow = { async sendTransactionAsync( @@ -1225,21 +1252,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { - assert.isArray('orders', orders); - assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, - takerAssetFillAmounts, - signatures - ]); - return abiEncodedTransactionData; - }, async callAsync( orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmounts: BigNumber[], @@ -1281,6 +1293,21 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAssetFillAmounts: BigNumber[], + signatures: string[], + ): string { + assert.isArray('orders', orders); + assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders, + takerAssetFillAmounts, + signatures + ]); + return abiEncodedTransactionData; + }, }; public getAssetProxy = { async callAsync( @@ -1318,6 +1345,15 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + assetProxyId: string, + ): string { + assert.isString('assetProxyId', assetProxyId); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId + ]); + return abiEncodedTransactionData; + }, }; public transactions = { async callAsync( @@ -1355,6 +1391,15 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: string, + ): string { + assert.isString('index_0', index_0); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transactions(bytes32)', [index_0 + ]); + return abiEncodedTransactionData; + }, }; public fillOrKillOrder = { async sendTransactionAsync( @@ -1363,7 +1408,7 @@ export class ExchangeContract extends BaseContract { signature: string, txData?: Partial | undefined, ): Promise { - + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); const self = this as any as ExchangeContract; @@ -1396,7 +1441,7 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); const self = this as any as ExchangeContract; @@ -1422,7 +1467,7 @@ export class ExchangeContract extends BaseContract { signature: string, txData?: Partial | undefined, ): Promise { - + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); const self = this as any as ExchangeContract; @@ -1441,21 +1486,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); - return abiEncodedTransactionData; - }, async callAsync( order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, @@ -1464,7 +1494,7 @@ export class ExchangeContract extends BaseContract { defaultBlock?: BlockParam, ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} > { - + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -1497,6 +1527,21 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + takerAssetFillAmount: BigNumber, + signature: string, + ): string { + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); + return abiEncodedTransactionData; + }, }; public setSignatureValidatorApproval = { async sendTransactionAsync( @@ -1573,18 +1618,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - validatorAddress: string, - approval: boolean, - ): string { - assert.isString('validatorAddress', validatorAddress); - assert.isBoolean('approval', approval); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress, - approval - ]); - return abiEncodedTransactionData; - }, async callAsync( validatorAddress: string, approval: boolean, @@ -1623,6 +1656,18 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + validatorAddress: string, + approval: boolean, + ): string { + assert.isString('validatorAddress', validatorAddress); + assert.isBoolean('approval', approval); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress, + approval + ]); + return abiEncodedTransactionData; + }, }; public allowedValidators = { async callAsync( @@ -1663,6 +1708,18 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: string, + index_1: string, + ): string { + assert.isString('index_0', index_0); + assert.isString('index_1', index_1); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowedValidators(address,address)', [index_0, + index_1 + ]); + return abiEncodedTransactionData; + }, }; public marketSellOrders = { async sendTransactionAsync( @@ -1749,21 +1806,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - ): string { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); - return abiEncodedTransactionData; - }, async callAsync( orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, @@ -1805,6 +1847,21 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAssetFillAmount: BigNumber, + signatures: string[], + ): string { + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); + return abiEncodedTransactionData; + }, }; public getOrdersInfo = { async callAsync( @@ -1842,6 +1899,15 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + ): string { + assert.isArray('orders', orders); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders + ]); + return abiEncodedTransactionData; + }, }; public preSigned = { async callAsync( @@ -1882,6 +1948,18 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: string, + index_1: string, + ): string { + assert.isString('index_0', index_0); + assert.isString('index_1', index_1); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('preSigned(bytes32,address)', [index_0, + index_1 + ]); + return abiEncodedTransactionData; + }, }; public owner = { async callAsync( @@ -1916,6 +1994,12 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); + return abiEncodedTransactionData; + }, }; public isValidSignature = { async callAsync( @@ -1959,6 +2043,21 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + hash: string, + signerAddress: string, + signature: string, + ): string { + assert.isString('hash', hash); + assert.isString('signerAddress', signerAddress); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, + signerAddress, + signature + ]); + return abiEncodedTransactionData; + }, }; public marketBuyOrdersNoThrow = { async sendTransactionAsync( @@ -2045,21 +2144,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - ): string { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); - return abiEncodedTransactionData; - }, async callAsync( orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, @@ -2101,6 +2185,21 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + makerAssetFillAmount: BigNumber, + signatures: string[], + ): string { + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); + return abiEncodedTransactionData; + }, }; public fillOrder = { async sendTransactionAsync( @@ -2109,7 +2208,7 @@ export class ExchangeContract extends BaseContract { signature: string, txData?: Partial | undefined, ): Promise { - + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); const self = this as any as ExchangeContract; @@ -2142,7 +2241,7 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); const self = this as any as ExchangeContract; @@ -2168,7 +2267,7 @@ export class ExchangeContract extends BaseContract { signature: string, txData?: Partial | undefined, ): Promise { - + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); const self = this as any as ExchangeContract; @@ -2187,21 +2286,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { - - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, - takerAssetFillAmount, - signature - ]); - return abiEncodedTransactionData; - }, async callAsync( order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, takerAssetFillAmount: BigNumber, @@ -2210,7 +2294,7 @@ export class ExchangeContract extends BaseContract { defaultBlock?: BlockParam, ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} > { - + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -2243,6 +2327,21 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + takerAssetFillAmount: BigNumber, + signature: string, + ): string { + + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order, + takerAssetFillAmount, + signature + ]); + return abiEncodedTransactionData; + }, }; public executeTransaction = { async sendTransactionAsync( @@ -2339,24 +2438,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - salt: BigNumber, - signerAddress: string, - data: string, - signature: string, - ): string { - assert.isBigNumber('salt', salt); - assert.isString('signerAddress', signerAddress); - assert.isString('data', data); - assert.isString('signature', signature); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, - signerAddress, - data, - signature - ]); - return abiEncodedTransactionData; - }, async callAsync( salt: BigNumber, signerAddress: string, @@ -2401,6 +2482,24 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + salt: BigNumber, + signerAddress: string, + data: string, + signature: string, + ): string { + assert.isBigNumber('salt', salt); + assert.isString('signerAddress', signerAddress); + assert.isString('data', data); + assert.isString('signature', signature); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt, + signerAddress, + data, + signature + ]); + return abiEncodedTransactionData; + }, }; public registerAssetProxy = { async sendTransactionAsync( @@ -2467,15 +2566,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - assetProxy: string, - ): string { - assert.isString('assetProxy', assetProxy); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy - ]); - return abiEncodedTransactionData; - }, async callAsync( assetProxy: string, callData: Partial = {}, @@ -2511,6 +2601,15 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + assetProxy: string, + ): string { + assert.isString('assetProxy', assetProxy); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy + ]); + return abiEncodedTransactionData; + }, }; public getOrderInfo = { async callAsync( @@ -2519,7 +2618,7 @@ export class ExchangeContract extends BaseContract { defaultBlock?: BlockParam, ): Promise<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber} > { - + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -2548,13 +2647,22 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + ): string { + + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); + return abiEncodedTransactionData; + }, }; public cancelOrder = { async sendTransactionAsync( order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, txData?: Partial | undefined, ): Promise { - + const self = this as any as ExchangeContract; const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order ]); @@ -2579,7 +2687,7 @@ export class ExchangeContract extends BaseContract { pollingIntervalMs?: number, timeoutMs?: number, ): PromiseWithTransactionHash { - + const self = this as any as ExchangeContract; const txHashPromise = self.cancelOrder.sendTransactionAsync(order , txData); @@ -2599,7 +2707,7 @@ export class ExchangeContract extends BaseContract { order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, txData?: Partial | undefined, ): Promise { - + const self = this as any as ExchangeContract; const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order ]); @@ -2614,22 +2722,13 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - ): string { - - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); - return abiEncodedTransactionData; - }, async callAsync( order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, callData: Partial = {}, defaultBlock?: BlockParam, ): Promise { - + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, schemas.numberSchema, @@ -2658,6 +2757,15 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + ): string { + + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order + ]); + return abiEncodedTransactionData; + }, }; public orderEpoch = { async callAsync( @@ -2698,6 +2806,18 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: string, + index_1: string, + ): string { + assert.isString('index_0', index_0); + assert.isString('index_1', index_1); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('orderEpoch(address,address)', [index_0, + index_1 + ]); + return abiEncodedTransactionData; + }, }; public ZRX_ASSET_DATA = { async callAsync( @@ -2732,6 +2852,12 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('ZRX_ASSET_DATA()', []); + return abiEncodedTransactionData; + }, }; public marketSellOrdersNoThrow = { async sendTransactionAsync( @@ -2818,21 +2944,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - ): string { - assert.isArray('orders', orders); - assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - takerAssetFillAmount, - signatures - ]); - return abiEncodedTransactionData; - }, async callAsync( orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, takerAssetFillAmount: BigNumber, @@ -2874,6 +2985,21 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAssetFillAmount: BigNumber, + signatures: string[], + ): string { + assert.isArray('orders', orders); + assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + takerAssetFillAmount, + signatures + ]); + return abiEncodedTransactionData; + }, }; public EIP712_DOMAIN_HASH = { async callAsync( @@ -2908,6 +3034,12 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_DOMAIN_HASH()', []); + return abiEncodedTransactionData; + }, }; public marketBuyOrders = { async sendTransactionAsync( @@ -2994,21 +3126,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - ): string { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, - makerAssetFillAmount, - signatures - ]); - return abiEncodedTransactionData; - }, async callAsync( orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, @@ -3050,6 +3167,21 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + makerAssetFillAmount: BigNumber, + signatures: string[], + ): string { + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders, + makerAssetFillAmount, + signatures + ]); + return abiEncodedTransactionData; + }, }; public currentContextAddress = { async callAsync( @@ -3084,6 +3216,12 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('currentContextAddress()', []); + return abiEncodedTransactionData; + }, }; public transferOwnership = { async sendTransactionAsync( @@ -3150,15 +3288,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - assert.isString('newOwner', newOwner); - const self = this as any as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner - ]); - return abiEncodedTransactionData; - }, async callAsync( newOwner: string, callData: Partial = {}, @@ -3194,6 +3323,15 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + newOwner: string, + ): string { + assert.isString('newOwner', newOwner); + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner + ]); + return abiEncodedTransactionData; + }, }; public VERSION = { async callAsync( @@ -3228,6 +3366,12 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as ExchangeContract; + const abiEncodedTransactionData = self._strictEncodeArguments('VERSION()', []); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts index 931f22d947..d1a0368152 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts @@ -153,33 +153,6 @@ export class ForwarderContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - ): string { - assert.isArray('orders', orders); - assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - return abiEncodedTransactionData; - }, async callAsync( orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, makerAssetFillAmount: BigNumber, @@ -233,6 +206,33 @@ export class ForwarderContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + makerAssetFillAmount: BigNumber, + signatures: string[], + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeSignatures: string[], + feePercentage: BigNumber, + feeRecipient: string, + ): string { + assert.isArray('orders', orders); + assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = this as any as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + makerAssetFillAmount, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient + ]); + return abiEncodedTransactionData; + }, }; public withdrawAsset = { async sendTransactionAsync( @@ -309,18 +309,6 @@ export class ForwarderContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - assetData: string, - amount: BigNumber, - ): string { - assert.isString('assetData', assetData); - assert.isBigNumber('amount', amount); - const self = this as any as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, - amount - ]); - return abiEncodedTransactionData; - }, async callAsync( assetData: string, amount: BigNumber, @@ -359,6 +347,18 @@ export class ForwarderContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + assetData: string, + amount: BigNumber, + ): string { + assert.isString('assetData', assetData); + assert.isBigNumber('amount', amount); + const self = this as any as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData, + amount + ]); + return abiEncodedTransactionData; + }, }; public owner = { async callAsync( @@ -393,6 +393,12 @@ export class ForwarderContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); + return abiEncodedTransactionData; + }, }; public marketSellOrdersWithEth = { async sendTransactionAsync( @@ -509,30 +515,6 @@ export class ForwarderContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - ): string { - assert.isArray('orders', orders); - assert.isArray('signatures', signatures); - assert.isArray('feeOrders', feeOrders); - assert.isArray('feeSignatures', feeSignatures); - assert.isBigNumber('feePercentage', feePercentage); - assert.isString('feeRecipient', feeRecipient); - const self = this as any as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - return abiEncodedTransactionData; - }, async callAsync( orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, signatures: string[], @@ -583,6 +565,30 @@ export class ForwarderContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + signatures: string[], + feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + feeSignatures: string[], + feePercentage: BigNumber, + feeRecipient: string, + ): string { + assert.isArray('orders', orders); + assert.isArray('signatures', signatures); + assert.isArray('feeOrders', feeOrders); + assert.isArray('feeSignatures', feeSignatures); + assert.isBigNumber('feePercentage', feePercentage); + assert.isString('feeRecipient', feeRecipient); + const self = this as any as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders, + signatures, + feeOrders, + feeSignatures, + feePercentage, + feeRecipient + ]); + return abiEncodedTransactionData; + }, }; public transferOwnership = { async sendTransactionAsync( @@ -649,15 +655,6 @@ export class ForwarderContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - assert.isString('newOwner', newOwner); - const self = this as any as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner - ]); - return abiEncodedTransactionData; - }, async callAsync( newOwner: string, callData: Partial = {}, @@ -693,6 +690,15 @@ export class ForwarderContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + newOwner: string, + ): string { + assert.isString('newOwner', newOwner); + const self = this as any as ForwarderContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner + ]); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_asset_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_asset_proxy.ts index 0f765b2e1c..2c8822841c 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_asset_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_asset_proxy.ts @@ -93,15 +93,6 @@ export class IAssetProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - target: string, - ): string { - assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target - ]); - return abiEncodedTransactionData; - }, async callAsync( target: string, callData: Partial = {}, @@ -137,6 +128,15 @@ export class IAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + target: string, + ): string { + assert.isString('target', target); + const self = this as any as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target + ]); + return abiEncodedTransactionData; + }, }; public removeAuthorizedAddress = { async sendTransactionAsync( @@ -203,15 +203,6 @@ export class IAssetProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - target: string, - ): string { - assert.isString('target', target); - const self = this as any as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target - ]); - return abiEncodedTransactionData; - }, async callAsync( target: string, callData: Partial = {}, @@ -247,6 +238,15 @@ export class IAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + target: string, + ): string { + assert.isString('target', target); + const self = this as any as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target + ]); + return abiEncodedTransactionData; + }, }; public removeAuthorizedAddressAtIndex = { async sendTransactionAsync( @@ -323,18 +323,6 @@ export class IAssetProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - target: string, - index: BigNumber, - ): string { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target, - index - ]); - return abiEncodedTransactionData; - }, async callAsync( target: string, index: BigNumber, @@ -373,6 +361,18 @@ export class IAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + target: string, + index: BigNumber, + ): string { + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target, + index + ]); + return abiEncodedTransactionData; + }, }; public transferFrom = { async sendTransactionAsync( @@ -469,24 +469,6 @@ export class IAssetProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - assetData: string, - from: string, - to: string, - amount: BigNumber, - ): string { - assert.isString('assetData', assetData); - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('amount', amount); - const self = this as any as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, - from, - to, - amount - ]); - return abiEncodedTransactionData; - }, async callAsync( assetData: string, from: string, @@ -531,6 +513,24 @@ export class IAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + assetData: string, + from: string, + to: string, + amount: BigNumber, + ): string { + assert.isString('assetData', assetData); + assert.isString('from', from); + assert.isString('to', to); + assert.isBigNumber('amount', amount); + const self = this as any as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData, + from, + to, + amount + ]); + return abiEncodedTransactionData; + }, }; public getProxyId = { async callAsync( @@ -565,6 +565,12 @@ export class IAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); + return abiEncodedTransactionData; + }, }; public getAuthorizedAddresses = { async callAsync( @@ -599,6 +605,12 @@ export class IAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); + return abiEncodedTransactionData; + }, }; public transferOwnership = { async sendTransactionAsync( @@ -665,15 +677,6 @@ export class IAssetProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - assert.isString('newOwner', newOwner); - const self = this as any as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner - ]); - return abiEncodedTransactionData; - }, async callAsync( newOwner: string, callData: Partial = {}, @@ -709,6 +712,15 @@ export class IAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + newOwner: string, + ): string { + assert.isString('newOwner', newOwner); + const self = this as any as IAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner + ]); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts index fd3cdf57b0..f6e539fe3c 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts @@ -70,6 +70,21 @@ export class IValidatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + hash: string, + signerAddress: string, + signature: string, + ): string { + assert.isString('hash', hash); + assert.isString('signerAddress', signerAddress); + assert.isString('signature', signature); + const self = this as any as IValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, + signerAddress, + signature + ]); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts index 2dd78c4682..467a562b14 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts @@ -67,6 +67,18 @@ export class IWalletContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + hash: string, + signature: string, + ): string { + assert.isString('hash', hash); + assert.isString('signature', signature); + const self = this as any as IWalletContract; + const abiEncodedTransactionData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash, + signature + ]); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, 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 index f271562c81..4be6136367 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts @@ -90,6 +90,15 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: string, + ): string { + assert.isString('index_0', index_0); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0 + ]); + return abiEncodedTransactionData; + }, }; public addAuthorizedAddress = { async sendTransactionAsync( @@ -156,15 +165,6 @@ export class MultiAssetProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - target: string, - ): string { - assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target - ]); - return abiEncodedTransactionData; - }, async callAsync( target: string, callData: Partial = {}, @@ -200,6 +200,15 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + target: string, + ): string { + assert.isString('target', target); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target + ]); + return abiEncodedTransactionData; + }, }; public authorities = { async callAsync( @@ -237,6 +246,15 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: BigNumber, + ): string { + assert.isBigNumber('index_0', index_0); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0 + ]); + return abiEncodedTransactionData; + }, }; public getAssetProxy = { async callAsync( @@ -274,6 +292,15 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + assetProxyId: string, + ): string { + assert.isString('assetProxyId', assetProxyId); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId + ]); + return abiEncodedTransactionData; + }, }; public removeAuthorizedAddress = { async sendTransactionAsync( @@ -340,15 +367,6 @@ export class MultiAssetProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - target: string, - ): string { - assert.isString('target', target); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target - ]); - return abiEncodedTransactionData; - }, async callAsync( target: string, callData: Partial = {}, @@ -384,6 +402,15 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + target: string, + ): string { + assert.isString('target', target); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target + ]); + return abiEncodedTransactionData; + }, }; public owner = { async callAsync( @@ -418,6 +445,12 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); + return abiEncodedTransactionData; + }, }; public removeAuthorizedAddressAtIndex = { async sendTransactionAsync( @@ -494,18 +527,6 @@ export class MultiAssetProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - target: string, - index: BigNumber, - ): string { - assert.isString('target', target); - assert.isBigNumber('index', index); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target, - index - ]); - return abiEncodedTransactionData; - }, async callAsync( target: string, index: BigNumber, @@ -544,6 +565,18 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + target: string, + index: BigNumber, + ): string { + assert.isString('target', target); + assert.isBigNumber('index', index); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target, + index + ]); + return abiEncodedTransactionData; + }, }; public getProxyId = { async callAsync( @@ -578,6 +611,12 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); + return abiEncodedTransactionData; + }, }; public authorized = { async callAsync( @@ -615,6 +654,15 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: string, + ): string { + assert.isString('index_0', index_0); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [index_0 + ]); + return abiEncodedTransactionData; + }, }; public registerAssetProxy = { async sendTransactionAsync( @@ -681,15 +729,6 @@ export class MultiAssetProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - assetProxy: string, - ): string { - assert.isString('assetProxy', assetProxy); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy - ]); - return abiEncodedTransactionData; - }, async callAsync( assetProxy: string, callData: Partial = {}, @@ -725,6 +764,15 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + assetProxy: string, + ): string { + assert.isString('assetProxy', assetProxy); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy + ]); + return abiEncodedTransactionData; + }, }; public getAuthorizedAddresses = { async callAsync( @@ -759,6 +807,12 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); + return abiEncodedTransactionData; + }, }; public transferOwnership = { async sendTransactionAsync( @@ -825,15 +879,6 @@ export class MultiAssetProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - assert.isString('newOwner', newOwner); - const self = this as any as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner - ]); - return abiEncodedTransactionData; - }, async callAsync( newOwner: string, callData: Partial = {}, @@ -869,6 +914,15 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + newOwner: string, + ): string { + assert.isString('newOwner', newOwner); + const self = this as any as MultiAssetProxyContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner + ]); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts index ce6df7a751..81542b62c0 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts @@ -36,7 +36,7 @@ export class OrderValidatorContract extends BaseContract { defaultBlock?: BlockParam, ): Promise<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}] > { - + assert.isString('takerAddress', takerAddress); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -67,6 +67,18 @@ export class OrderValidatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + takerAddress: string, + ): string { + + assert.isString('takerAddress', takerAddress); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, + takerAddress + ]); + return abiEncodedTransactionData; + }, }; public getBalanceAndAllowance = { async callAsync( @@ -107,6 +119,18 @@ export class OrderValidatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + target: string, + assetData: string, + ): string { + assert.isString('target', target); + assert.isString('assetData', assetData); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [target, + assetData + ]); + return abiEncodedTransactionData; + }, }; public getOrdersAndTradersInfo = { async callAsync( @@ -147,6 +171,18 @@ export class OrderValidatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAddresses: string[], + ): string { + assert.isArray('orders', orders); + assert.isArray('takerAddresses', takerAddresses); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, + takerAddresses + ]); + return abiEncodedTransactionData; + }, }; public getTradersInfo = { async callAsync( @@ -187,6 +223,18 @@ export class OrderValidatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, + takerAddresses: string[], + ): string { + assert.isArray('orders', orders); + assert.isArray('takerAddresses', takerAddresses); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders, + takerAddresses + ]); + return abiEncodedTransactionData; + }, }; public getERC721TokenOwner = { async callAsync( @@ -227,6 +275,18 @@ export class OrderValidatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + token: string, + tokenId: BigNumber, + ): string { + assert.isString('token', token); + assert.isBigNumber('tokenId', tokenId); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [token, + tokenId + ]); + return abiEncodedTransactionData; + }, }; public getBalancesAndAllowances = { async callAsync( @@ -267,6 +327,18 @@ export class OrderValidatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + target: string, + assetData: string[], + ): string { + assert.isString('target', target); + assert.isArray('assetData', assetData); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [target, + assetData + ]); + return abiEncodedTransactionData; + }, }; public getTraderInfo = { async callAsync( @@ -276,7 +348,7 @@ export class OrderValidatorContract extends BaseContract { defaultBlock?: BlockParam, ): Promise<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber} > { - + assert.isString('takerAddress', takerAddress); assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ schemas.addressSchema, @@ -307,6 +379,18 @@ export class OrderValidatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, + takerAddress: string, + ): string { + + assert.isString('takerAddress', takerAddress); + const self = this as any as OrderValidatorContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order, + takerAddress + ]); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts index cab88c5c6a..84e05b13c2 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts @@ -96,6 +96,12 @@ export class WETH9Contract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); + return abiEncodedTransactionData; + }, }; public approve = { async sendTransactionAsync( @@ -172,18 +178,6 @@ export class WETH9Contract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - guy: string, - wad: BigNumber, - ): string { - assert.isString('guy', guy); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [guy, - wad - ]); - return abiEncodedTransactionData; - }, async callAsync( guy: string, wad: BigNumber, @@ -222,6 +216,18 @@ export class WETH9Contract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + guy: string, + wad: BigNumber, + ): string { + assert.isString('guy', guy); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [guy, + wad + ]); + return abiEncodedTransactionData; + }, }; public totalSupply = { async callAsync( @@ -256,6 +262,12 @@ export class WETH9Contract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); + return abiEncodedTransactionData; + }, }; public transferFrom = { async sendTransactionAsync( @@ -342,21 +354,6 @@ export class WETH9Contract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - src: string, - dst: string, - wad: BigNumber, - ): string { - assert.isString('src', src); - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src, - dst, - wad - ]); - return abiEncodedTransactionData; - }, async callAsync( src: string, dst: string, @@ -398,6 +395,21 @@ export class WETH9Contract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + src: string, + dst: string, + wad: BigNumber, + ): string { + assert.isString('src', src); + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src, + dst, + wad + ]); + return abiEncodedTransactionData; + }, }; public withdraw = { async sendTransactionAsync( @@ -464,15 +476,6 @@ export class WETH9Contract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - wad: BigNumber, - ): string { - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('withdraw(uint256)', [wad - ]); - return abiEncodedTransactionData; - }, async callAsync( wad: BigNumber, callData: Partial = {}, @@ -508,6 +511,15 @@ export class WETH9Contract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + wad: BigNumber, + ): string { + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('withdraw(uint256)', [wad + ]); + return abiEncodedTransactionData; + }, }; public decimals = { async callAsync( @@ -542,6 +554,12 @@ export class WETH9Contract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); + return abiEncodedTransactionData; + }, }; public balanceOf = { async callAsync( @@ -579,6 +597,15 @@ export class WETH9Contract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: string, + ): string { + assert.isString('index_0', index_0); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [index_0 + ]); + return abiEncodedTransactionData; + }, }; public symbol = { async callAsync( @@ -613,6 +640,12 @@ export class WETH9Contract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); + return abiEncodedTransactionData; + }, }; public transfer = { async sendTransactionAsync( @@ -689,18 +722,6 @@ export class WETH9Contract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - dst: string, - wad: BigNumber, - ): string { - assert.isString('dst', dst); - assert.isBigNumber('wad', wad); - const self = this as any as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [dst, - wad - ]); - return abiEncodedTransactionData; - }, async callAsync( dst: string, wad: BigNumber, @@ -739,6 +760,18 @@ export class WETH9Contract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + dst: string, + wad: BigNumber, + ): string { + assert.isString('dst', dst); + assert.isBigNumber('wad', wad); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [dst, + wad + ]); + return abiEncodedTransactionData; + }, }; public deposit = { async sendTransactionAsync( @@ -795,12 +828,6 @@ export class WETH9Contract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - ): string { - const self = this as any as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('deposit()', []); - return abiEncodedTransactionData; - }, async callAsync( callData: Partial = {}, defaultBlock?: BlockParam, @@ -833,6 +860,12 @@ export class WETH9Contract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('deposit()', []); + return abiEncodedTransactionData; + }, }; public allowance = { async callAsync( @@ -873,6 +906,18 @@ export class WETH9Contract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + index_0: string, + index_1: string, + ): string { + assert.isString('index_0', index_0); + assert.isString('index_1', index_1); + const self = this as any as WETH9Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [index_0, + index_1 + ]); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts index 4ccf414f2a..10d8f654fb 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts @@ -82,6 +82,12 @@ export class ZRXTokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); + return abiEncodedTransactionData; + }, }; public approve = { async sendTransactionAsync( @@ -158,18 +164,6 @@ export class ZRXTokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _spender: string, - _value: BigNumber, - ): string { - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender, - _value - ]); - return abiEncodedTransactionData; - }, async callAsync( _spender: string, _value: BigNumber, @@ -208,6 +202,18 @@ export class ZRXTokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _spender: string, + _value: BigNumber, + ): string { + assert.isString('_spender', _spender); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender, + _value + ]); + return abiEncodedTransactionData; + }, }; public totalSupply = { async callAsync( @@ -242,6 +248,12 @@ export class ZRXTokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); + return abiEncodedTransactionData; + }, }; public transferFrom = { async sendTransactionAsync( @@ -328,21 +340,6 @@ export class ZRXTokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _value: BigNumber, - ): string { - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, - _to, - _value - ]); - return abiEncodedTransactionData; - }, async callAsync( _from: string, _to: string, @@ -384,6 +381,21 @@ export class ZRXTokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _from: string, + _to: string, + _value: BigNumber, + ): string { + assert.isString('_from', _from); + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, + _to, + _value + ]); + return abiEncodedTransactionData; + }, }; public decimals = { async callAsync( @@ -418,6 +430,12 @@ export class ZRXTokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); + return abiEncodedTransactionData; + }, }; public balanceOf = { async callAsync( @@ -455,6 +473,15 @@ export class ZRXTokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _owner: string, + ): string { + assert.isString('_owner', _owner); + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner + ]); + return abiEncodedTransactionData; + }, }; public symbol = { async callAsync( @@ -489,6 +516,12 @@ export class ZRXTokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + ): string { + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); + return abiEncodedTransactionData; + }, }; public transfer = { async sendTransactionAsync( @@ -565,18 +598,6 @@ export class ZRXTokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - getABIEncodedTransactionData( - _to: string, - _value: BigNumber, - ): string { - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const self = this as any as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to, - _value - ]); - return abiEncodedTransactionData; - }, async callAsync( _to: string, _value: BigNumber, @@ -615,6 +636,18 @@ export class ZRXTokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _to: string, + _value: BigNumber, + ): string { + assert.isString('_to', _to); + assert.isBigNumber('_value', _value); + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to, + _value + ]); + return abiEncodedTransactionData; + }, }; public allowance = { async callAsync( @@ -655,6 +688,18 @@ export class ZRXTokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, + getABIEncodedTransactionData( + _owner: string, + _spender: string, + ): string { + assert.isString('_owner', _owner); + assert.isString('_spender', _spender); + const self = this as any as ZRXTokenContract; + const abiEncodedTransactionData = self._strictEncodeArguments('allowance(address,address)', [_owner, + _spender + ]); + return abiEncodedTransactionData; + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index e841621650..bcb388b6c6 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -279,6 +279,7 @@ export enum RevertReason { WalletError = 'WALLET_ERROR', ValidatorError = 'VALIDATOR_ERROR', InvalidFunctionSelector = 'INVALID_FUNCTION_SELECTOR', + InvalidAssetData = 'InvalidAssetData', InvalidAssetProxy = 'INVALID_ASSET_PROXY', UnregisteredAssetProxy = 'UNREGISTERED_ASSET_PROXY', TxFullyConfirmed = 'TX_FULLY_CONFIRMED', From 5810e7df82219d2ddd0cd91e5f138e58e884ede9 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sun, 9 Jun 2019 21:10:57 -0700 Subject: [PATCH 10/16] Add StaticCallProxy support to LibAssetData --- .../dev-utils/contracts/src/LibAssetData.sol | 23 ++++++++ contracts/dev-utils/test/lib_asset_data.ts | 54 +++++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/contracts/dev-utils/contracts/src/LibAssetData.sol b/contracts/dev-utils/contracts/src/LibAssetData.sol index dc6f2929fd..c2d5dcc804 100644 --- a/contracts/dev-utils/contracts/src/LibAssetData.sol +++ b/contracts/dev-utils/contracts/src/LibAssetData.sol @@ -43,6 +43,9 @@ contract LibAssetData is bytes4 constant internal _ERC1155_BALANCE_OF_SELECTOR = 0x00fdd58e; bytes4 constant internal _ERC1155_IS_APPROVED_FOR_ALL_SELECTOR = 0xe985e9c5; + // `transferFrom` selector for all AssetProxy contracts + bytes4 constant internal _ASSET_PROXY_TRANSFER_FROM_SELECTOR = 0xa85e59e4; + using LibBytes for bytes; // solhint-disable var-name-mixedcase @@ -50,6 +53,7 @@ contract LibAssetData is address internal _ERC20_PROXY_ADDRESS; address internal _ERC721_PROXY_ADDRESS; address internal _ERC1155_PROXY_ADDRESS; + address internal _STATIC_CALL_PROXY_ADDRESS; // solhint-enable var-name-mixedcase constructor (address _exchange) @@ -59,6 +63,7 @@ contract LibAssetData is _ERC20_PROXY_ADDRESS = _EXCHANGE.getAssetProxy(ERC20_PROXY_ID); _ERC721_PROXY_ADDRESS = _EXCHANGE.getAssetProxy(ERC721_PROXY_ID); _ERC1155_PROXY_ADDRESS = _EXCHANGE.getAssetProxy(ERC1155_PROXY_ID); + _STATIC_CALL_PROXY_ADDRESS = _EXCHANGE.getAssetProxy(STATIC_CALL_PROXY_ID); } /// @dev Returns the owner's balance of the assets(s) specified in @@ -115,6 +120,21 @@ contract LibAssetData is balance = scaledBalance; } } + } else if (assetProxyId == STATIC_CALL_PROXY_ID) { + // Encode data for `staticCallProxy.transferFrom(assetData,...)` + bytes memory transferFromData = abi.encodeWithSelector( + _ASSET_PROXY_TRANSFER_FROM_SELECTOR, + assetData, + address(0), // `from` address is not used + address(0), // `to` address is not used + 0 // `amount` is not used + ); + + // Check if staticcall would be successful + (bool success,) = _STATIC_CALL_PROXY_ADDRESS.staticcall(transferFromData); + + // Success means that the staticcall can be made an unlimited amount of times + balance = success ? _MAX_UINT256 : 0; } else if (assetProxyId == MULTI_ASSET_PROXY_ID) { // Get array of values and array of assetDatas (, uint256[] memory assetAmounts, bytes[] memory nestedAssetData) = decodeMultiAssetData(assetData); @@ -241,6 +261,9 @@ contract LibAssetData is // Query allowance (bool success, bytes memory returnData) = tokenAddress.staticcall(isApprovedForAllData); allowance = success && returnData.length == 32 && returnData.readUint256(0) == 1 ? _MAX_UINT256 : 0; + } else if (assetProxyId == STATIC_CALL_PROXY_ID) { + // The StaticCallProxy does not require any approvals + allowance = _MAX_UINT256; } // Allowance will be 0 if the assetProxyId is unknown diff --git a/contracts/dev-utils/test/lib_asset_data.ts b/contracts/dev-utils/test/lib_asset_data.ts index d9708f3f4f..24c32fc1d1 100644 --- a/contracts/dev-utils/test/lib_asset_data.ts +++ b/contracts/dev-utils/test/lib_asset_data.ts @@ -7,6 +7,8 @@ import { ERC20ProxyContract, ERC721ProxyContract, MultiAssetProxyContract, + StaticCallProxyContract, + TestStaticCallTargetContract, } from '@0x/contracts-asset-proxy'; import { artifacts as erc1155Artifacts, @@ -21,6 +23,7 @@ import { BlockchainLifecycle } from '@0x/dev-utils'; import { assetDataUtils } from '@0x/order-utils'; import { AssetProxyId } from '@0x/types'; import { BigNumber } from '@0x/utils'; +import * as ethUtil from 'ethereumjs-util'; import { artifacts, LibAssetDataContract } from '../src'; @@ -65,6 +68,8 @@ describe('LibAssetData', () => { let erc721Proxy: ERC721ProxyContract; let erc1155Proxy: ERC1155ProxyContract; let multiAssetProxy: MultiAssetProxyContract; + let staticCallProxy: StaticCallProxyContract; + let staticCallTarget: TestStaticCallTargetContract; let libAssetData: LibAssetDataContract; let tokenOwnerAddress: string; @@ -110,11 +115,17 @@ describe('LibAssetData', () => { provider, txDefaults, ); + staticCallProxy = await StaticCallProxyContract.deployFrom0xArtifactAsync( + proxyArtifacts.StaticCallProxy, + provider, + txDefaults, + ); await exchange.registerAssetProxy.awaitTransactionSuccessAsync(erc20Proxy.address); await exchange.registerAssetProxy.awaitTransactionSuccessAsync(erc721Proxy.address); await exchange.registerAssetProxy.awaitTransactionSuccessAsync(erc1155Proxy.address); await exchange.registerAssetProxy.awaitTransactionSuccessAsync(multiAssetProxy.address); + await exchange.registerAssetProxy.awaitTransactionSuccessAsync(staticCallProxy.address); libAssetData = await LibAssetDataContract.deployFrom0xArtifactAsync( artifacts.LibAssetData, @@ -123,6 +134,12 @@ describe('LibAssetData', () => { exchange.address, ); + staticCallTarget = await TestStaticCallTargetContract.deployFrom0xArtifactAsync( + proxyArtifacts.TestStaticCallTarget, + provider, + txDefaults, + ); + [tokenOwnerAddress] = await web3Wrapper.getAvailableAddressesAsync(); erc20Token = await DummyERC20TokenContract.deployFrom0xArtifactAsync( @@ -324,6 +341,32 @@ describe('LibAssetData', () => { const balance = await libAssetData.getBalance.callAsync(tokenOwnerAddress, fakeAssetData); expect(balance).to.bignumber.equal(constants.ZERO_AMOUNT); }); + + it('should return a balance of MAX_UINT256 if the the StaticCallProxy assetData contains data for a successful staticcall', async () => { + const staticCallData = staticCallTarget.isOddNumber.getABIEncodedTransactionData(new BigNumber(1)); + const trueAsBuffer = ethUtil.toBuffer('0x0000000000000000000000000000000000000000000000000000000000000001'); + const expectedResultHash = ethUtil.bufferToHex(ethUtil.sha3(trueAsBuffer)); + const assetData = assetDataUtils.encodeStaticCallAssetData( + staticCallTarget.address, + staticCallData, + expectedResultHash, + ); + const balance = await libAssetData.getBalance.callAsync(tokenOwnerAddress, assetData); + expect(balance).to.bignumber.equal(constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); + }); + + it('should return a balance of 0 if the the StaticCallProxy assetData contains data for an unsuccessful staticcall', async () => { + const staticCallData = staticCallTarget.isOddNumber.getABIEncodedTransactionData(new BigNumber(0)); + const trueAsBuffer = ethUtil.toBuffer('0x0000000000000000000000000000000000000000000000000000000000000001'); + const expectedResultHash = ethUtil.bufferToHex(ethUtil.sha3(trueAsBuffer)); + const assetData = assetDataUtils.encodeStaticCallAssetData( + staticCallTarget.address, + staticCallData, + expectedResultHash, + ); + const balance = await libAssetData.getBalance.callAsync(tokenOwnerAddress, assetData); + expect(balance).to.bignumber.equal(constants.ZERO_AMOUNT); + }); }); describe('getAssetProxyAllowance', () => { @@ -399,6 +442,17 @@ describe('LibAssetData', () => { const allowance = await libAssetData.getAssetProxyAllowance.callAsync(tokenOwnerAddress, fakeAssetData); expect(allowance).to.bignumber.equal(constants.ZERO_AMOUNT); }); + + it('should return an allowance of MAX_UINT256 for any staticCallAssetData', async () => { + const staticCallData = AssetProxyId.StaticCall; + const assetData = assetDataUtils.encodeStaticCallAssetData( + staticCallTarget.address, + staticCallData, + constants.KECCAK256_NULL, + ); + const allowance = await libAssetData.getAssetProxyAllowance.callAsync(tokenOwnerAddress, assetData); + expect(allowance).to.bignumber.equal(constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS); + }); }); describe('getBatchBalances', () => { From 92ce258bb4930f266fdbbf82bf942e2f499c8f94 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sun, 9 Jun 2019 21:31:19 -0700 Subject: [PATCH 11/16] Remove pipeline package from CI build --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index c2f53b7407..db5f06ec4a 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,9 @@ "install:all": "yarn install", "wsrun": "wsrun", "lerna": "lerna", - "build": "lerna link && wsrun build $PKG --fast-exit -r --stages --exclude-missing", - "build:no_website": "lerna link && wsrun build $PKG --fast-exit -r --stages --exclude @0x/website --exclude-missing", - "build:ci:no_website": "lerna link && wsrun build:ci $PKG --fast-exit -r --stages --exclude @0x/website --exclude-missing", + "build": "lerna link && wsrun build $PKG --fast-exit -r --stages --exclude @0x/pipeline --exclude-missing", + "build:no_website": "lerna link && wsrun build $PKG --fast-exit -r --stages --exclude @0x/website --exclude @0x/pipeline --exclude-missing", + "build:ci:no_website": "lerna link && wsrun build:ci $PKG --fast-exit -r --stages --exclude @0x/website --exclude @0x/pipeline --exclude-missing", "build:contracts": "lerna link && wsrun build -p ${npm_package_config_contractsPackages} -c --fast-exit -r --stages --exclude-missing", "build:monorepo_scripts": "PKG=@0x/monorepo-scripts yarn build", "build:ts": "tsc -b", From bf3ae730d6e4d85615c8cf683bc0a1a33b555040 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sun, 9 Jun 2019 22:23:06 -0700 Subject: [PATCH 12/16] Add fillOrder tests that use the StaticCallProxy --- contracts/exchange/test/core.ts | 243 ++++++++++++------- packages/order-utils/src/asset_data_utils.ts | 3 + 2 files changed, 158 insertions(+), 88 deletions(-) diff --git a/contracts/exchange/test/core.ts b/contracts/exchange/test/core.ts index ff6874c0ea..79b9d06185 100644 --- a/contracts/exchange/test/core.ts +++ b/contracts/exchange/test/core.ts @@ -6,6 +6,8 @@ import { ERC721ProxyContract, ERC721Wrapper, MultiAssetProxyContract, + StaticCallProxyContract, + TestStaticCallTargetContract, } from '@0x/contracts-asset-proxy'; import { ERC1155MintableContract } from '@0x/contracts-erc1155'; import { @@ -69,6 +71,8 @@ describe('Exchange core', () => { let erc721Proxy: ERC721ProxyContract; let erc1155Proxy: ERC721ProxyContract; let multiAssetProxy: MultiAssetProxyContract; + let staticCallProxy: StaticCallProxyContract; + let staticCallTarget: TestStaticCallTargetContract; let maliciousWallet: TestStaticCallReceiverContract; let maliciousValidator: TestStaticCallReceiverContract; let erc1155Contract: ERC1155MintableContract; @@ -113,6 +117,11 @@ describe('Exchange core', () => { provider, txDefaults, ); + staticCallProxy = await StaticCallProxyContract.deployFrom0xArtifactAsync( + proxyArtifacts.StaticCallProxy, + provider, + txDefaults, + ); const numDummyErc20ToDeploy = 3; [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync( numDummyErc20ToDeploy, @@ -141,66 +150,22 @@ describe('Exchange core', () => { ); // Configure ERC20Proxy - await web3Wrapper.awaitTransactionSuccessAsync( - await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { - from: owner, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, { - from: owner, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchange.address, { from: owner }); + await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(multiAssetProxy.address, { from: owner }); // Configure ERC721Proxy - await web3Wrapper.awaitTransactionSuccessAsync( - await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { - from: owner, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, { - from: owner, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchange.address, { from: owner }); + await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(multiAssetProxy.address, { from: owner }); // Configure ERC1155Proxy - await web3Wrapper.awaitTransactionSuccessAsync( - await erc1155Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { - from: owner, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await erc1155Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, { - from: owner, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchange.address, { from: owner }); + await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(multiAssetProxy.address, { from: owner }); // Configure MultiAssetProxy - await web3Wrapper.awaitTransactionSuccessAsync( - await multiAssetProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { - from: owner, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { - from: owner, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc721Proxy.address, { - from: owner, - }), - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await multiAssetProxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchange.address, { from: owner }); + await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync(erc20Proxy.address, { from: owner }); + await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync(erc721Proxy.address, { from: owner }); + await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync(staticCallProxy.address, { from: owner }); // Configure Exchange exchangeWrapper = new ExchangeWrapper(exchange, provider); @@ -208,6 +173,7 @@ describe('Exchange core', () => { await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner); await exchangeWrapper.registerAssetProxyAsync(erc1155Proxy.address, owner); await exchangeWrapper.registerAssetProxyAsync(multiAssetProxy.address, owner); + await exchangeWrapper.registerAssetProxyAsync(staticCallProxy.address, owner); // Configure ERC20 tokens await erc20Wrapper.setBalancesAndAllowancesAsync(); @@ -268,10 +234,7 @@ describe('Exchange core', () => { signedOrder = await orderFactory.newSignedOrderAsync({ makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address), }); - await web3Wrapper.awaitTransactionSuccessAsync( - await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId), - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await reentrantErc20Token.setCurrentFunction.awaitTransactionSuccessAsync(functionId); await expectTransactionFailedAsync( exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), RevertReason.TransferFailed, @@ -310,20 +273,14 @@ describe('Exchange core', () => { it('should revert if `isValidSignature` tries to update state when SignatureType=Wallet', async () => { const maliciousMakerAddress = maliciousWallet.address; - await web3Wrapper.awaitTransactionSuccessAsync( - await erc20TokenA.setBalance.sendTransactionAsync( - maliciousMakerAddress, - constants.INITIAL_ERC20_BALANCE, - ), - constants.AWAIT_TRANSACTION_MINED_MS, + await erc20TokenA.setBalance.awaitTransactionSuccessAsync( + maliciousMakerAddress, + constants.INITIAL_ERC20_BALANCE, ); - await web3Wrapper.awaitTransactionSuccessAsync( - await maliciousWallet.approveERC20.sendTransactionAsync( - erc20TokenA.address, - erc20Proxy.address, - constants.INITIAL_ERC20_ALLOWANCE, - ), - constants.AWAIT_TRANSACTION_MINED_MS, + await maliciousWallet.approveERC20.awaitTransactionSuccessAsync( + erc20TokenA.address, + erc20Proxy.address, + constants.INITIAL_ERC20_ALLOWANCE, ); signedOrder = await orderFactory.newSignedOrderAsync({ makerAddress: maliciousMakerAddress, @@ -338,13 +295,10 @@ describe('Exchange core', () => { it('should revert if `isValidSignature` tries to update state when SignatureType=Validator', async () => { const isApproved = true; - await web3Wrapper.awaitTransactionSuccessAsync( - await exchange.setSignatureValidatorApproval.sendTransactionAsync( - maliciousValidator.address, - isApproved, - { from: makerAddress }, - ), - constants.AWAIT_TRANSACTION_MINED_MS, + await exchange.setSignatureValidatorApproval.awaitTransactionSuccessAsync( + maliciousValidator.address, + isApproved, + { from: makerAddress }, ); signedOrder.signature = `${maliciousValidator.address}0${SignatureType.Validator}`; await expectTransactionFailedAsync( @@ -399,17 +353,14 @@ describe('Exchange core', () => { constants.DUMMY_TOKEN_DECIMALS, constants.DUMMY_TOKEN_TOTAL_SUPPLY, ); - await web3Wrapper.awaitTransactionSuccessAsync( - await noReturnErc20Token.setBalance.sendTransactionAsync(makerAddress, constants.INITIAL_ERC20_BALANCE), - constants.AWAIT_TRANSACTION_MINED_MS, + await noReturnErc20Token.setBalance.awaitTransactionSuccessAsync( + makerAddress, + constants.INITIAL_ERC20_BALANCE, ); - await web3Wrapper.awaitTransactionSuccessAsync( - await noReturnErc20Token.approve.sendTransactionAsync( - erc20Proxy.address, - constants.INITIAL_ERC20_ALLOWANCE, - { from: makerAddress }, - ), - constants.AWAIT_TRANSACTION_MINED_MS, + await noReturnErc20Token.approve.awaitTransactionSuccessAsync( + erc20Proxy.address, + constants.INITIAL_ERC20_ALLOWANCE, + { from: makerAddress }, ); }); it('should transfer the correct amounts when makerAssetAmount === takerAssetAmount', async () => { @@ -1516,6 +1467,122 @@ describe('Exchange core', () => { }); }); + describe('Testing orders that utilize StaticCallProxy', () => { + before(async () => { + staticCallTarget = await TestStaticCallTargetContract.deployFrom0xArtifactAsync( + proxyArtifacts.TestStaticCallTarget, + provider, + txDefaults, + ); + }); + it('should revert if the staticcall is unsuccessful', async () => { + const staticCallData = staticCallTarget.assertEvenNumber.getABIEncodedTransactionData(new BigNumber(1)); + const assetData = assetDataUtils.encodeStaticCallAssetData( + staticCallTarget.address, + staticCallData, + constants.KECCAK256_NULL, + ); + signedOrder = await orderFactory.newSignedOrderAsync({ makerAssetData: assetData }); + await expectTransactionFailedAsync( + exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), + RevertReason.TargetNotEven, + ); + }); + it('should fill the order if the staticcall is successful', async () => { + const staticCallData = staticCallTarget.assertEvenNumber.getABIEncodedTransactionData( + constants.ZERO_AMOUNT, + ); + const assetData = assetDataUtils.encodeStaticCallAssetData( + staticCallTarget.address, + staticCallData, + constants.KECCAK256_NULL, + ); + signedOrder = await orderFactory.newSignedOrderAsync({ makerAssetData: assetData }); + + const initialMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress); + const initialTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress); + const initialFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress); + const initialMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress); + const initialTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress); + + await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress); + + const finalMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress); + const finalTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress); + const finalFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress); + const finalMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress); + const finalTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress); + + expect(finalMakerZrxBalance).to.bignumber.equal(initialMakerZrxBalance.minus(signedOrder.makerFee)); + expect(finalTakerZrxBalance).to.bignumber.equal(initialTakerZrxBalance.minus(signedOrder.takerFee)); + expect(finalFeeRecipientZrxBalance).to.bignumber.equal( + initialFeeRecipientZrxBalance.plus(signedOrder.makerFee).plus(signedOrder.takerFee), + ); + expect(finalMakerBalanceB).to.bignumber.equal(initialMakerBalanceB.plus(signedOrder.takerAssetAmount)); + expect(finalTakerBalanceB).to.bignumber.equal(initialTakerBalanceB.minus(signedOrder.takerAssetAmount)); + }); + it('should revert if the staticcall is unsuccessful using the MultiAssetProxy', async () => { + const staticCallData = staticCallTarget.assertEvenNumber.getABIEncodedTransactionData(new BigNumber(1)); + const staticCallAssetData = assetDataUtils.encodeStaticCallAssetData( + staticCallTarget.address, + staticCallData, + constants.KECCAK256_NULL, + ); + const assetData = assetDataUtils.encodeMultiAssetData( + [new BigNumber(1), new BigNumber(1)], + [assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress), staticCallAssetData], + ); + signedOrder = await orderFactory.newSignedOrderAsync({ makerAssetData: assetData }); + await expectTransactionFailedAsync( + exchangeWrapper.fillOrderAsync(signedOrder, takerAddress), + RevertReason.TargetNotEven, + ); + }); + it('should fill the order is the staticcall is successful using the MultiAssetProxy', async () => { + const staticCallData = staticCallTarget.assertEvenNumber.getABIEncodedTransactionData( + constants.ZERO_AMOUNT, + ); + const staticCallAssetData = assetDataUtils.encodeStaticCallAssetData( + staticCallTarget.address, + staticCallData, + constants.KECCAK256_NULL, + ); + const assetData = assetDataUtils.encodeMultiAssetData( + [new BigNumber(1), new BigNumber(1)], + [assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress), staticCallAssetData], + ); + signedOrder = await orderFactory.newSignedOrderAsync({ makerAssetData: assetData }); + + const initialMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress); + const initialTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress); + const initialFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress); + const initialMakerBalanceA = await erc20TokenA.balanceOf.callAsync(makerAddress); + const initialTakerBalanceA = await erc20TokenA.balanceOf.callAsync(takerAddress); + const initialMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress); + const initialTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress); + + await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress); + + const finalMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress); + const finalTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress); + const finalFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress); + const finalMakerBalanceA = await erc20TokenA.balanceOf.callAsync(makerAddress); + const finalTakerBalanceA = await erc20TokenA.balanceOf.callAsync(takerAddress); + const finalMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress); + const finalTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress); + + expect(finalMakerZrxBalance).to.bignumber.equal(initialMakerZrxBalance.minus(signedOrder.makerFee)); + expect(finalTakerZrxBalance).to.bignumber.equal(initialTakerZrxBalance.minus(signedOrder.takerFee)); + expect(finalFeeRecipientZrxBalance).to.bignumber.equal( + initialFeeRecipientZrxBalance.plus(signedOrder.makerFee).plus(signedOrder.takerFee), + ); + expect(finalMakerBalanceA).to.bignumber.equal(initialMakerBalanceA.minus(signedOrder.makerAssetAmount)); + expect(finalTakerBalanceA).to.bignumber.equal(initialTakerBalanceA.plus(signedOrder.makerAssetAmount)); + expect(finalMakerBalanceB).to.bignumber.equal(initialMakerBalanceB.plus(signedOrder.takerAssetAmount)); + expect(finalTakerBalanceB).to.bignumber.equal(initialTakerBalanceB.minus(signedOrder.takerAssetAmount)); + }); + }); + describe('getOrderInfo', () => { beforeEach(async () => { signedOrder = await orderFactory.newSignedOrderAsync(); diff --git a/packages/order-utils/src/asset_data_utils.ts b/packages/order-utils/src/asset_data_utils.ts index 64ca45a84e..8aeb54646c 100644 --- a/packages/order-utils/src/asset_data_utils.ts +++ b/packages/order-utils/src/asset_data_utils.ts @@ -387,6 +387,9 @@ export const assetDataUtils = { case AssetProxyId.MultiAsset: assetDataUtils.assertIsMultiAssetData(assetData); break; + case AssetProxyId.StaticCall: + assetDataUtils.assertIsStaticCallAssetData(assetData); + break; default: throw new Error(`Unrecognized asset proxy id: ${assetProxyId}`); } From f15560bd89181761782c8eb04791a55215186f0f Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sun, 9 Jun 2019 22:36:41 -0700 Subject: [PATCH 13/16] Update CHANGELOGs --- contracts/asset-proxy/CHANGELOG.json | 17 ++++++++--------- contracts/dev-utils/CHANGELOG.json | 4 ++++ packages/abi-gen-templates/CHANGELOG.json | 4 ++++ packages/abi-gen-wrappers/CHANGELOG.json | 4 ++++ packages/order-utils/CHANGELOG.json | 9 +++++++++ packages/types/CHANGELOG.json | 13 +++++++++++++ 6 files changed, 42 insertions(+), 9 deletions(-) diff --git a/contracts/asset-proxy/CHANGELOG.json b/contracts/asset-proxy/CHANGELOG.json index 4f2e5ce78a..0458760e97 100644 --- a/contracts/asset-proxy/CHANGELOG.json +++ b/contracts/asset-proxy/CHANGELOG.json @@ -1,19 +1,18 @@ [ - { - "version": "2.3.0", - "changes": [ - { - "note": "Updated ERC1155 Asset Proxy. Less optimization. More explicit handling of edge cases.", - "pr": 1852 - } - ] - }, { "version": "2.2.0", "changes": [ { "note": "Add `LibAssetProxyIds` contract", "pr": 1835 + }, + { + "note": "Updated ERC1155 Asset Proxy. Less optimization. More explicit handling of edge cases.", + "pr": 1852 + }, + { + "note": "Implement StaticCallProxy", + "pr": 1863 } ] }, diff --git a/contracts/dev-utils/CHANGELOG.json b/contracts/dev-utils/CHANGELOG.json index 37287903d7..5f3a099b7e 100644 --- a/contracts/dev-utils/CHANGELOG.json +++ b/contracts/dev-utils/CHANGELOG.json @@ -21,6 +21,10 @@ { "note": "Refactor `OrderValidationUtils` to calculate `fillableTakerAssetAmount`", "pr": 1848 + }, + { + "note": "Add support for StaticCallProxy", + "pr": 1863 } ] } diff --git a/packages/abi-gen-templates/CHANGELOG.json b/packages/abi-gen-templates/CHANGELOG.json index 4875a97864..873c3c54b6 100644 --- a/packages/abi-gen-templates/CHANGELOG.json +++ b/packages/abi-gen-templates/CHANGELOG.json @@ -5,6 +5,10 @@ { "note": "add parameter assertions to methods", "pr": 1823 + }, + { + "note": "Move `getABITransactionData` to `callAsync` template", + "pr": 1863 } ] }, diff --git a/packages/abi-gen-wrappers/CHANGELOG.json b/packages/abi-gen-wrappers/CHANGELOG.json index 32abc72052..72dbb235e5 100644 --- a/packages/abi-gen-wrappers/CHANGELOG.json +++ b/packages/abi-gen-wrappers/CHANGELOG.json @@ -5,6 +5,10 @@ { "note": "Update wrappers to include parameter assertions", "pr": 1823 + }, + { + "note": "Update wrappers to include `getABIEncodedTransactionData` for view and pure functions", + "pr": 1863 } ] }, diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index b4f18c572b..3b6e0c2508 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "8.2.0", + "changes": [ + { + "note": "Add support for encoding/decoding StaticCallProxy assetData", + "pr": 1863 + } + ] + }, { "timestamp": 1558712885, "version": "8.1.1", diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json index f328508616..2ad2ef2512 100644 --- a/packages/types/CHANGELOG.json +++ b/packages/types/CHANGELOG.json @@ -1,4 +1,17 @@ [ + { + "version": "2.3.0", + "changes": [ + { + "note": "Add StaticCallProxy types", + "pr": 1863 + }, + { + "note": "Add `InvalidStaticCallDataOffset`, `TargetNotEven`, `UnexpectedStaticCallResult`, and `InvalidAssetDataEnd` to `RevertReason` enum", + "pr": 1863 + } + ] + }, { "version": "2.2.2", "changes": [ From 5dcf7919fc91c01b2385c3f1052fc808816523bd Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Mon, 10 Jun 2019 09:29:18 -0700 Subject: [PATCH 14/16] Fix build errors --- contracts/dev-utils/package.json | 3 ++- contracts/dev-utils/test/lib_asset_data.ts | 1 + packages/0x.js/src/index.ts | 1 + packages/contract-wrappers/src/index.ts | 1 + packages/order-utils/src/index.ts | 1 + packages/types/src/index.ts | 2 +- 6 files changed, 7 insertions(+), 2 deletions(-) diff --git a/contracts/dev-utils/package.json b/contracts/dev-utils/package.json index 6d404b7367..3e72c15607 100644 --- a/contracts/dev-utils/package.json +++ b/contracts/dev-utils/package.json @@ -82,7 +82,8 @@ "@0x/typescript-typings": "^4.2.2", "@0x/utils": "^4.3.3", "@0x/web3-wrapper": "^6.0.6", - "ethereum-types": "^2.1.2" + "ethereum-types": "^2.1.2", + "ethereumjs-util": "^5.1.1" }, "publishConfig": { "access": "public" diff --git a/contracts/dev-utils/test/lib_asset_data.ts b/contracts/dev-utils/test/lib_asset_data.ts index 24c32fc1d1..0276fb5f75 100644 --- a/contracts/dev-utils/test/lib_asset_data.ts +++ b/contracts/dev-utils/test/lib_asset_data.ts @@ -524,3 +524,4 @@ describe('LibAssetData', () => { }); }); }); +// tslint:disable:max-file-line-count diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index e312d73397..650e82a0ac 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -97,6 +97,7 @@ export { ERC1155AssetData, MultiAssetData, MultiAssetDataWithRecursiveDecoding, + StaticCallAssetData, SignatureType, ObjectMap, OrderRelevantState, diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index 1cb77bfb69..5d4bdb2519 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -70,6 +70,7 @@ export { ERC1155AssetData, SingleAssetData, MultiAssetData, + StaticCallAssetData, MultiAssetDataWithRecursiveDecoding, DutchAuctionDetails, Order, diff --git a/packages/order-utils/src/index.ts b/packages/order-utils/src/index.ts index 59c78120e5..476a0f4e0b 100644 --- a/packages/order-utils/src/index.ts +++ b/packages/order-utils/src/index.ts @@ -49,6 +49,7 @@ export { ERC721AssetData, ERC1155AssetData, MultiAssetData, + StaticCallAssetData, MultiAssetDataWithRecursiveDecoding, AssetProxyId, SignatureType, diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index bcb388b6c6..a182e995f6 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -279,7 +279,7 @@ export enum RevertReason { WalletError = 'WALLET_ERROR', ValidatorError = 'VALIDATOR_ERROR', InvalidFunctionSelector = 'INVALID_FUNCTION_SELECTOR', - InvalidAssetData = 'InvalidAssetData', + InvalidAssetData = 'INVALID_ASSET_DATA', InvalidAssetProxy = 'INVALID_ASSET_PROXY', UnregisteredAssetProxy = 'UNREGISTERED_ASSET_PROXY', TxFullyConfirmed = 'TX_FULLY_CONFIRMED', From 45aacf122fbfe98229562106b8555ecc6eba86cf Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Mon, 17 Jun 2019 12:22:06 -0700 Subject: [PATCH 15/16] Fix StaticCallProxy comment and add sanity checks to TestStaticCallTarget --- .../asset-proxy/contracts/src/StaticCallProxy.sol | 2 +- .../contracts/test/TestStaticCallTarget.sol | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/contracts/asset-proxy/contracts/src/StaticCallProxy.sol b/contracts/asset-proxy/contracts/src/StaticCallProxy.sol index 577fcdc03b..c65ef60a37 100644 --- a/contracts/asset-proxy/contracts/src/StaticCallProxy.sol +++ b/contracts/asset-proxy/contracts/src/StaticCallProxy.sol @@ -174,7 +174,7 @@ contract StaticCallProxy { // + 32 (assetData len) // + 4 (proxyId) // + 32 (callTarget) - // + 32 (assetDataOffset) + // + 32 (staticCallDataOffset) let expectedResultHash := calldataload(add(assetDataOffset, 100)) if sub(callResultHash, expectedResultHash) { diff --git a/contracts/asset-proxy/contracts/test/TestStaticCallTarget.sol b/contracts/asset-proxy/contracts/test/TestStaticCallTarget.sol index 4179d148b1..a5bf3da795 100644 --- a/contracts/asset-proxy/contracts/test/TestStaticCallTarget.sol +++ b/contracts/asset-proxy/contracts/test/TestStaticCallTarget.sol @@ -18,9 +18,13 @@ pragma solidity ^0.5.5; +import "@0x/contracts-utils/contracts/src/LibBytes.sol"; + contract TestStaticCallTarget { + using LibBytes for bytes; + uint256 internal _state; function updateState() @@ -51,12 +55,17 @@ contract TestStaticCallTarget { function noInputFunction() external pure - {} + { + assert(msg.data.length == 4 && msg.data.readBytes4(0) == bytes4(keccak256("noInputFunction()"))); + } function dynamicInputFunction(bytes calldata a) external pure - {} + { + bytes memory abiEncodedData = abi.encodeWithSignature("dynamicInputFunction(bytes)", a); + assert(msg.data.equals(abiEncodedData)); + } function returnComplexType(uint256 a, uint256 b) external From 323fb0a965364e6b16908f016768e64536fb9ade Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Mon, 17 Jun 2019 12:23:52 -0700 Subject: [PATCH 16/16] Bump solidity version pragma for undeployed AssetProxy contracts --- contracts/asset-proxy/contracts/src/ERC1155Proxy.sol | 2 +- contracts/asset-proxy/contracts/src/StaticCallProxy.sol | 2 +- contracts/asset-proxy/contracts/test/TestStaticCallTarget.sol | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/asset-proxy/contracts/src/ERC1155Proxy.sol b/contracts/asset-proxy/contracts/src/ERC1155Proxy.sol index 48a0324ec4..e1a17ff2b1 100644 --- a/contracts/asset-proxy/contracts/src/ERC1155Proxy.sol +++ b/contracts/asset-proxy/contracts/src/ERC1155Proxy.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.5.5; +pragma solidity ^0.5.9; import "./MixinAuthorizable.sol"; diff --git a/contracts/asset-proxy/contracts/src/StaticCallProxy.sol b/contracts/asset-proxy/contracts/src/StaticCallProxy.sol index c65ef60a37..9b1a7a92ef 100644 --- a/contracts/asset-proxy/contracts/src/StaticCallProxy.sol +++ b/contracts/asset-proxy/contracts/src/StaticCallProxy.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.5.5; +pragma solidity ^0.5.9; contract StaticCallProxy { diff --git a/contracts/asset-proxy/contracts/test/TestStaticCallTarget.sol b/contracts/asset-proxy/contracts/test/TestStaticCallTarget.sol index a5bf3da795..28da79c634 100644 --- a/contracts/asset-proxy/contracts/test/TestStaticCallTarget.sol +++ b/contracts/asset-proxy/contracts/test/TestStaticCallTarget.sol @@ -16,7 +16,7 @@ */ -pragma solidity ^0.5.5; +pragma solidity ^0.5.9; import "@0x/contracts-utils/contracts/src/LibBytes.sol";