diff --git a/packages/abi-gen-wrappers/CHANGELOG.json b/packages/abi-gen-wrappers/CHANGELOG.json index a764b56f1b..61f508059f 100644 --- a/packages/abi-gen-wrappers/CHANGELOG.json +++ b/packages/abi-gen-wrappers/CHANGELOG.json @@ -1,4 +1,12 @@ [ + { + "version": "5.3.0", + "changes": [ + { + "note": "Added DevUtils" + } + ] + }, { "version": "5.2.0", "changes": [ diff --git a/packages/abi-gen-wrappers/package.json b/packages/abi-gen-wrappers/package.json index e76368d6f4..188bc9946d 100644 --- a/packages/abi-gen-wrappers/package.json +++ b/packages/abi-gen-wrappers/package.json @@ -22,7 +22,7 @@ "docs": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --out generated_docs ./src/generated-wrappers/*" }, "config": { - "abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DutchAuction|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IAssetProxy|IValidator|IWallet|MultiAssetProxy|OrderValidator|WETH9|ZRXToken|Coordinator|CoordinatorRegistry|EthBalanceChecker|ERC1155Proxy|StaticCallProxy).json" + "abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DevUtils|DutchAuction|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IAssetProxy|IValidator|IWallet|MultiAssetProxy|OrderValidator|WETH9|ZRXToken|Coordinator|CoordinatorRegistry|EthBalanceChecker|ERC1155Proxy|StaticCallProxy).json" }, "repository": { "type": "git", diff --git a/packages/abi-gen-wrappers/src/index.ts b/packages/abi-gen-wrappers/src/index.ts index 17af9d43d6..b9ec431af9 100644 --- a/packages/abi-gen-wrappers/src/index.ts +++ b/packages/abi-gen-wrappers/src/index.ts @@ -1,4 +1,5 @@ export * from './generated-wrappers/asset_proxy_owner'; +export * from './generated-wrappers/dev_utils'; export * from './generated-wrappers/dummy_erc20_token'; export * from './generated-wrappers/dummy_erc721_token'; export * from './generated-wrappers/dutch_auction'; diff --git a/packages/contract-addresses/CHANGELOG.json b/packages/contract-addresses/CHANGELOG.json index bfa6a8eb2b..7f9e3c61d8 100644 --- a/packages/contract-addresses/CHANGELOG.json +++ b/packages/contract-addresses/CHANGELOG.json @@ -1,4 +1,12 @@ [ + { + "version": "3.1.0", + "changes": [ + { + "note": "Added DevUtils" + } + ] + }, { "version": "3.0.3", "changes": [ diff --git a/packages/contract-addresses/src/index.ts b/packages/contract-addresses/src/index.ts index 6fb7d8691f..66eb8c9190 100644 --- a/packages/contract-addresses/src/index.ts +++ b/packages/contract-addresses/src/index.ts @@ -15,6 +15,7 @@ export interface ContractAddresses { multiAssetProxy: string; staticCallProxy: string; erc1155Proxy: string; + devUtils: string; } export enum NetworkId { @@ -43,6 +44,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { multiAssetProxy: '0xef701d5389ae74503d633396c4d654eabedc9d78', staticCallProxy: '0x3517b88c19508c08650616019062b898ab65ed29', erc1155Proxy: '0x7eefbd48fd63d441ec7435d024ec7c5131019add', + devUtils: NULL_ADDRESS, }, 3: { erc20Proxy: '0xb1408f4c245a23c31b98d2c626777d4c0d766caa', @@ -59,6 +61,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { multiAssetProxy: '0xab8fbd189c569ccdee3a4d929bb7f557be4028f6', staticCallProxy: '0xe1b97e47aa3796276033a5341e884d2ba46b6ac1', erc1155Proxy: '0x19bb6caa3bc34d39e5a23cedfa3e6c7e7f3c931d', + devUtils: '0x3e0b46bad8e374e4a110c12b832cb120dbe4a479', }, 4: { exchange: '0xbff9493f92a3df4b0429b6d00743b3cfb4c85831', @@ -75,6 +78,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { multiAssetProxy: '0xb34cde0ad3a83d04abebc0b66e75196f22216621', staticCallProxy: '0xe1b97e47aa3796276033a5341e884d2ba46b6ac1', erc1155Proxy: '0x19bb6caa3bc34d39e5a23cedfa3e6c7e7f3c931d', + devUtils: '0x2d4a9abda7b8b3605c8dbd34e3550a7467c78287', }, 42: { erc20Proxy: '0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e', @@ -91,6 +95,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { multiAssetProxy: '0xf6313a772c222f51c28f2304c0703b8cf5428fd8', staticCallProxy: '0x48e94bdb9033640d45ea7c721e25f380f8bffa43', erc1155Proxy: '0x64517fa2b480ba3678a2a3c0cf08ef7fd4fad36f', + devUtils: '0x1e3616bc5144362f95d72de41874395567697e93', }, // NetworkId 50 represents our Ganache snapshot generated from migrations. 50: { @@ -108,6 +113,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { coordinator: '0x0d8b0dd11f5d34ed41d556def5f841900d5b1c6b', multiAssetProxy: '0xcfc18cec799fbd1793b5c43e773c98d4d61cc2db', staticCallProxy: '0x6dfff22588be9b3ef8cf0ad6dc9b84796f9fb45f', + devUtils: '0x38ef19fdf8e8415f18c307ed71967e19aac28ba1', }, }; diff --git a/packages/contract-artifacts/CHANGELOG.json b/packages/contract-artifacts/CHANGELOG.json index 959535fc07..c461e6d84b 100644 --- a/packages/contract-artifacts/CHANGELOG.json +++ b/packages/contract-artifacts/CHANGELOG.json @@ -1,4 +1,12 @@ [ + { + "version": "2.1.0", + "changes": [ + { + "note": "Added DevUtils" + } + ] + }, { "timestamp": 1565296576, "version": "2.0.4", diff --git a/packages/contract-artifacts/artifacts/DevUtils.json b/packages/contract-artifacts/artifacts/DevUtils.json new file mode 100644 index 0000000000..58e6484998 --- /dev/null +++ b/packages/contract-artifacts/artifacts/DevUtils.json @@ -0,0 +1,501 @@ +{ + "schemaVersion": "2.0.0", + "contractName": "DevUtils", + "compilerOutput": { + "abi": [ + { + "constant": true, + "inputs": [{ "name": "assetData", "type": "bytes" }], + "name": "decodeERC721AssetData", + "outputs": [ + { "name": "assetProxyId", "type": "bytes4" }, + { "name": "tokenAddress", "type": "address" }, + { "name": "tokenId", "type": "uint256" } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "ownerAddress", "type": "address" }, { "name": "assetData", "type": "bytes" }], + "name": "getBalanceAndAssetProxyAllowance", + "outputs": [{ "name": "balance", "type": "uint256" }, { "name": "allowance", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ERC1155_PROXY_ID", + "outputs": [{ "name": "", "type": "bytes4" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "ownerAddress", "type": "address" }, { "name": "assetData", "type": "bytes" }], + "name": "getTransferableAssetAmount", + "outputs": [{ "name": "transferableAssetAmount", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "ownerAddress", "type": "address" }, { "name": "assetData", "type": "bytes[]" }], + "name": "getBatchAssetProxyAllowances", + "outputs": [{ "name": "allowances", "type": "uint256[]" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "tokenAddress", "type": "address" }], + "name": "encodeERC20AssetData", + "outputs": [{ "name": "assetData", "type": "bytes" }], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "transactionData", "type": "bytes" }], + "name": "decodeZeroExTransactionData", + "outputs": [ + { "name": "functionName", "type": "string" }, + { + "components": [ + { "name": "makerAddress", "type": "address" }, + { "name": "takerAddress", "type": "address" }, + { "name": "feeRecipientAddress", "type": "address" }, + { "name": "senderAddress", "type": "address" }, + { "name": "makerAssetAmount", "type": "uint256" }, + { "name": "takerAssetAmount", "type": "uint256" }, + { "name": "makerFee", "type": "uint256" }, + { "name": "takerFee", "type": "uint256" }, + { "name": "expirationTimeSeconds", "type": "uint256" }, + { "name": "salt", "type": "uint256" }, + { "name": "makerAssetData", "type": "bytes" }, + { "name": "takerAssetData", "type": "bytes" } + ], + "name": "orders", + "type": "tuple[]" + }, + { "name": "takerAssetFillAmounts", "type": "uint256[]" }, + { "name": "signatures", "type": "bytes[]" } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "ownerAddress", "type": "address" }, { "name": "assetData", "type": "bytes" }], + "name": "getBalance", + "outputs": [{ "name": "balance", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "components": [ + { "name": "makerAddress", "type": "address" }, + { "name": "takerAddress", "type": "address" }, + { "name": "feeRecipientAddress", "type": "address" }, + { "name": "senderAddress", "type": "address" }, + { "name": "makerAssetAmount", "type": "uint256" }, + { "name": "takerAssetAmount", "type": "uint256" }, + { "name": "makerFee", "type": "uint256" }, + { "name": "takerFee", "type": "uint256" }, + { "name": "expirationTimeSeconds", "type": "uint256" }, + { "name": "salt", "type": "uint256" }, + { "name": "makerAssetData", "type": "bytes" }, + { "name": "takerAssetData", "type": "bytes" } + ], + "name": "orders", + "type": "tuple[]" + }, + { "name": "signatures", "type": "bytes[]" } + ], + "name": "getOrderRelevantStates", + "outputs": [ + { + "components": [ + { "name": "orderStatus", "type": "uint8" }, + { "name": "orderHash", "type": "bytes32" }, + { "name": "orderTakerAssetFilledAmount", "type": "uint256" } + ], + "name": "ordersInfo", + "type": "tuple[]" + }, + { "name": "fillableTakerAssetAmounts", "type": "uint256[]" }, + { "name": "isValidSignature", "type": "bool[]" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ERC20_PROXY_ID", + "outputs": [{ "name": "", "type": "bytes4" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "assetData", "type": "bytes" }], + "name": "decodeERC20AssetData", + "outputs": [ + { "name": "assetProxyId", "type": "bytes4" }, + { "name": "tokenAddress", "type": "address" } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "components": [ + { "name": "makerAddress", "type": "address" }, + { "name": "takerAddress", "type": "address" }, + { "name": "feeRecipientAddress", "type": "address" }, + { "name": "senderAddress", "type": "address" }, + { "name": "makerAssetAmount", "type": "uint256" }, + { "name": "takerAssetAmount", "type": "uint256" }, + { "name": "makerFee", "type": "uint256" }, + { "name": "takerFee", "type": "uint256" }, + { "name": "expirationTimeSeconds", "type": "uint256" }, + { "name": "salt", "type": "uint256" }, + { "name": "makerAssetData", "type": "bytes" }, + { "name": "takerAssetData", "type": "bytes" } + ], + "name": "order", + "type": "tuple" + }, + { "name": "signature", "type": "bytes" } + ], + "name": "getOrderRelevantState", + "outputs": [ + { + "components": [ + { "name": "orderStatus", "type": "uint8" }, + { "name": "orderHash", "type": "bytes32" }, + { "name": "orderTakerAssetFilledAmount", "type": "uint256" } + ], + "name": "orderInfo", + "type": "tuple" + }, + { "name": "fillableTakerAssetAmount", "type": "uint256" }, + { "name": "isValidSignature", "type": "bool" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "assetData", "type": "bytes" }], + "name": "decodeERC1155AssetData", + "outputs": [ + { "name": "assetProxyId", "type": "bytes4" }, + { "name": "tokenAddress", "type": "address" }, + { "name": "tokenIds", "type": "uint256[]" }, + { "name": "tokenValues", "type": "uint256[]" }, + { "name": "callbackData", "type": "bytes" } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "addresses", "type": "address[]" }], + "name": "getEthBalances", + "outputs": [{ "name": "", "type": "uint256[]" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ERC721_PROXY_ID", + "outputs": [{ "name": "", "type": "bytes4" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "tokenAddress", "type": "address" }, { "name": "tokenId", "type": "uint256" }], + "name": "encodeERC721AssetData", + "outputs": [{ "name": "assetData", "type": "bytes" }], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "MULTI_ASSET_PROXY_ID", + "outputs": [{ "name": "", "type": "bytes4" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "name": "tokenAddress", "type": "address" }, + { "name": "tokenIds", "type": "uint256[]" }, + { "name": "tokenValues", "type": "uint256[]" }, + { "name": "callbackData", "type": "bytes" } + ], + "name": "encodeERC1155AssetData", + "outputs": [{ "name": "assetData", "type": "bytes" }], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "tokenAddress", "type": "address" }, { "name": "tokenId", "type": "uint256" }], + "name": "getERC721TokenOwner", + "outputs": [{ "name": "ownerAddress", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "assetData", "type": "bytes" }], + "name": "decodeMultiAssetData", + "outputs": [ + { "name": "assetProxyId", "type": "bytes4" }, + { "name": "amounts", "type": "uint256[]" }, + { "name": "nestedAssetData", "type": "bytes[]" } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "ownerAddress", "type": "address" }, { "name": "assetData", "type": "bytes[]" }], + "name": "getBatchBalances", + "outputs": [{ "name": "balances", "type": "uint256[]" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "ownerAddress", "type": "address" }, { "name": "assetData", "type": "bytes" }], + "name": "getAssetProxyAllowance", + "outputs": [{ "name": "allowance", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "name": "amounts", "type": "uint256[]" }, + { "name": "nestedAssetData", "type": "bytes[]" } + ], + "name": "encodeMultiAssetData", + "outputs": [{ "name": "assetData", "type": "bytes" }], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "STATIC_CALL_PROXY_ID", + "outputs": [{ "name": "", "type": "bytes4" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "ownerAddress", "type": "address" }, { "name": "assetData", "type": "bytes[]" }], + "name": "getBatchBalancesAndAssetProxyAllowances", + "outputs": [{ "name": "balances", "type": "uint256[]" }, { "name": "allowances", "type": "uint256[]" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "name": "_exchange", "type": "address" }, { "name": "_zrxAssetData", "type": "bytes" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + } + ], + "devdoc": { + "methods": { + "decodeERC1155AssetData(bytes)": { + "details": "Decode ERC-1155 asset data from the format described in the AssetProxy contract specification.", + "params": { "assetData": "AssetProxy-compliant asset data describing an ERC-1155 set of assets." }, + "return": "The ERC-1155 AssetProxy identifier, the address of the ERC-1155 contract hosting the assets, an array of the identifiers of the assets to be traded, an array of asset amounts to be traded, and callback data. Each element of the arrays corresponds to the same-indexed element of the other array. Return values specified as `memory` are returned as pointers to locations within the memory of the input parameter `assetData`." + }, + "decodeERC20AssetData(bytes)": { + "details": "Decode ERC-20 asset data from the format described in the AssetProxy contract specification.", + "params": { "assetData": "AssetProxy-compliant asset data describing an ERC-20 asset." }, + "return": "The ERC-20 AssetProxy identifier, and the address of the ERC-20 contract hosting this asset." + }, + "decodeERC721AssetData(bytes)": { + "details": "Decode ERC-721 asset data from the format described in the AssetProxy contract specification.", + "params": { "assetData": "AssetProxy-compliant asset data describing an ERC-721 asset." }, + "return": "The ERC-721 AssetProxy identifier, the address of the ERC-721 contract hosting this asset, and the identifier of the specific asset to be traded." + }, + "decodeMultiAssetData(bytes)": { + "details": "Decode multi-asset data from the format described in the AssetProxy contract specification.", + "params": { "assetData": "AssetProxy-compliant data describing a multi-asset basket." }, + "return": "The Multi-Asset AssetProxy identifier, an array of the amounts of the assets to be traded, and an array of the AssetProxy-compliant data describing each asset to be traded. Each element of the arrays corresponds to the same-indexed element of the other array." + }, + "decodeZeroExTransactionData(bytes)": { + "details": "Decodes the call data for an Exchange contract method call.", + "params": { "transactionData": "ABI-encoded calldata for an Exchange contract method call." }, + "return": "The name of the function called, and the parameters it was given. For single-order fills and cancels, the arrays will have just one element." + }, + "encodeERC1155AssetData(address,uint256[],uint256[],bytes)": { + "details": "Encode ERC-1155 asset data into the format described in the AssetProxy contract specification.", + "params": { + "callbackData": "Data to be passed to receiving contracts when a transfer is performed.", + "tokenAddress": "The address of the ERC-1155 contract hosting the asset(s) to be traded.", + "tokenIds": "The identifiers of the specific assets to be traded.", + "tokenValues": "The amounts of each asset to be traded." + }, + "return": "AssetProxy-compliant asset data describing the set of assets." + }, + "encodeERC20AssetData(address)": { + "details": "Encode ERC-20 asset data into the format described in the AssetProxy contract specification.", + "params": { "tokenAddress": "The address of the ERC-20 contract hosting the asset to be traded." }, + "return": "AssetProxy-compliant data describing the asset." + }, + "encodeERC721AssetData(address,uint256)": { + "details": "Encode ERC-721 asset data into the format described in the AssetProxy specification.", + "params": { + "tokenAddress": "The address of the ERC-721 contract hosting the asset to be traded.", + "tokenId": "The identifier of the specific asset to be traded." + }, + "return": "AssetProxy-compliant asset data describing the asset." + }, + "encodeMultiAssetData(uint256[],bytes[])": { + "details": "Encode data for multiple assets, per the AssetProxy contract specification.", + "params": { + "amounts": "The amounts of each asset to be traded.", + "nestedAssetData": "AssetProxy-compliant data describing each asset to be traded." + }, + "return": "AssetProxy-compliant data describing the set of assets." + }, + "getAssetProxyAllowance(address,bytes)": { + "details": "Returns the number of asset(s) (described by assetData) that the corresponding AssetProxy contract is authorized to spend. When the asset data contains multiple assets (eg for Multi-Asset), the return value indicates how many complete \"baskets\" of those assets may be spent by all of the corresponding AssetProxy contracts.", + "params": { + "assetData": "Details of asset, encoded per the AssetProxy contract specification.", + "ownerAddress": "Owner of the assets specified by assetData." + }, + "return": "Number of assets (or asset baskets) that the corresponding AssetProxy is authorized to spend." + }, + "getBalance(address,bytes)": { + "details": "Returns the owner's balance of the assets(s) specified in assetData. When the asset data contains multiple assets (eg in ERC1155 or Multi-Asset), the return value indicates how many complete \"baskets\" of those assets are owned by owner.", + "params": { + "assetData": "Details of asset, encoded per the AssetProxy contract specification.", + "ownerAddress": "Owner of the assets specified by assetData." + }, + "return": "Number of assets (or asset baskets) held by owner." + }, + "getBalanceAndAssetProxyAllowance(address,bytes)": { + "details": "Calls getBalance() and getAllowance() for assetData.", + "params": { + "assetData": "Details of asset, encoded per the AssetProxy contract specification.", + "ownerAddress": "Owner of the assets specified by assetData." + }, + "return": "Number of assets (or asset baskets) held by owner, and number of assets (or asset baskets) that the corresponding AssetProxy is authorized to spend." + }, + "getBatchAssetProxyAllowances(address,bytes[])": { + "details": "Calls getAssetProxyAllowance() for each element of assetData.", + "params": { + "assetData": "Array of asset details, each encoded per the AssetProxy contract specification.", + "ownerAddress": "Owner of the assets specified by assetData." + }, + "return": "An array of asset allowances from getAllowance(), with each element corresponding to the same-indexed element in the assetData input." + }, + "getBatchBalances(address,bytes[])": { + "details": "Calls getBalance() for each element of assetData.", + "params": { + "assetData": "Array of asset details, each encoded per the AssetProxy contract specification.", + "ownerAddress": "Owner of the assets specified by assetData." + }, + "return": "Array of asset balances from getBalance(), with each element corresponding to the same-indexed element in the assetData input." + }, + "getBatchBalancesAndAssetProxyAllowances(address,bytes[])": { + "details": "Calls getBatchBalances() and getBatchAllowances() for each element of assetData.", + "params": { + "assetData": "Array of asset details, each encoded per the AssetProxy contract specification.", + "ownerAddress": "Owner of the assets specified by assetData." + }, + "return": "An array of asset balances from getBalance(), and an array of asset allowances from getAllowance(), with each element corresponding to the same-indexed element in the assetData input." + }, + "getERC721TokenOwner(address,uint256)": { + "details": "Calls `asset.ownerOf(tokenId)`, but returns a null owner instead of reverting on an unowned asset.", + "params": { + "tokenAddress": "Address of ERC721 asset.", + "tokenId": "The identifier for the specific NFT." + }, + "return": "Owner of tokenId or null address if unowned." + }, + "getEthBalances(address[])": { + "details": "Batch fetches ETH balances", + "params": { "addresses": "Array of addresses." }, + "return": "Array of ETH balances." + }, + "getOrderRelevantState((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes)": { + "details": "Fetches all order-relevant information needed to validate if the supplied order is fillable.", + "params": { + "order": "The order structure.", + "signature": "Signature provided by maker that proves the order's authenticity. `0x01` can always be provided if the signature does not need to be validated." + }, + "return": "The orderInfo (hash, status, and `takerAssetAmount` already filled for the given order), fillableTakerAssetAmount (amount of the order's `takerAssetAmount` that is fillable given all on-chain state), and isValidSignature (validity of the provided signature). NOTE: If the `takerAssetData` encodes data for multiple assets, `fillableTakerAssetAmount` will represent a \"scaled\" amount, meaning it must be multiplied by all the individual asset amounts within the `takerAssetData` to get the final amount of each asset that can be filled." + }, + "getOrderRelevantStates((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[])": { + "details": "Fetches all order-relevant information needed to validate if the supplied orders are fillable.", + "params": { + "orders": "Array of order structures.", + "signatures": "Array of signatures provided by makers that prove the authenticity of the orders. `0x01` can always be provided if a signature does not need to be validated." + }, + "return": "The ordersInfo (array of the hash, status, and `takerAssetAmount` already filled for each order), fillableTakerAssetAmounts (array of amounts for each order's `takerAssetAmount` that is fillable given all on-chain state), and isValidSignature (array containing the validity of each provided signature). NOTE: If the `takerAssetData` encodes data for multiple assets, each element of `fillableTakerAssetAmounts` will represent a \"scaled\" amount, meaning it must be multiplied by all the individual asset amounts within the `takerAssetData` to get the final amount of each asset that can be filled." + }, + "getTransferableAssetAmount(address,bytes)": { + "details": "Gets the amount of an asset transferable by the owner.", + "params": { + "assetData": "Description of tokens, per the AssetProxy contract specification.", + "ownerAddress": "Address of the owner of the asset." + }, + "return": "The amount of the asset tranferable by the owner. NOTE: If the `assetData` encodes data for multiple assets, the `transferableAssetAmount` will represent the amount of times the entire `assetData` can be transferred. To calculate the total individual transferable amounts, this scaled `transferableAmount` must be multiplied by the individual asset amounts located within the `assetData`." + } + } + }, + "evm": { + "bytecode": { + "object": "0x60806040523480156200001157600080fd5b5060405162004f8938038062004f898339810160408190526200003491620004ae565b600080546001600160a01b0319166001600160a01b0384811691909117918290556040517f60704108000000000000000000000000000000000000000000000000000000008152849284928492911690636070410890620000ba907ff47261b0000000000000000000000000000000000000000000000000000000009060040162000589565b60206040518083038186803b158015620000d357600080fd5b505afa158015620000e8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506200010e919081019062000488565b600180546001600160a01b0319166001600160a01b039283161790556000546040517f607041080000000000000000000000000000000000000000000000000000000081529116906360704108906200018c907f02571792000000000000000000000000000000000000000000000000000000009060040162000589565b60206040518083038186803b158015620001a557600080fd5b505afa158015620001ba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250620001e0919081019062000488565b600280546001600160a01b0319166001600160a01b039283161790556000546040517f607041080000000000000000000000000000000000000000000000000000000081529116906360704108906200025e907fa7cb5fb7000000000000000000000000000000000000000000000000000000009060040162000589565b60206040518083038186803b1580156200027757600080fd5b505afa1580156200028c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250620002b2919081019062000488565b600380546001600160a01b0319166001600160a01b039283161790556000546040517f6070410800000000000000000000000000000000000000000000000000000000815291169063607041089062000330907fc339d10a000000000000000000000000000000000000000000000000000000009060040162000589565b60206040518083038186803b1580156200034957600080fd5b505afa1580156200035e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525062000384919081019062000488565b600480546001600160a01b0319166001600160a01b0392909216919091179055508051620003ba906005906020840190620003c5565b5050505050620005b6565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200040857805160ff191683800117855562000438565b8280016001018555821562000438579182015b82811115620004385782518255916020019190600101906200041b565b50620004469291506200044a565b5090565b6200046791905b8082111562000446576000815560010162000451565b90565b80516001600160a01b03811681146200048257600080fd5b92915050565b6000602082840312156200049b57600080fd5b620004a783836200046a565b9392505050565b60008060408385031215620004c1578081fd5b620004cd84846200046a565b602084810151919350906001600160401b0380821115620004ec578384fd5b81860187601f820112620004fe578485fd5b80519250818311156200050f578485fd5b604051601f8401601f19168101850183811182821017156200052f578687fd5b604052838152818401850189101562000546578586fd5b8592505b838310156200056957818301850151818401860152918401916200054a565b838311156200057a57858585830101525b80955050505050509250929050565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b6149c380620005c66000396000f3fe608060405234801561001057600080fd5b50600436106101a35760003560e01c80639eadc835116100ee578063b698846311610097578063d186037f11610071578063d186037f146103ce578063d3d862d1146103e1578063d965b998146103f4578063e4e6e7da146103fc576101a3565b8063b698846314610379578063bbb2dcf614610399578063d001c5dc146103bb576101a3565b8063a6627e9f116100c8578063a6627e9f1461034b578063b37fda041461035e578063b43cffe114610366576101a3565b80639eadc8351461030c578063a0901e5114610330578063a28fe02e14610343576101a3565b80636f83188e116101505780638ee1a6421161012a5780638ee1a642146102c15780638f4ce479146102c95780638f5afa52146102ea576101a3565b80636f83188e146102695780637d7275121461028c5780637f46448d1461029f576101a3565b80632322cf76116101815780632322cf76146102095780634dfdac2014610229578063590aa87514610249576101a3565b806304a5618a146101a85780630d7b7d76146101d35780631bd0eb8f146101f4575b600080fd5b6101bb6101b6366004613ccb565b61041d565b6040516101ca939291906143d1565b60405180910390f35b6101e66101e1366004613940565b6104e3565b6040516101ca929190614892565b6101fc610505565b6040516101ca91906142d4565b61021c610217366004613940565b610529565b6040516101ca9190614889565b61023c610237366004613858565b610551565b6040516101ca9190614239565b61025c61025736600461383b565b6105d4565b6040516101ca919061446e565b61027c610277366004613ccb565b610673565b6040516101ca94939291906144cc565b61021c61029a366004613940565b6114f7565b6102b26102ad366004613a83565b611b87565b6040516101ca9392919061419d565b6101fc611cbf565b6102dc6102d7366004613ccb565b611ce3565b6040516101ca929190614301565b6102fd6102f8366004613d8b565b611d8b565b6040516101ca93929190614852565b61031f61031a366004613ccb565b612081565b6040516101ca959493929190614349565b61023c61033e3660046139b2565b612144565b6101fc6121ca565b61025c610359366004613986565b6121ee565b6101fc612290565b61025c6103743660046138a8565b6122b4565b61038c610387366004613986565b61235c565b6040516101ca91906140d0565b6103ac6103a7366004613ccb565b61247a565b6040516101ca93929190614421565b61023c6103c9366004613858565b61253f565b61021c6103dc366004613940565b6125ad565b61025c6103ef366004613c02565b612cb5565b6101fc612cd2565b61040f61040a366004613858565b612cf6565b6040516101ca92919061427a565b60008080610431848263ffffffff612d0f16565b92507fffffffff0000000000000000000000000000000000000000000000000000000083167f0257179200000000000000000000000000000000000000000000000000000000146104b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ae9061481b565b60405180910390fd5b6104c884601063ffffffff612d7a16565b91506104db84602463ffffffff612dd916565b929491935050565b6000806104f084846114f7565b91506104fc84846125ad565b90509250929050565b7fa7cb5fb70000000000000000000000000000000000000000000000000000000081565b600080600061053885856104e3565b915091506105468282612dec565b925050505b92915050565b606060008251905080604051908082528060200260200182016040528015610583578160200160208202803883390190505b50915060005b8181146105cc576105ad858583815181106105a057fe5b60200260200101516125ad565b8382815181106105b957fe5b6020908102919091010152600101610589565b505092915050565b606063f47261b060e01b826040516024016105ef91906140d0565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b6060808080600061068a868263ffffffff612d0f16565b90507fffffffff0000000000000000000000000000000000000000000000000000000081167f4ac14782000000000000000000000000000000000000000000000000000000001415610713576040518060400160405280601181526020017f626174636843616e63656c4f72646572730000000000000000000000000000008152509450610e61565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f297bb70b00000000000000000000000000000000000000000000000000000000141561079a576040518060400160405280600f81526020017f626174636846696c6c4f726465727300000000000000000000000000000000008152509450610e61565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f50dde190000000000000000000000000000000000000000000000000000000001415610821576040518060400160405280601681526020017f626174636846696c6c4f72646572734e6f5468726f77000000000000000000008152509450610e61565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f4d0ae5460000000000000000000000000000000000000000000000000000000014156108a8576040518060400160405280601581526020017f626174636846696c6c4f724b696c6c4f726465727300000000000000000000008152509450610e61565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fd46b02c300000000000000000000000000000000000000000000000000000000141561092f576040518060400160405280600b81526020017f63616e63656c4f726465720000000000000000000000000000000000000000008152509450610e61565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fb4be83d50000000000000000000000000000000000000000000000000000000014156109b6576040518060400160405280600981526020017f66696c6c4f7264657200000000000000000000000000000000000000000000008152509450610e61565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f3e228bae000000000000000000000000000000000000000000000000000000001415610a3d576040518060400160405280601081526020017f66696c6c4f726465724e6f5468726f77000000000000000000000000000000008152509450610e61565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f64a3bc15000000000000000000000000000000000000000000000000000000001415610ac4576040518060400160405280600f81526020017f66696c6c4f724b696c6c4f7264657200000000000000000000000000000000008152509450610e61565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fe5fa431b000000000000000000000000000000000000000000000000000000001415610b4b576040518060400160405280600f81526020017f6d61726b65744275794f726465727300000000000000000000000000000000008152509450610e61565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fa3e20380000000000000000000000000000000000000000000000000000000001415610bd2576040518060400160405280601681526020017f6d61726b65744275794f72646572734e6f5468726f77000000000000000000008152509450610e61565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f7e1d9808000000000000000000000000000000000000000000000000000000001415610c59576040518060400160405280601081526020017f6d61726b657453656c6c4f7264657273000000000000000000000000000000008152509450610e61565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fdd1c7d18000000000000000000000000000000000000000000000000000000001415610ce0576040518060400160405280601781526020017f6d61726b657453656c6c4f72646572734e6f5468726f770000000000000000008152509450610e61565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f3c28d861000000000000000000000000000000000000000000000000000000001415610d67576040518060400160405280600b81526020017f6d617463684f72646572730000000000000000000000000000000000000000008152509450610e61565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f4f9559b1000000000000000000000000000000000000000000000000000000001480610df857507fffffffff0000000000000000000000000000000000000000000000000000000081167fbfc8bfce00000000000000000000000000000000000000000000000000000000145b15610e2f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ae9061472a565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ae906146f3565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f4ac14782000000000000000000000000000000000000000000000000000000001415610f1e578551610ec190879060049063ffffffff612e0216565b806020019051610ed49190810190613a4e565b604080516000808252602082019092529195505b5060408051600080825260208201909252919450610f16565b6060815260200190600190039081610f015790505b5091506114ef565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f4d0ae546000000000000000000000000000000000000000000000000000000001480610faf57507fffffffff0000000000000000000000000000000000000000000000000000000081167f50dde19000000000000000000000000000000000000000000000000000000000145b80610ffb57507fffffffff0000000000000000000000000000000000000000000000000000000081167f297bb70b00000000000000000000000000000000000000000000000000000000145b156110155761100986612ec7565b919550935091506114ef565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fd46b02c30000000000000000000000000000000000000000000000000000000014156111155760408051600180825281830190925290816020015b61107c6132e9565b81526020019060019003908161107457505086519094506110a790879060049063ffffffff612e0216565b8060200190516110ba9190810190613d56565b846000815181106110c757fe5b60200260200101819052506000604051908082528060200260200182016040528015610ee8578160200160208202803883390190505060408051600080825260208201909252919450610f16565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f64a3bc150000000000000000000000000000000000000000000000000000000014806111a657507fffffffff0000000000000000000000000000000000000000000000000000000081167fb4be83d500000000000000000000000000000000000000000000000000000000145b806111f257507fffffffff0000000000000000000000000000000000000000000000000000000081167f3e228bae00000000000000000000000000000000000000000000000000000000145b156112005761100986612f03565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fe5fa431b00000000000000000000000000000000000000000000000000000000148061129157507fffffffff0000000000000000000000000000000000000000000000000000000081167fa3e2038000000000000000000000000000000000000000000000000000000000145b806112dd57507fffffffff0000000000000000000000000000000000000000000000000000000081167f7e1d980800000000000000000000000000000000000000000000000000000000145b8061132957507fffffffff0000000000000000000000000000000000000000000000000000000081167fdd1c7d1800000000000000000000000000000000000000000000000000000000145b156113375761100986612ffd565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f3c28d8610000000000000000000000000000000000000000000000000000000014156114ef576113896132e9565b6113916132e9565b6060806113ab60048b518c612e029092919063ffffffff16565b8060200190516113be9190810190613de5565b604080516002808252606082019092529498509296509094509250816020015b6113e66132e9565b8152602001906001900390816113de579050509750838860008151811061140957fe5b6020026020010181905250828860018151811061142257fe5b602090810291909101015260408051600280825260608201909252908160200160208202803883390190505096508360a001518760008151811061146257fe5b6020026020010181815250508260a001518760018151811061148057fe5b60209081029190910101526040805160028082526060820190925290816020015b60608152602001906001900390816114a157905050955081866000815181106114c657fe5b602002602001018190525080866001815181106114df57fe5b6020026020010181905250505050505b509193509193565b60008061150a838263ffffffff612d0f16565b90507fffffffff0000000000000000000000000000000000000000000000000000000081167ff47261b000000000000000000000000000000000000000000000000000000000141561168857600061156984601063ffffffff612d7a16565b905060606370a0823160e01b8660405160240161158691906140d0565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600060608373ffffffffffffffffffffffffffffffffffffffff168360405161160e91906140b4565b600060405180830381855afa9150503d8060008114611649576040519150601f19603f3d011682016040523d82523d6000602084013e61164e565b606091505b5091509150818015611661575080516020145b61166c57600061167d565b61167d81600063ffffffff612dd916565b955050505050611b80565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f02571792000000000000000000000000000000000000000000000000000000001415611735576000806116de8561041d565b92509250508573ffffffffffffffffffffffffffffffffffffffff16611704838361235c565b73ffffffffffffffffffffffffffffffffffffffff1614611726576000611729565b60015b60ff1693505050611b80565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fa7cb5fb700000000000000000000000000000000000000000000000000000000141561191f57600060608061178d86612081565b5081519296509094509250905060005b81811461191557606062fdd58e60e01b8a8684815181106117ba57fe5b60200260200101516040516024016117d3929190614177565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600060608773ffffffffffffffffffffffffffffffffffffffff168360405161185b91906140b4565b600060405180830381855afa9150503d8060008114611896576040519150601f19603f3d011682016040523d82523d6000602084013e61189b565b606091505b509150915060008280156118b0575081516020145b6118bb5760006118cc565b6118cc82600063ffffffff612dd916565b905060008786815181106118dc57fe5b602002602001015182816118ec57fe5b0490508b8110806118fb57508b155b1561190457809b505b50506001909301925061179d915050565b5050505050611b80565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fc339d10a000000000000000000000000000000000000000000000000000000001415611ab157606063a85e59e460e01b84600080600060405160240161198c9493929190614481565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090941693909317909252600454915190925060009173ffffffffffffffffffffffffffffffffffffffff1690611a369084906140b4565b600060405180830381855afa9150503d8060008114611a71576040519150601f19603f3d011682016040523d82523d6000602084013e611a76565b606091505b5050905080611a86576000611aa8565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b93505050611b80565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f94cfcdd7000000000000000000000000000000000000000000000000000000001415611b8057606080611b078561247a565b80519194509250905060005b818114611b7b576000611b3989858481518110611b2c57fe5b60200260200101516114f7565b90506000858381518110611b4957fe5b60200260200101518281611b5957fe5b04905087811080611b68575087155b15611b71578097505b5050600101611b13565b505050505b5092915050565b606080606060008551905080604051908082528060200260200182016040528015611bcc57816020015b611bb96133a2565b815260200190600190039081611bb15790505b50935080604051908082528060200260200182016040528015611bf9578160200160208202803883390190505b50925080604051908082528060200260200182016040528015611c26578160200160208202803883390190505b50915060005b818114611cb657611c63878281518110611c4257fe5b6020026020010151878381518110611c5657fe5b6020026020010151611d8b565b8751889085908110611c7157fe5b60200260200101878581518110611c8457fe5b60200260200101878681518110611c9757fe5b9315156020948502919091019093019290925291905252600101611c2c565b50509250925092565b7ff47261b00000000000000000000000000000000000000000000000000000000081565b600080611cf6838263ffffffff612d0f16565b91507fffffffff0000000000000000000000000000000000000000000000000000000082167ff47261b00000000000000000000000000000000000000000000000000000000014611d73576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ae9061481b565b611d8483601063ffffffff612d7a16565b9050915091565b611d936133a2565b600080546040517fc75e0a81000000000000000000000000000000000000000000000000000000008152829173ffffffffffffffffffffffffffffffffffffffff169063c75e0a8190611dea908890600401614876565b60606040518083038186803b158015611e0257600080fd5b505afa158015611e16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611e3a9190810190613d00565b855160005460208301516040517f93634702000000000000000000000000000000000000000000000000000000008152939650919273ffffffffffffffffffffffffffffffffffffffff90911691639363470291611e9f919085908a9060040161429f565b60206040518083038186803b158015611eb757600080fd5b505afa158015611ecb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611eef9190810190613ca9565b91506000611f0282886101400151610529565b60a088015160c08901516005805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152959650939492936060939291830182828015611fba5780601f10611f8f57610100808354040283529160200191611fba565b820191906000526020600020905b815481529060010190602001808311611f9d57829003601f168201915b505050505090506000611fdb828c610140015161307190919063ffffffff16565b15611fff57611ff885611ff28d6080015186613096565b866130d5565b905061205b565b600061200b8784610529565b90508361202857612021868d60800151876130d5565b9150612059565b6000612039878e60800151886130d5565b905060006120488387896130d5565b90506120548282612dec565b935050505b505b61207261206c858b6040015161312b565b82612dec565b97505050505050509250925092565b60008060608080612098868563ffffffff612d0f16565b94507fffffffff0000000000000000000000000000000000000000000000000000000085167fa7cb5fb70000000000000000000000000000000000000000000000000000000014612115576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ae9061481b565b505050506024828101516044840151606485015160848601519496929591820184019490820184019391010190565b6060808251604051908082528060200260200182016040528015612172578160200160208202803883390190505b50905060005b83518114611b805783818151811061218c57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16318282815181106121b757fe5b6020908102919091010152600101612178565b7f025717920000000000000000000000000000000000000000000000000000000081565b6060630257179260e01b838360405160240161220b929190614177565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b7f94cfcdd70000000000000000000000000000000000000000000000000000000081565b606063a7cb5fb760e01b858585856040516024016122d59493929190614118565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050949350505050565b60006060636352211e60e01b836040516024016123799190614889565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600060608573ffffffffffffffffffffffffffffffffffffffff168360405161240191906140b4565b600060405180830381855afa9150503d806000811461243c576040519150601f19603f3d011682016040523d82523d6000602084013e612441565b606091505b5091509150818015612454575080516020145b61245f576000612470565b61247081600c63ffffffff612d7a16565b9695505050505050565b600060608061248f848463ffffffff612d0f16565b92507fffffffff0000000000000000000000000000000000000000000000000000000083167f94cfcdd7000000000000000000000000000000000000000000000000000000001461250c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ae9061481b565b835161252290859060049063ffffffff612e0216565b8060200190516125359190810190613c4f565b9395909450915050565b606060008251905080604051908082528060200260200182016040528015612571578160200160208202803883390190505b50915060005b8181146105cc5761258e85858381518110611b2c57fe5b83828151811061259a57fe5b6020908102919091010152600101612577565b6000806125c0838263ffffffff612d0f16565b90507fffffffff0000000000000000000000000000000000000000000000000000000081167f94cfcdd700000000000000000000000000000000000000000000000000000000141561268a576060806126188561247a565b80519194509250905060005b81811461267f57600061263d898584815181106105a057fe5b9050600085838151811061264d57fe5b6020026020010151828161265d57fe5b0490508781108061266c575087155b15612675578097505b5050600101612624565b5061054b9350505050565b7fffffffff0000000000000000000000000000000000000000000000000000000081167ff47261b000000000000000000000000000000000000000000000000000000000141561273a5760006126e784601063ffffffff612d7a16565b6001546040519192506060917fdd62ed3e000000000000000000000000000000000000000000000000000000009161158691899173ffffffffffffffffffffffffffffffffffffffff16906024016140f1565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f02571792000000000000000000000000000000000000000000000000000000001415612a68576000806127908561041d565b600254604051929550909350606092507fe985e9c500000000000000000000000000000000000000000000000000000000916127e9918a9173ffffffffffffffffffffffffffffffffffffffff909116906024016140f1565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600060608473ffffffffffffffffffffffffffffffffffffffff168360405161287191906140b4565b600060405180830381855afa9150503d80600081146128ac576040519150601f19603f3d011682016040523d82523d6000602084013e6128b1565b606091505b50915091508115806128c557508051602014155b806128e157506128dc81600063ffffffff612dd916565b600114155b15612a3b57606063081812fc60e01b856040516024016129019190614889565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090508573ffffffffffffffffffffffffffffffffffffffff168160405161298591906140b4565b600060405180830381855afa9150503d80600081146129c0576040519150601f19603f3d011682016040523d82523d6000602084013e6129c5565b606091505b5090935091508280156129d9575081516020145b8015612a22575060025473ffffffffffffffffffffffffffffffffffffffff16612a0a83600c63ffffffff612d7a16565b73ffffffffffffffffffffffffffffffffffffffff16145b612a2d576000612a30565b60015b60ff16975050611915565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff96505050505050611b80565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fa7cb5fb7000000000000000000000000000000000000000000000000000000001415612c42576000612abd84612081565b5050600354604051929450606093507fe985e9c50000000000000000000000000000000000000000000000000000000092612b149250899173ffffffffffffffffffffffffffffffffffffffff16906024016140f1565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600060608373ffffffffffffffffffffffffffffffffffffffff1683604051612b9c91906140b4565b600060405180830381855afa9150503d8060008114612bd7576040519150601f19603f3d011682016040523d82523d6000602084013e612bdc565b606091505b5091509150818015612bef575080516020145b8015612c0b5750612c0781600063ffffffff612dd916565b6001145b612c1657600061167d565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff955050505050611b80565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fc339d10a000000000000000000000000000000000000000000000000000000001415611b8057507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9392505050565b60606394cfcdd760e01b838360405160240161220b92919061424c565b7fc339d10a0000000000000000000000000000000000000000000000000000000081565b606080612d03848461253f565b91506104fc8484610551565b60008160040183511015612d4f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ae906147be565b5001602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b60008160140183511015612dba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ae90614761565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b6000612de5838361316d565b9392505050565b6000818310612dfb5781612de5565b5090919050565b606081831115612e3e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ae90614583565b8351821115612e79576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ae906145ba565b8282036040519080825280601f01601f191660200182016040528015612ea6576020820181803883390190505b509050612de5612eb5826131b6565b84612ebf876131b6565b0183516131bc565b6060806060612ee36004855186612e029092919063ffffffff16565b806020019051612ef69190810190613b2b565b9196909550909350915050565b60408051600180825281830190925260609182918291816020015b612f266132e9565b815260200190600190039081612f1e5750506040805160018082528183019092529194506020808301908038833901905050604080516001808252818301909252919350816020015b6060815260200190600190039081612f6f5750508451909150612f9c90859060049063ffffffff612e0216565b806020019051612faf9190810190613e82565b85600081518110612fbc57fe5b6020026020010185600081518110612fd057fe5b6020026020010185600081518110612fe457fe5b6020908102919091010192909252919052529193909250565b6040805160018082528183019092526060918291829160208083019080388339505085519193506130399186915060049063ffffffff612e0216565b80602001905161304c9190810190613baf565b8451859060009061305957fe5b60209081029190910101919091529095929450925050565b600081518351148015612de55750508051602091820120825192909101919091201490565b600082820183811015612de5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ae906146bc565b6000808311613110576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ae90614685565b61312361311d8584613280565b846132d4565b949350505050565b600082821115613167576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ae906145f1565b50900390565b600081602001835110156131ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ae90614628565b50016020015190565b60200190565b60208110156131e6576001816020036101000a03801983511681855116808217865250505061327b565b828214156131f35761327b565b8282111561322d5760208103905080820181840181515b8285101561322557845186526020958601959094019361320a565b90525061327b565b60208103905080820181840183515b8186121561327657825182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0928301929091019061323c565b855250505b505050565b60008261328f5750600061054b565b8282028284828161329c57fe5b0414612de5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ae906146bc565b6000808284816132e057fe5b04949350505050565b604051806101800160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160608152602001606081525090565b604080516060810182526000808252602082018190529181019190915290565b803561054b8161495b565b805161054b8161495b565b600082601f8301126133e8578081fd5b81516133fb6133f6826148c7565b6148a0565b8181529150602080830190840160005b83811015613438576134238760208451890101613602565b8352602092830192919091019060010161340b565b5050505092915050565b600082601f830112613452578081fd5b81356134606133f6826148c7565b8181529150602080830190840160005b838110156134385761348887602084358901016135b4565b83526020928301929190910190600101613470565b600082601f8301126134ad578081fd5b81516134bb6133f6826148c7565b8181529150602080830190840160005b83811015613438576134e38760208451890101613748565b835260209283019291909101906001016134cb565b600082601f830112613508578081fd5b81516135166133f6826148c7565b81815291506020808301908481018184028601820187101561353757600080fd5b60005b84811015611b7b5781518452928201929082019060010161353a565b600082601f830112613566578081fd5b81356135746133f6826148c7565b81815291506020808301908481018184028601820187101561359557600080fd5b60005b84811015611b7b57813584529282019290820190600101613598565b600082601f8301126135c4578081fd5b81356135d26133f6826148e8565b91508082528360208285010111156135e957600080fd5b8060208401602084013760009082016020015292915050565b600082601f83011261361357600080fd5b81516136216133f6826148e8565b915080825283602082850101111561363857600080fd5b611b8081602084016020860161492b565b600061018080838503121561365c578182fd5b613665816148a0565b91505061367283836133c2565b815261368183602084016133c2565b602082015261369383604084016133c2565b60408201526136a583606084016133c2565b60608201526080820135608082015260a082013560a082015260c082013560c082015260e082013560e08201526101008083013581830152506101208083013581830152506101408083013567ffffffffffffffff8082111561370757600080fd5b613713868387016135b4565b8385015261016092508285013591508082111561372f57600080fd5b5061373c858286016135b4565b82840152505092915050565b600061018080838503121561375b578182fd5b613764816148a0565b91505061377183836133cd565b815261378083602084016133cd565b602082015261379283604084016133cd565b60408201526137a483606084016133cd565b60608201526080820151608082015260a082015160a082015260c082015160c082015260e082015160e08201526101008083015181830152506101208083015181830152506101408083015167ffffffffffffffff8082111561380657600080fd5b61381286838701613602565b8385015261016092508285015191508082111561382e57600080fd5b5061373c85828601613602565b60006020828403121561384d57600080fd5b8135612de58161495b565b6000806040838503121561386b57600080fd5b82356138768161495b565b9150602083013567ffffffffffffffff81111561389257600080fd5b61389e85828601613442565b9150509250929050565b600080600080608085870312156138bd578182fd5b84356138c88161495b565b9350602085013567ffffffffffffffff808211156138e4578384fd5b6138f088838901613556565b94506040870135915080821115613905578384fd5b61391188838901613556565b9350606087013591508082111561392757600080fd5b50613934878288016135b4565b91505092959194509250565b6000806040838503121561395357600080fd5b823561395e8161495b565b9150602083013567ffffffffffffffff81111561397a57600080fd5b61389e858286016135b4565b6000806040838503121561399957600080fd5b82356139a48161495b565b946020939093013593505050565b600060208083850312156139c4578182fd5b823567ffffffffffffffff8111156139da578283fd5b80840185601f8201126139eb578384fd5b803591506139fb6133f6836148c7565b8281528381019082850185850284018601891015613a17578687fd5b8693505b84841015613a42578035613a2e8161495b565b835260019390930192918501918501613a1b565b50979650505050505050565b600060208284031215613a6057600080fd5b815167ffffffffffffffff811115613a7757600080fd5b6131238482850161349d565b60008060408385031215613a95578182fd5b823567ffffffffffffffff80821115613aac578384fd5b81850186601f820112613abd578485fd5b80359250613acd6133f6846148c7565b83815260208082019190838101885b87811015613b0557613af38c848435890101613649565b85529382019390820190600101613adc565b50919750880135945050505080821115613b1e57600080fd5b5061389e85828601613442565b600080600060608486031215613b3f578081fd5b835167ffffffffffffffff80821115613b56578283fd5b613b628783880161349d565b94506020860151915080821115613b77578283fd5b613b83878388016134f8565b93506040860151915080821115613b98578283fd5b50613ba5868287016133d8565b9150509250925092565b600080600060608486031215613bc3578081fd5b835167ffffffffffffffff80821115613bda578283fd5b613be68783880161349d565b9450602086015193506040860151915080821115613b98578283fd5b60008060408385031215613c1557600080fd5b823567ffffffffffffffff80821115613c2d57600080fd5b613c3986838701613556565b93506020850135915080821115613b1e57600080fd5b60008060408385031215613c6257600080fd5b825167ffffffffffffffff80821115613c7a57600080fd5b613c86868387016134f8565b93506020850151915080821115613c9c57600080fd5b5061389e858286016133d8565b600060208284031215613cbb57600080fd5b81518015158114612de557600080fd5b600060208284031215613cdd57600080fd5b813567ffffffffffffffff811115613cf457600080fd5b613123848285016135b4565b60006060828403128015613d12578182fd5b8015613d1c578182fd5b50613d2760606148a0565b825160ff81168114613d37578283fd5b8152602083810151908201526040928301519281019290925250919050565b600060208284031215613d6857600080fd5b815167ffffffffffffffff811115613d7f57600080fd5b61312384828501613748565b60008060408385031215613d9e57600080fd5b823567ffffffffffffffff80821115613db657600080fd5b613dc286838701613649565b93506020850135915080821115613dd857600080fd5b5061389e858286016135b4565b60008060008060808587031215613dfa578182fd5b845167ffffffffffffffff80821115613e11578384fd5b613e1d88838901613748565b95506020870151915080821115613e32578384fd5b613e3e88838901613748565b94506040870151915080821115613e53578384fd5b613e5f88838901613602565b93506060870151915080821115613e7557600080fd5b5061393487828801613602565b600080600060608486031215613e96578081fd5b835167ffffffffffffffff80821115613ead578283fd5b613eb987838801613748565b9450602086015193506040860151915080821115613ed5578283fd5b50613ba586828701613602565b73ffffffffffffffffffffffffffffffffffffffff169052565b60008151808452602084018081955060208302810191506020850160005b84811015613f48578284038852613f32848351613f90565b6020988901989094509190910190600101613f1a565b50919695505050505050565b600081518084526020840193506020830160005b82811015613f86578151865260209586019590910190600101613f68565b5093949350505050565b60008151808452613fa881602086016020860161492b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b805160ff16825260208082015190830152604090810151910152565b6000610180614006848451613ee2565b60208301516140186020860182613ee2565b50604083015161402b6040860182613ee2565b50606083015161403e6060860182613ee2565b506080830151608085015260a083015160a085015260c083015160c085015260e083015160e085015261010080840151818601525061012080840151818601525061014080840151828287015261409783870182613f90565b915050610160915081840151858203838701526124708282613f90565b600082516140c681846020870161492b565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b600073ffffffffffffffffffffffffffffffffffffffff86168252608060208301526141476080830186613f54565b82810360408401526141598186613f54565b838103606085015261416b8186613f90565b98975050505050505050565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b606080825284519082018190526000906020906080840190828801845b828110156141e0576141cd848351613fda565b60609390930192908401906001016141ba565b505050838103828501526141f48187613f54565b8481036040860152855180825290830191508286019060005b8181101561422b57825115158452928401929184019160010161420d565b509198975050505050505050565b600060208252612de56020830184613f54565b60006040825261425f6040830185613f54565b82810360208401526142718185613efc565b95945050505050565b60006040825261428d6040830185613f54565b82810360208401526142718185613f54565b600084825273ffffffffffffffffffffffffffffffffffffffff84166020830152606060408301526142716060830184613f90565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000092909216825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b60007fffffffff000000000000000000000000000000000000000000000000000000008716825273ffffffffffffffffffffffffffffffffffffffff8616602083015260a060408301526143a060a0830186613f54565b82810360608401526143b28186613f54565b83810360808501526143c48186613f90565b9998505050505050505050565b7fffffffff0000000000000000000000000000000000000000000000000000000093909316835273ffffffffffffffffffffffffffffffffffffffff919091166020830152604082015260600190565b60007fffffffff00000000000000000000000000000000000000000000000000000000851682526060602083015261445c6060830185613f54565b82810360408401526124708185613efc565b600060208252612de56020830184613f90565b6000608082526144946080830187613f90565b73ffffffffffffffffffffffffffffffffffffffff958616602084015293909416604082015260ff9190911660609091015292915050565b6000608082526144df6080830187613f90565b602083820381850152818751808452828401915082838202850101838a0160005b8381101561454c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe087840301855261453a838351613ff6565b94860194925090850190600101614500565b50508681036040880152614560818a613f54565b94505050505082810360608401526145788185613efc565b979650505050505050565b6020808252601a908201527f46524f4d5f4c4553535f5448414e5f544f5f5245515549524544000000000000604082015260600190565b6020808252601c908201527f544f5f4c4553535f5448414e5f4c454e4754485f524551554952454400000000604082015260600190565b60208082526011908201527f55494e543235365f554e444552464c4f57000000000000000000000000000000604082015260600190565b60208082526026908201527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560408201527f5155495245440000000000000000000000000000000000000000000000000000606082015260800190565b60208082526010908201527f4449564953494f4e5f42595f5a45524f00000000000000000000000000000000604082015260600190565b60208082526010908201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604082015260600190565b60208082526019908201527f554e4b4e4f574e5f46554e4354494f4e5f53454c4543544f5200000000000000604082015260600190565b6020808252600d908201527f554e494d504c454d454e54454400000000000000000000000000000000000000604082015260600190565b60208082526026908201527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560408201527f5155495245440000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f475245415445525f4f525f455155414c5f544f5f345f4c454e4754485f52455160408201527f5549524544000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252600e908201527f57524f4e475f50524f58595f4944000000000000000000000000000000000000604082015260600190565b60a081016148608286613fda565b8360608301528215156080830152949350505050565b600060208252612de56020830184613ff6565b90815260200190565b918252602082015260400190565b60405181810167ffffffffffffffff811182821017156148bf57600080fd5b604052919050565b600067ffffffffffffffff8211156148de57600080fd5b5060209081020190565b600067ffffffffffffffff8211156148ff57600080fd5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b8381101561494657818101518382015260200161492e565b83811115614955576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461497d57600080fd5b5056fea365627a7a72305820b0089191876aedb7c9ca73a599fe9f1af81f739a05048f17544cc85e5cb803f86c6578706572696d656e74616cf564736f6c634300050a0040" + } + } + }, + "networks": {} +} diff --git a/packages/contract-artifacts/src/index.ts b/packages/contract-artifacts/src/index.ts index 4b41a79dcd..a1a5db3b8d 100644 --- a/packages/contract-artifacts/src/index.ts +++ b/packages/contract-artifacts/src/index.ts @@ -1,6 +1,7 @@ import * as AssetProxyOwner from '../artifacts/AssetProxyOwner.json'; import * as Coordinator from '../artifacts/Coordinator.json'; import * as CoordinatorRegistry from '../artifacts/CoordinatorRegistry.json'; +import * as DevUtils from '../artifacts/DevUtils.json'; import * as DummyERC20Token from '../artifacts/DummyERC20Token.json'; import * as DummyERC721Token from '../artifacts/DummyERC721Token.json'; import * as DutchAuction from '../artifacts/DutchAuction.json'; @@ -24,6 +25,7 @@ import * as ZRXToken from '../artifacts/ZRXToken.json'; export { AssetProxyOwner, DutchAuction, + DevUtils, DummyERC20Token, DummyERC721Token, ERC1155Proxy, diff --git a/packages/contract-artifacts/tsconfig.json b/packages/contract-artifacts/tsconfig.json index 196fa39163..7d339682c3 100644 --- a/packages/contract-artifacts/tsconfig.json +++ b/packages/contract-artifacts/tsconfig.json @@ -8,6 +8,7 @@ "include": ["./src/**/*", "./test/**/*"], "files": [ "./artifacts/AssetProxyOwner.json", + "./artifacts/DevUtils.json", "./artifacts/DutchAuction.json", "./artifacts/DummyERC20Token.json", "./artifacts/DummyERC721Token.json", diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index bf405611c5..6d0e55910b 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -34,7 +34,7 @@ "docs_test": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --out generated_docs ./src/generated-wrappers/*" }, "config": { - "abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DutchAuction|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IAssetProxy|IValidator|IWallet|MultiAssetProxy|OrderValidator|WETH9|ZRXToken|Coordinator|CoordinatorRegistry|EthBalanceChecker).json" + "abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DevUtils|DutchAuction|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IAssetProxy|IValidator|IWallet|MultiAssetProxy|OrderValidator|WETH9|ZRXToken|Coordinator|CoordinatorRegistry|EthBalanceChecker).json" }, "repository": { "type": "git", diff --git a/packages/contract-wrappers/src/generated-wrappers/dev_utils.ts b/packages/contract-wrappers/src/generated-wrappers/dev_utils.ts new file mode 100644 index 0000000000..46c8884990 --- /dev/null +++ b/packages/contract-wrappers/src/generated-wrappers/dev_utils.ts @@ -0,0 +1,3143 @@ +// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma +// tslint:disable:whitespace no-unbound-method no-trailing-whitespace +// tslint:disable:no-unused-variable +import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract'; +import { schemas } from '@0x/json-schemas'; +import { + BlockParam, + BlockParamLiteral, + CallData, + ContractAbi, + ContractArtifact, + DecodedLogArgs, + MethodAbi, + TransactionReceiptWithDecodedLogs, + TxData, + TxDataPayable, + SupportedProvider, +} from 'ethereum-types'; +import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; +import { SimpleContractArtifact } from '@0x/types'; +import { Web3Wrapper } from '@0x/web3-wrapper'; +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 +export class DevUtilsContract extends BaseContract { + /** + * Decode ERC-721 asset data from the format described in the AssetProxy contract specification. + */ + public decodeERC721AssetData = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param assetData AssetProxy-compliant asset data describing an ERC-721 + * asset. + * @returns The ERC-721 AssetProxy identifier, the address of the ERC-721 contract hosting this asset, and the identifier of the specific asset to be traded. + */ + async callAsync( + assetData: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise<[string, string, BigNumber]> { + assert.isString('assetData', assetData); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('decodeERC721AssetData(bytes)', [assetData]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('decodeERC721AssetData(bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<[string, string, BigNumber]>(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param assetData AssetProxy-compliant asset data describing an ERC-721 + * asset. + */ + getABIEncodedTransactionData(assetData: string): string { + assert.isString('assetData', assetData); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('decodeERC721AssetData(bytes)', [assetData]); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): [string, string, BigNumber] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeERC721AssetData(bytes)'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode<[string, string, BigNumber]>(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): [string, string, BigNumber] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeERC721AssetData(bytes)'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string, BigNumber]>(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Calls getBalance() and getAllowance() for assetData. + */ + public getBalanceAndAssetProxyAllowance = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param ownerAddress Owner of the assets specified by assetData. + * @param assetData Details of asset, encoded per the AssetProxy contract + * specification. + * @returns Number of assets (or asset baskets) held by owner, and number of assets (or asset baskets) that the corresponding AssetProxy is authorized to spend. + */ + async callAsync( + ownerAddress: string, + assetData: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise<[BigNumber, BigNumber]> { + assert.isString('ownerAddress', ownerAddress); + assert.isString('assetData', assetData); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('getBalanceAndAssetProxyAllowance(address,bytes)', [ + ownerAddress.toLowerCase(), + assetData, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getBalanceAndAssetProxyAllowance(address,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber]>(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param ownerAddress Owner of the assets specified by assetData. + * @param assetData Details of asset, encoded per the AssetProxy contract + * specification. + */ + getABIEncodedTransactionData(ownerAddress: string, assetData: string): string { + assert.isString('ownerAddress', ownerAddress); + assert.isString('assetData', assetData); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getBalanceAndAssetProxyAllowance(address,bytes)', + [ownerAddress.toLowerCase(), assetData], + ); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): [BigNumber, BigNumber] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getBalanceAndAssetProxyAllowance(address,bytes)'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode<[BigNumber, BigNumber]>(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): [BigNumber, BigNumber] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getBalanceAndAssetProxyAllowance(address,bytes)'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber]>(returnData); + return abiDecodedReturnData; + }, + }; + public ERC1155_PROXY_ID = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('ERC1155_PROXY_ID()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('ERC1155_PROXY_ID()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + */ + getABIEncodedTransactionData(): string { + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('ERC1155_PROXY_ID()', []); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('ERC1155_PROXY_ID()'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('ERC1155_PROXY_ID()'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Gets the amount of an asset transferable by the owner. + */ + public getTransferableAssetAmount = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param ownerAddress Address of the owner of the asset. + * @param assetData Description of tokens, per the AssetProxy contract + * specification. + * @returns The amount of the asset tranferable by the owner. NOTE: If the `assetData` encodes data for multiple assets, the `transferableAssetAmount` will represent the amount of times the entire `assetData` can be transferred. To calculate the total individual transferable amounts, this scaled `transferableAmount` must be multiplied by the individual asset amounts located within the `assetData`. + */ + async callAsync( + ownerAddress: string, + assetData: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('ownerAddress', ownerAddress); + assert.isString('assetData', assetData); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('getTransferableAssetAmount(address,bytes)', [ + ownerAddress.toLowerCase(), + assetData, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getTransferableAssetAmount(address,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param ownerAddress Address of the owner of the asset. + * @param assetData Description of tokens, per the AssetProxy contract + * specification. + */ + getABIEncodedTransactionData(ownerAddress: string, assetData: string): string { + assert.isString('ownerAddress', ownerAddress); + assert.isString('assetData', assetData); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getTransferableAssetAmount(address,bytes)', [ + ownerAddress.toLowerCase(), + assetData, + ]); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): BigNumber { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getTransferableAssetAmount(address,bytes)'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): BigNumber { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getTransferableAssetAmount(address,bytes)'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Calls getAssetProxyAllowance() for each element of assetData. + */ + public getBatchAssetProxyAllowances = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param ownerAddress Owner of the assets specified by assetData. + * @param assetData Array of asset details, each encoded per the AssetProxy + * contract specification. + * @returns An array of asset allowances from getAllowance(), with each element corresponding to the same-indexed element in the assetData input. + */ + async callAsync( + ownerAddress: string, + assetData: string[], + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('ownerAddress', ownerAddress); + assert.isArray('assetData', assetData); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('getBatchAssetProxyAllowances(address,bytes[])', [ + ownerAddress.toLowerCase(), + assetData, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getBatchAssetProxyAllowances(address,bytes[])'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param ownerAddress Owner of the assets specified by assetData. + * @param assetData Array of asset details, each encoded per the AssetProxy + * contract specification. + */ + getABIEncodedTransactionData(ownerAddress: string, assetData: string[]): string { + assert.isString('ownerAddress', ownerAddress); + assert.isArray('assetData', assetData); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getBatchAssetProxyAllowances(address,bytes[])', + [ownerAddress.toLowerCase(), assetData], + ); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): BigNumber[] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getBatchAssetProxyAllowances(address,bytes[])'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): BigNumber[] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getBatchAssetProxyAllowances(address,bytes[])'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Encode ERC-20 asset data into the format described in the AssetProxy contract specification. + */ + public encodeERC20AssetData = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param tokenAddress The address of the ERC-20 contract hosting the asset to + * be traded. + * @returns AssetProxy-compliant data describing the asset. + */ + async callAsync( + tokenAddress: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('tokenAddress', tokenAddress); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('encodeERC20AssetData(address)', [ + tokenAddress.toLowerCase(), + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('encodeERC20AssetData(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param tokenAddress The address of the ERC-20 contract hosting the asset to + * be traded. + */ + getABIEncodedTransactionData(tokenAddress: string): string { + assert.isString('tokenAddress', tokenAddress); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('encodeERC20AssetData(address)', [ + tokenAddress.toLowerCase(), + ]); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('encodeERC20AssetData(address)'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('encodeERC20AssetData(address)'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Decodes the call data for an Exchange contract method call. + */ + public decodeZeroExTransactionData = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param transactionData ABI-encoded calldata for an Exchange contract + * method call. + * @returns The name of the function called, and the parameters it was given. For single-order fills and cancels, the arrays will have just one element. + */ + async callAsync( + transactionData: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise< + [ + string, + 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; + }>, + BigNumber[], + string[] + ] + > { + assert.isString('transactionData', transactionData); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('decodeZeroExTransactionData(bytes)', [transactionData]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('decodeZeroExTransactionData(bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue< + [ + string, + 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; + }>, + BigNumber[], + string[] + ] + >(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param transactionData ABI-encoded calldata for an Exchange contract + * method call. + */ + getABIEncodedTransactionData(transactionData: string): string { + assert.isString('transactionData', transactionData); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('decodeZeroExTransactionData(bytes)', [ + transactionData, + ]); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData( + callData: string, + ): [ + string, + 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; + }>, + BigNumber[], + string[] + ] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeZeroExTransactionData(bytes)'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode< + [ + string, + 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; + }>, + BigNumber[], + string[] + ] + >(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData( + returnData: string, + ): [ + string, + 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; + }>, + BigNumber[], + string[] + ] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeZeroExTransactionData(bytes)'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue< + [ + string, + 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; + }>, + BigNumber[], + string[] + ] + >(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Returns the owner's balance of the assets(s) specified in assetData. When the asset data contains multiple assets (eg in ERC1155 or Multi-Asset), the return value indicates how many complete "baskets" of those assets are owned by owner. + */ + public getBalance = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param ownerAddress Owner of the assets specified by assetData. + * @param assetData Details of asset, encoded per the AssetProxy contract + * specification. + * @returns Number of assets (or asset baskets) held by owner. + */ + async callAsync( + ownerAddress: string, + assetData: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('ownerAddress', ownerAddress); + assert.isString('assetData', assetData); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('getBalance(address,bytes)', [ + ownerAddress.toLowerCase(), + assetData, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getBalance(address,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param ownerAddress Owner of the assets specified by assetData. + * @param assetData Details of asset, encoded per the AssetProxy contract + * specification. + */ + getABIEncodedTransactionData(ownerAddress: string, assetData: string): string { + assert.isString('ownerAddress', ownerAddress); + assert.isString('assetData', assetData); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getBalance(address,bytes)', [ + ownerAddress.toLowerCase(), + assetData, + ]); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): BigNumber { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getBalance(address,bytes)'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): BigNumber { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getBalance(address,bytes)'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Fetches all order-relevant information needed to validate if the supplied orders are fillable. + */ + public getOrderRelevantStates = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param orders Array of order structures. + * @param signatures Array of signatures provided by makers that prove the + * authenticity of the orders. `0x01` can always be provided if a signature + * does not need to be validated. + * @returns The ordersInfo (array of the hash, status, and `takerAssetAmount` already filled for each order), fillableTakerAssetAmounts (array of amounts for each order's `takerAssetAmount` that is fillable given all on-chain state), and isValidSignature (array containing the validity of each provided signature). NOTE: If the `takerAssetData` encodes data for multiple assets, each element of `fillableTakerAssetAmounts` will represent a "scaled" amount, meaning it must be multiplied by all the individual asset amounts within the `takerAssetData` to get the final amount of each asset that can be filled. + */ + 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[], + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise< + [ + Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, + BigNumber[], + boolean[] + ] + > { + assert.isArray('orders', orders); + assert.isArray('signatures', signatures); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments( + 'getOrderRelevantStates((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[])', + [orders, signatures], + ); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder( + 'getOrderRelevantStates((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[])', + ); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue< + [ + Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, + BigNumber[], + boolean[] + ] + >(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param orders Array of order structures. + * @param signatures Array of signatures provided by makers that prove the + * authenticity of the orders. `0x01` can always be provided if a signature + * does not need to be validated. + */ + 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[], + ): string { + assert.isArray('orders', orders); + assert.isArray('signatures', signatures); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getOrderRelevantStates((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[])', + [orders, signatures], + ); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData( + callData: string, + ): [ + Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, + BigNumber[], + boolean[] + ] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder( + 'getOrderRelevantStates((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[])', + ); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode< + [ + Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, + BigNumber[], + boolean[] + ] + >(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData( + returnData: string, + ): [ + Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, + BigNumber[], + boolean[] + ] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder( + 'getOrderRelevantStates((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[])', + ); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue< + [ + Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, + BigNumber[], + boolean[] + ] + >(returnData); + return abiDecodedReturnData; + }, + }; + public ERC20_PROXY_ID = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('ERC20_PROXY_ID()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('ERC20_PROXY_ID()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + */ + getABIEncodedTransactionData(): string { + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('ERC20_PROXY_ID()', []); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('ERC20_PROXY_ID()'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('ERC20_PROXY_ID()'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Decode ERC-20 asset data from the format described in the AssetProxy contract specification. + */ + public decodeERC20AssetData = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param assetData AssetProxy-compliant asset data describing an ERC-20 asset. + * @returns The ERC-20 AssetProxy identifier, and the address of the ERC-20 contract hosting this asset. + */ + async callAsync( + assetData: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise<[string, string]> { + assert.isString('assetData', assetData); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('decodeERC20AssetData(bytes)', [assetData]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('decodeERC20AssetData(bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<[string, string]>(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param assetData AssetProxy-compliant asset data describing an ERC-20 asset. + */ + getABIEncodedTransactionData(assetData: string): string { + assert.isString('assetData', assetData); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('decodeERC20AssetData(bytes)', [assetData]); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): [string, string] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeERC20AssetData(bytes)'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode<[string, string]>(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): [string, string] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeERC20AssetData(bytes)'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string]>(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Fetches all order-relevant information needed to validate if the supplied order is fillable. + */ + public getOrderRelevantState = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param order The order structure. + * @param signature Signature provided by maker that proves the order's + * authenticity. `0x01` can always be provided if the signature does not + * need to be validated. + * @returns The orderInfo (hash, status, and `takerAssetAmount` already filled for the given order), fillableTakerAssetAmount (amount of the order's `takerAssetAmount` that is fillable given all on-chain state), and isValidSignature (validity of the provided signature). NOTE: If the `takerAssetData` encodes data for multiple assets, `fillableTakerAssetAmount` will represent a "scaled" amount, meaning it must be multiplied by all the individual asset amounts within the `takerAssetData` to get the final amount of each asset that can be filled. + */ + 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; + }, + signature: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise< + [{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, BigNumber, boolean] + > { + assert.isString('signature', signature); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments( + 'getOrderRelevantState((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes)', + [order, signature], + ); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder( + 'getOrderRelevantState((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes)', + ); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue< + [{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, BigNumber, boolean] + >(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param order The order structure. + * @param signature Signature provided by maker that proves the order's + * authenticity. `0x01` can always be provided if the signature does not + * need to be validated. + */ + 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; + }, + signature: string, + ): string { + assert.isString('signature', signature); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getOrderRelevantState((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes)', + [order, signature], + ); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData( + callData: string, + ): [{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, BigNumber, boolean] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder( + 'getOrderRelevantState((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes)', + ); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode< + [{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, BigNumber, boolean] + >(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData( + returnData: string, + ): [{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, BigNumber, boolean] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder( + 'getOrderRelevantState((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes)', + ); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue< + [{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, BigNumber, boolean] + >(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Decode ERC-1155 asset data from the format described in the AssetProxy contract specification. + */ + public decodeERC1155AssetData = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param assetData AssetProxy-compliant asset data describing an ERC-1155 set + * of assets. + * @returns The ERC-1155 AssetProxy identifier, the address of the ERC-1155 contract hosting the assets, an array of the identifiers of the assets to be traded, an array of asset amounts to be traded, and callback data. Each element of the arrays corresponds to the same-indexed element of the other array. Return values specified as `memory` are returned as pointers to locations within the memory of the input parameter `assetData`. + */ + async callAsync( + assetData: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise<[string, string, BigNumber[], BigNumber[], string]> { + assert.isString('assetData', assetData); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('decodeERC1155AssetData(bytes)', [assetData]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('decodeERC1155AssetData(bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<[string, string, BigNumber[], BigNumber[], string]>( + rawCallResult, + ); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param assetData AssetProxy-compliant asset data describing an ERC-1155 set + * of assets. + */ + getABIEncodedTransactionData(assetData: string): string { + assert.isString('assetData', assetData); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('decodeERC1155AssetData(bytes)', [assetData]); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): [string, string, BigNumber[], BigNumber[], string] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeERC1155AssetData(bytes)'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode<[string, string, BigNumber[], BigNumber[], string]>( + callData, + ); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): [string, string, BigNumber[], BigNumber[], string] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeERC1155AssetData(bytes)'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue< + [string, string, BigNumber[], BigNumber[], string] + >(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Batch fetches ETH balances + */ + public getEthBalances = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param addresses Array of addresses. + * @returns Array of ETH balances. + */ + async callAsync( + addresses: string[], + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isArray('addresses', addresses); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('getEthBalances(address[])', [addresses]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param addresses Array of addresses. + */ + getABIEncodedTransactionData(addresses: string[]): string { + assert.isArray('addresses', addresses); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getEthBalances(address[])', [addresses]); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): BigNumber[] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): BigNumber[] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); + return abiDecodedReturnData; + }, + }; + public ERC721_PROXY_ID = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('ERC721_PROXY_ID()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('ERC721_PROXY_ID()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + */ + getABIEncodedTransactionData(): string { + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('ERC721_PROXY_ID()', []); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('ERC721_PROXY_ID()'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('ERC721_PROXY_ID()'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Encode ERC-721 asset data into the format described in the AssetProxy specification. + */ + public encodeERC721AssetData = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param tokenAddress The address of the ERC-721 contract hosting the asset to + * be traded. + * @param tokenId The identifier of the specific asset to be traded. + * @returns AssetProxy-compliant asset data describing the asset. + */ + async callAsync( + tokenAddress: string, + tokenId: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('tokenAddress', tokenAddress); + assert.isBigNumber('tokenId', tokenId); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('encodeERC721AssetData(address,uint256)', [ + tokenAddress.toLowerCase(), + tokenId, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('encodeERC721AssetData(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param tokenAddress The address of the ERC-721 contract hosting the asset to + * be traded. + * @param tokenId The identifier of the specific asset to be traded. + */ + getABIEncodedTransactionData(tokenAddress: string, tokenId: BigNumber): string { + assert.isString('tokenAddress', tokenAddress); + assert.isBigNumber('tokenId', tokenId); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('encodeERC721AssetData(address,uint256)', [ + tokenAddress.toLowerCase(), + tokenId, + ]); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('encodeERC721AssetData(address,uint256)'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('encodeERC721AssetData(address,uint256)'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); + return abiDecodedReturnData; + }, + }; + public MULTI_ASSET_PROXY_ID = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('MULTI_ASSET_PROXY_ID()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('MULTI_ASSET_PROXY_ID()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + */ + getABIEncodedTransactionData(): string { + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('MULTI_ASSET_PROXY_ID()', []); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('MULTI_ASSET_PROXY_ID()'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('MULTI_ASSET_PROXY_ID()'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Encode ERC-1155 asset data into the format described in the AssetProxy contract specification. + */ + public encodeERC1155AssetData = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param tokenAddress The address of the ERC-1155 contract hosting the + * asset(s) to be traded. + * @param tokenIds The identifiers of the specific assets to be traded. + * @param tokenValues The amounts of each asset to be traded. + * @param callbackData Data to be passed to receiving contracts when a transfer + * is performed. + * @returns AssetProxy-compliant asset data describing the set of assets. + */ + async callAsync( + tokenAddress: string, + tokenIds: BigNumber[], + tokenValues: BigNumber[], + callbackData: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('tokenAddress', tokenAddress); + assert.isArray('tokenIds', tokenIds); + assert.isArray('tokenValues', tokenValues); + assert.isString('callbackData', callbackData); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments( + 'encodeERC1155AssetData(address,uint256[],uint256[],bytes)', + [tokenAddress.toLowerCase(), tokenIds, tokenValues, callbackData], + ); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('encodeERC1155AssetData(address,uint256[],uint256[],bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param tokenAddress The address of the ERC-1155 contract hosting the + * asset(s) to be traded. + * @param tokenIds The identifiers of the specific assets to be traded. + * @param tokenValues The amounts of each asset to be traded. + * @param callbackData Data to be passed to receiving contracts when a transfer + * is performed. + */ + getABIEncodedTransactionData( + tokenAddress: string, + tokenIds: BigNumber[], + tokenValues: BigNumber[], + callbackData: string, + ): string { + assert.isString('tokenAddress', tokenAddress); + assert.isArray('tokenIds', tokenIds); + assert.isArray('tokenValues', tokenValues); + assert.isString('callbackData', callbackData); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'encodeERC1155AssetData(address,uint256[],uint256[],bytes)', + [tokenAddress.toLowerCase(), tokenIds, tokenValues, callbackData], + ); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('encodeERC1155AssetData(address,uint256[],uint256[],bytes)'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('encodeERC1155AssetData(address,uint256[],uint256[],bytes)'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Calls `asset.ownerOf(tokenId)`, but returns a null owner instead of reverting on an unowned asset. + */ + public getERC721TokenOwner = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param tokenAddress Address of ERC721 asset. + * @param tokenId The identifier for the specific NFT. + * @returns Owner of tokenId or null address if unowned. + */ + async callAsync( + tokenAddress: string, + tokenId: BigNumber, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('tokenAddress', tokenAddress); + assert.isBigNumber('tokenId', tokenId); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [ + tokenAddress.toLowerCase(), + tokenId, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getERC721TokenOwner(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param tokenAddress Address of ERC721 asset. + * @param tokenId The identifier for the specific NFT. + */ + getABIEncodedTransactionData(tokenAddress: string, tokenId: BigNumber): string { + assert.isString('tokenAddress', tokenAddress); + assert.isBigNumber('tokenId', tokenId); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [ + tokenAddress.toLowerCase(), + tokenId, + ]); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getERC721TokenOwner(address,uint256)'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getERC721TokenOwner(address,uint256)'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Decode multi-asset data from the format described in the AssetProxy contract specification. + */ + public decodeMultiAssetData = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param assetData AssetProxy-compliant data describing a multi-asset basket. + * @returns The Multi-Asset AssetProxy identifier, an array of the amounts of the assets to be traded, and an array of the AssetProxy-compliant data describing each asset to be traded. Each element of the arrays corresponds to the same-indexed element of the other array. + */ + async callAsync( + assetData: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise<[string, BigNumber[], string[]]> { + assert.isString('assetData', assetData); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('decodeMultiAssetData(bytes)', [assetData]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('decodeMultiAssetData(bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<[string, BigNumber[], string[]]>(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param assetData AssetProxy-compliant data describing a multi-asset basket. + */ + getABIEncodedTransactionData(assetData: string): string { + assert.isString('assetData', assetData); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('decodeMultiAssetData(bytes)', [assetData]); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): [string, BigNumber[], string[]] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeMultiAssetData(bytes)'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode<[string, BigNumber[], string[]]>(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): [string, BigNumber[], string[]] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeMultiAssetData(bytes)'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, BigNumber[], string[]]>( + returnData, + ); + return abiDecodedReturnData; + }, + }; + /** + * Calls getBalance() for each element of assetData. + */ + public getBatchBalances = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param ownerAddress Owner of the assets specified by assetData. + * @param assetData Array of asset details, each encoded per the AssetProxy + * contract specification. + * @returns Array of asset balances from getBalance(), with each element corresponding to the same-indexed element in the assetData input. + */ + async callAsync( + ownerAddress: string, + assetData: string[], + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('ownerAddress', ownerAddress); + assert.isArray('assetData', assetData); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('getBatchBalances(address,bytes[])', [ + ownerAddress.toLowerCase(), + assetData, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getBatchBalances(address,bytes[])'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param ownerAddress Owner of the assets specified by assetData. + * @param assetData Array of asset details, each encoded per the AssetProxy + * contract specification. + */ + getABIEncodedTransactionData(ownerAddress: string, assetData: string[]): string { + assert.isString('ownerAddress', ownerAddress); + assert.isArray('assetData', assetData); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getBatchBalances(address,bytes[])', [ + ownerAddress.toLowerCase(), + assetData, + ]); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): BigNumber[] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getBatchBalances(address,bytes[])'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): BigNumber[] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getBatchBalances(address,bytes[])'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Returns the number of asset(s) (described by assetData) that the corresponding AssetProxy contract is authorized to spend. When the asset data contains multiple assets (eg for Multi-Asset), the return value indicates how many complete "baskets" of those assets may be spent by all of the corresponding AssetProxy contracts. + */ + public getAssetProxyAllowance = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param ownerAddress Owner of the assets specified by assetData. + * @param assetData Details of asset, encoded per the AssetProxy contract + * specification. + * @returns Number of assets (or asset baskets) that the corresponding AssetProxy is authorized to spend. + */ + async callAsync( + ownerAddress: string, + assetData: string, + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isString('ownerAddress', ownerAddress); + assert.isString('assetData', assetData); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('getAssetProxyAllowance(address,bytes)', [ + ownerAddress.toLowerCase(), + assetData, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getAssetProxyAllowance(address,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param ownerAddress Owner of the assets specified by assetData. + * @param assetData Details of asset, encoded per the AssetProxy contract + * specification. + */ + getABIEncodedTransactionData(ownerAddress: string, assetData: string): string { + assert.isString('ownerAddress', ownerAddress); + assert.isString('assetData', assetData); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxyAllowance(address,bytes)', [ + ownerAddress.toLowerCase(), + assetData, + ]); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): BigNumber { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getAssetProxyAllowance(address,bytes)'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): BigNumber { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getAssetProxyAllowance(address,bytes)'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Encode data for multiple assets, per the AssetProxy contract specification. + */ + public encodeMultiAssetData = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param amounts The amounts of each asset to be traded. + * @param nestedAssetData AssetProxy-compliant data describing each asset to be + * traded. + * @returns AssetProxy-compliant data describing the set of assets. + */ + async callAsync( + amounts: BigNumber[], + nestedAssetData: string[], + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise { + assert.isArray('amounts', amounts); + assert.isArray('nestedAssetData', nestedAssetData); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('encodeMultiAssetData(uint256[],bytes[])', [ + amounts, + nestedAssetData, + ]); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('encodeMultiAssetData(uint256[],bytes[])'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param amounts The amounts of each asset to be traded. + * @param nestedAssetData AssetProxy-compliant data describing each asset to be + * traded. + */ + getABIEncodedTransactionData(amounts: BigNumber[], nestedAssetData: string[]): string { + assert.isArray('amounts', amounts); + assert.isArray('nestedAssetData', nestedAssetData); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('encodeMultiAssetData(uint256[],bytes[])', [ + amounts, + nestedAssetData, + ]); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('encodeMultiAssetData(uint256[],bytes[])'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('encodeMultiAssetData(uint256[],bytes[])'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); + return abiDecodedReturnData; + }, + }; + public STATIC_CALL_PROXY_ID = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + */ + async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments('STATIC_CALL_PROXY_ID()', []); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('STATIC_CALL_PROXY_ID()'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + */ + getABIEncodedTransactionData(): string { + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments('STATIC_CALL_PROXY_ID()', []); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('STATIC_CALL_PROXY_ID()'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('STATIC_CALL_PROXY_ID()'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); + return abiDecodedReturnData; + }, + }; + /** + * Calls getBatchBalances() and getBatchAllowances() for each element of assetData. + */ + public getBatchBalancesAndAssetProxyAllowances = { + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param ownerAddress Owner of the assets specified by assetData. + * @param assetData Array of asset details, each encoded per the AssetProxy + * contract specification. + * @returns An array of asset balances from getBalance(), and an array of asset allowances from getAllowance(), with each element corresponding to the same-indexed element in the assetData input. + */ + async callAsync( + ownerAddress: string, + assetData: string[], + callData: Partial = {}, + defaultBlock?: BlockParam, + ): Promise<[BigNumber[], BigNumber[]]> { + assert.isString('ownerAddress', ownerAddress); + assert.isArray('assetData', assetData); + assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (defaultBlock !== undefined) { + assert.isBlockParam('defaultBlock', defaultBlock); + } + const self = (this as any) as DevUtilsContract; + const encodedData = self._strictEncodeArguments( + 'getBatchBalancesAndAssetProxyAllowances(address,bytes[])', + [ownerAddress.toLowerCase(), assetData], + ); + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...callData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + callDataWithDefaults.from = callDataWithDefaults.from + ? callDataWithDefaults.from.toLowerCase() + : callDataWithDefaults.from; + + const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + const abiEncoder = self._lookupAbiEncoder('getBatchBalancesAndAssetProxyAllowances(address,bytes[])'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]]>(rawCallResult); + // tslint:enable boolean-naming + return result; + }, + /** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). + * @param ownerAddress Owner of the assets specified by assetData. + * @param assetData Array of asset details, each encoded per the AssetProxy + * contract specification. + */ + getABIEncodedTransactionData(ownerAddress: string, assetData: string[]): string { + assert.isString('ownerAddress', ownerAddress); + assert.isArray('assetData', assetData); + const self = (this as any) as DevUtilsContract; + const abiEncodedTransactionData = self._strictEncodeArguments( + 'getBatchBalancesAndAssetProxyAllowances(address,bytes[])', + [ownerAddress.toLowerCase(), assetData], + ); + return abiEncodedTransactionData; + }, + getABIDecodedTransactionData(callData: string): [BigNumber[], BigNumber[]] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getBatchBalancesAndAssetProxyAllowances(address,bytes[])'); + // tslint:disable boolean-naming + const abiDecodedCallData = abiEncoder.strictDecode<[BigNumber[], BigNumber[]]>(callData); + return abiDecodedCallData; + }, + getABIDecodedReturnData(returnData: string): [BigNumber[], BigNumber[]] { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getBatchBalancesAndAssetProxyAllowances(address,bytes[])'); + // tslint:disable boolean-naming + const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]]>(returnData); + return abiDecodedReturnData; + }, + }; + public static async deployFrom0xArtifactAsync( + artifact: ContractArtifact | SimpleContractArtifact, + supportedProvider: SupportedProvider, + txDefaults: Partial, + logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, + _exchange: string, + _zrxAssetData: string, + ): Promise { + assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + if (artifact.compilerOutput === undefined) { + throw new Error('Compiler output not found in the artifact file'); + } + const provider = providerUtils.standardizeOrThrow(supportedProvider); + const bytecode = artifact.compilerOutput.evm.bytecode.object; + const abi = artifact.compilerOutput.abi; + const logDecodeDependenciesAbiOnly: { [contractName: string]: ContractAbi } = {}; + if (Object.keys(logDecodeDependencies) !== undefined) { + for (const key of Object.keys(logDecodeDependencies)) { + logDecodeDependenciesAbiOnly[key] = logDecodeDependencies[key].compilerOutput.abi; + } + } + return DevUtilsContract.deployAsync( + bytecode, + abi, + provider, + txDefaults, + logDecodeDependenciesAbiOnly, + _exchange, + _zrxAssetData, + ); + } + public static async deployAsync( + bytecode: string, + abi: ContractAbi, + supportedProvider: SupportedProvider, + txDefaults: Partial, + logDecodeDependencies: { [contractName: string]: ContractAbi }, + _exchange: string, + _zrxAssetData: string, + ): Promise { + assert.isHexString('bytecode', bytecode); + assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ + schemas.addressSchema, + schemas.numberSchema, + schemas.jsNumber, + ]); + const provider = providerUtils.standardizeOrThrow(supportedProvider); + const constructorAbi = BaseContract._lookupConstructorAbi(abi); + [_exchange, _zrxAssetData] = BaseContract._formatABIDataItemList( + constructorAbi.inputs, + [_exchange, _zrxAssetData], + BaseContract._bigNumberToString, + ); + const iface = new ethers.utils.Interface(abi); + const deployInfo = iface.deployFunction; + const txData = deployInfo.encode(bytecode, [_exchange, _zrxAssetData]); + const web3Wrapper = new Web3Wrapper(provider); + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { data: txData }, + txDefaults, + web3Wrapper.estimateGasAsync.bind(web3Wrapper), + ); + const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); + logUtils.log(`transactionHash: ${txHash}`); + const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); + logUtils.log(`DevUtils successfully deployed at ${txReceipt.contractAddress}`); + const contractInstance = new DevUtilsContract( + txReceipt.contractAddress as string, + provider, + txDefaults, + logDecodeDependencies, + ); + contractInstance.constructorArgs = [_exchange, _zrxAssetData]; + return contractInstance; + } + + /** + * @returns The contract ABI + */ + public static ABI(): ContractAbi { + const abi = [ + { + constant: true, + inputs: [ + { + name: 'assetData', + type: 'bytes', + }, + ], + name: 'decodeERC721AssetData', + outputs: [ + { + name: 'assetProxyId', + type: 'bytes4', + }, + { + name: 'tokenAddress', + type: 'address', + }, + { + name: 'tokenId', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'ownerAddress', + type: 'address', + }, + { + name: 'assetData', + type: 'bytes', + }, + ], + name: 'getBalanceAndAssetProxyAllowance', + outputs: [ + { + name: 'balance', + type: 'uint256', + }, + { + name: 'allowance', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'ERC1155_PROXY_ID', + outputs: [ + { + name: '', + type: 'bytes4', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'ownerAddress', + type: 'address', + }, + { + name: 'assetData', + type: 'bytes', + }, + ], + name: 'getTransferableAssetAmount', + outputs: [ + { + name: 'transferableAssetAmount', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'ownerAddress', + type: 'address', + }, + { + name: 'assetData', + type: 'bytes[]', + }, + ], + name: 'getBatchAssetProxyAllowances', + outputs: [ + { + name: 'allowances', + type: 'uint256[]', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'tokenAddress', + type: 'address', + }, + ], + name: 'encodeERC20AssetData', + outputs: [ + { + name: 'assetData', + type: 'bytes', + }, + ], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'transactionData', + type: 'bytes', + }, + ], + name: 'decodeZeroExTransactionData', + outputs: [ + { + name: 'functionName', + type: 'string', + }, + { + name: 'orders', + type: 'tuple[]', + components: [ + { + name: 'makerAddress', + type: 'address', + }, + { + name: 'takerAddress', + type: 'address', + }, + { + name: 'feeRecipientAddress', + type: 'address', + }, + { + name: 'senderAddress', + type: 'address', + }, + { + name: 'makerAssetAmount', + type: 'uint256', + }, + { + name: 'takerAssetAmount', + type: 'uint256', + }, + { + name: 'makerFee', + type: 'uint256', + }, + { + name: 'takerFee', + type: 'uint256', + }, + { + name: 'expirationTimeSeconds', + type: 'uint256', + }, + { + name: 'salt', + type: 'uint256', + }, + { + name: 'makerAssetData', + type: 'bytes', + }, + { + name: 'takerAssetData', + type: 'bytes', + }, + ], + }, + { + name: 'takerAssetFillAmounts', + type: 'uint256[]', + }, + { + name: 'signatures', + type: 'bytes[]', + }, + ], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'ownerAddress', + type: 'address', + }, + { + name: 'assetData', + type: 'bytes', + }, + ], + name: 'getBalance', + outputs: [ + { + name: 'balance', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'orders', + type: 'tuple[]', + components: [ + { + name: 'makerAddress', + type: 'address', + }, + { + name: 'takerAddress', + type: 'address', + }, + { + name: 'feeRecipientAddress', + type: 'address', + }, + { + name: 'senderAddress', + type: 'address', + }, + { + name: 'makerAssetAmount', + type: 'uint256', + }, + { + name: 'takerAssetAmount', + type: 'uint256', + }, + { + name: 'makerFee', + type: 'uint256', + }, + { + name: 'takerFee', + type: 'uint256', + }, + { + name: 'expirationTimeSeconds', + type: 'uint256', + }, + { + name: 'salt', + type: 'uint256', + }, + { + name: 'makerAssetData', + type: 'bytes', + }, + { + name: 'takerAssetData', + type: 'bytes', + }, + ], + }, + { + name: 'signatures', + type: 'bytes[]', + }, + ], + name: 'getOrderRelevantStates', + outputs: [ + { + name: 'ordersInfo', + type: 'tuple[]', + components: [ + { + name: 'orderStatus', + type: 'uint8', + }, + { + name: 'orderHash', + type: 'bytes32', + }, + { + name: 'orderTakerAssetFilledAmount', + type: 'uint256', + }, + ], + }, + { + name: 'fillableTakerAssetAmounts', + type: 'uint256[]', + }, + { + name: 'isValidSignature', + type: 'bool[]', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'ERC20_PROXY_ID', + outputs: [ + { + name: '', + type: 'bytes4', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'assetData', + type: 'bytes', + }, + ], + name: 'decodeERC20AssetData', + outputs: [ + { + name: 'assetProxyId', + type: 'bytes4', + }, + { + name: 'tokenAddress', + type: 'address', + }, + ], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'order', + type: 'tuple', + components: [ + { + name: 'makerAddress', + type: 'address', + }, + { + name: 'takerAddress', + type: 'address', + }, + { + name: 'feeRecipientAddress', + type: 'address', + }, + { + name: 'senderAddress', + type: 'address', + }, + { + name: 'makerAssetAmount', + type: 'uint256', + }, + { + name: 'takerAssetAmount', + type: 'uint256', + }, + { + name: 'makerFee', + type: 'uint256', + }, + { + name: 'takerFee', + type: 'uint256', + }, + { + name: 'expirationTimeSeconds', + type: 'uint256', + }, + { + name: 'salt', + type: 'uint256', + }, + { + name: 'makerAssetData', + type: 'bytes', + }, + { + name: 'takerAssetData', + type: 'bytes', + }, + ], + }, + { + name: 'signature', + type: 'bytes', + }, + ], + name: 'getOrderRelevantState', + outputs: [ + { + name: 'orderInfo', + type: 'tuple', + components: [ + { + name: 'orderStatus', + type: 'uint8', + }, + { + name: 'orderHash', + type: 'bytes32', + }, + { + name: 'orderTakerAssetFilledAmount', + type: 'uint256', + }, + ], + }, + { + name: 'fillableTakerAssetAmount', + type: 'uint256', + }, + { + name: 'isValidSignature', + type: 'bool', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'assetData', + type: 'bytes', + }, + ], + name: 'decodeERC1155AssetData', + outputs: [ + { + name: 'assetProxyId', + type: 'bytes4', + }, + { + name: 'tokenAddress', + type: 'address', + }, + { + name: 'tokenIds', + type: 'uint256[]', + }, + { + name: 'tokenValues', + type: 'uint256[]', + }, + { + name: 'callbackData', + type: 'bytes', + }, + ], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'addresses', + type: 'address[]', + }, + ], + name: 'getEthBalances', + outputs: [ + { + name: '', + type: 'uint256[]', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'ERC721_PROXY_ID', + outputs: [ + { + name: '', + type: 'bytes4', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'tokenAddress', + type: 'address', + }, + { + name: 'tokenId', + type: 'uint256', + }, + ], + name: 'encodeERC721AssetData', + outputs: [ + { + name: 'assetData', + type: 'bytes', + }, + ], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'MULTI_ASSET_PROXY_ID', + outputs: [ + { + name: '', + type: 'bytes4', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'tokenAddress', + type: 'address', + }, + { + name: 'tokenIds', + type: 'uint256[]', + }, + { + name: 'tokenValues', + type: 'uint256[]', + }, + { + name: 'callbackData', + type: 'bytes', + }, + ], + name: 'encodeERC1155AssetData', + outputs: [ + { + name: 'assetData', + type: 'bytes', + }, + ], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'tokenAddress', + type: 'address', + }, + { + name: 'tokenId', + type: 'uint256', + }, + ], + name: 'getERC721TokenOwner', + outputs: [ + { + name: 'ownerAddress', + type: 'address', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'assetData', + type: 'bytes', + }, + ], + name: 'decodeMultiAssetData', + outputs: [ + { + name: 'assetProxyId', + type: 'bytes4', + }, + { + name: 'amounts', + type: 'uint256[]', + }, + { + name: 'nestedAssetData', + type: 'bytes[]', + }, + ], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'ownerAddress', + type: 'address', + }, + { + name: 'assetData', + type: 'bytes[]', + }, + ], + name: 'getBatchBalances', + outputs: [ + { + name: 'balances', + type: 'uint256[]', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'ownerAddress', + type: 'address', + }, + { + name: 'assetData', + type: 'bytes', + }, + ], + name: 'getAssetProxyAllowance', + outputs: [ + { + name: 'allowance', + type: 'uint256', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'amounts', + type: 'uint256[]', + }, + { + name: 'nestedAssetData', + type: 'bytes[]', + }, + ], + name: 'encodeMultiAssetData', + outputs: [ + { + name: 'assetData', + type: 'bytes', + }, + ], + payable: false, + stateMutability: 'pure', + type: 'function', + }, + { + constant: true, + inputs: [], + name: 'STATIC_CALL_PROXY_ID', + outputs: [ + { + name: '', + type: 'bytes4', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + constant: true, + inputs: [ + { + name: 'ownerAddress', + type: 'address', + }, + { + name: 'assetData', + type: 'bytes[]', + }, + ], + name: 'getBatchBalancesAndAssetProxyAllowances', + outputs: [ + { + name: 'balances', + type: 'uint256[]', + }, + { + name: 'allowances', + type: 'uint256[]', + }, + ], + payable: false, + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + name: '_exchange', + type: 'address', + }, + { + name: '_zrxAssetData', + type: 'bytes', + }, + ], + outputs: [], + payable: false, + stateMutability: 'nonpayable', + type: 'constructor', + }, + ] as ContractAbi; + return abi; + } + constructor( + address: string, + supportedProvider: SupportedProvider, + txDefaults?: Partial, + logDecodeDependencies?: { [contractName: string]: ContractAbi }, + ) { + super('DevUtils', DevUtilsContract.ABI(), address, supportedProvider, txDefaults, logDecodeDependencies); + classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); + } +} + +// tslint:disable:max-file-line-count +// tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align +// tslint:enable:trailing-comma whitespace no-trailing-whitespace diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index 7ab661f92f..9fbb8d0f59 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -1,4 +1,5 @@ export * from './generated-wrappers/asset_proxy_owner'; +export * from './generated-wrappers/dev_utils'; export * from './generated-wrappers/dummy_erc20_token'; export * from './generated-wrappers/dummy_erc721_token'; export * from './generated-wrappers/dutch_auction'; diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json index 25b4e94567..1c8fe94c44 100644 --- a/packages/migrations/CHANGELOG.json +++ b/packages/migrations/CHANGELOG.json @@ -1,4 +1,12 @@ [ + { + "version": "4.3.0", + "changes": [ + { + "note": "Added DevUtils" + } + ] + }, { "version": "4.2.0", "changes": [ diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts index 4ca5a3bcb3..b6ca254959 100644 --- a/packages/migrations/src/migration.ts +++ b/packages/migrations/src/migration.ts @@ -252,6 +252,16 @@ export async function runMigrationsAsync( exchange.address, ); + // Dev Utils + const devUtils = await wrappers.DevUtilsContract.deployFrom0xArtifactAsync( + artifacts.DevUtils, + provider, + txDefaults, + artifacts, + exchange.address, + zrxAssetData, + ); + const contractAddresses = { erc20Proxy: erc20Proxy.address, erc721Proxy: erc721Proxy.address, @@ -267,6 +277,7 @@ export async function runMigrationsAsync( coordinator: coordinator.address, multiAssetProxy: multiAssetProxy.address, staticCallProxy: staticCallProxy.address, + devUtils: devUtils.address, }; return contractAddresses;