From d73982819b9af2b6399f389b10a4298bee12afef Mon Sep 17 00:00:00 2001 From: Xianny <8582774+xianny@users.noreply.github.com> Date: Wed, 27 Nov 2019 17:50:24 -0800 Subject: [PATCH] Deprecate abi-gen-wrappers (#2370) * generate wrappers in @0x/contract-wrappers and delete abi-gen-wrappers * trim exports from contract-wrappers * separate contract-wrappers tests to get rid of dependency cycle * remove dummy token contracts * temporarily skip coordinator test until we can upgrade coordinator server --- .circleci/config.yml | 10 +- .github/autolabeler.yml | 1 - README.md | 3 +- contracts/README.md | 2 +- .../test/coordinator/client_test.ts | 2 +- package.json | 2 +- packages/0x.js/src/index.ts | 2 +- packages/abi-gen-wrappers/CHANGELOG.json | 405 ----- packages/abi-gen-wrappers/CHANGELOG.md | 167 -- packages/abi-gen-wrappers/README.md | 79 - packages/abi-gen-wrappers/package.json | 55 - .../coordinator_registry.ts | 400 ----- .../generated-wrappers/dummy_erc20_token.ts | 1079 ------------ .../generated-wrappers/dummy_erc721_token.ts | 1264 -------------- .../generated-wrappers/erc1155_mintable.ts | 1512 ----------------- .../src/generated-wrappers/i_validator.ts | 231 --- .../src/generated-wrappers/i_wallet.ts | 225 --- .../src/generated-wrappers/order_validator.ts | 1128 ------------ packages/abi-gen-wrappers/src/index.ts | 112 -- .../abi-gen-wrappers/typedoc-tsconfig.json | 7 - packages/asset-swapper/package.json | 2 +- .../exchange_swap_quote_consumer.ts | 2 +- .../forwarder_swap_quote_consumer.ts | 2 +- packages/asset-swapper/src/swap_quoter.ts | 2 +- .../src/utils/order_prune_utils.ts | 2 +- .../src/utils/swap_quote_consumer_utils.ts | 2 +- .../test/exchange_swap_quote_consumer_test.ts | 2 +- .../forwarder_swap_quote_consumer_test.ts | 2 +- .../test/order_prune_utils_test.ts | 2 +- .../test/swap_quote_consumer_utils_test.ts | 2 +- packages/contract-addresses/src/index.ts | 2 - packages/contract-artifacts/README.md | 9 + packages/contract-artifacts/src/index.ts | 4 - .../.npmignore | 0 .../coverage/.gitkeep | 0 packages/contract-wrappers-test/package.json | 57 + .../test/calldata_decoder_test.ts | 22 +- .../test/global_hooks.ts | 0 .../test/utils/chai_setup.ts | 0 .../test/utils/constants.ts | 0 .../test/utils/web3_wrapper.ts | 0 .../tsconfig.json | 3 +- .../tslint.json | 0 packages/contract-wrappers/CHANGELOG.json | 8 + packages/contract-wrappers/README.md | 4 + packages/contract-wrappers/package.json | 44 +- .../src/contract_wrappers.ts | 37 +- .../src/contract_wrappers_config_schema.ts | 2 +- .../src/generated-wrappers/coordinator.ts | 0 .../src/generated-wrappers/dev_utils.ts | 0 .../src/generated-wrappers/erc20_token.ts | 0 .../src/generated-wrappers/erc721_token.ts | 0 .../src/generated-wrappers/exchange.ts | 0 .../src/generated-wrappers/forwarder.ts | 0 .../src/generated-wrappers/staking.ts | 0 .../src/generated-wrappers/staking_proxy.ts | 0 .../src/generated-wrappers/weth9.ts | 0 packages/contract-wrappers/src/index.ts | 98 +- .../src/utils/contract_addresses.ts | 1 - .../test/utils/token_utils.ts | 35 - packages/migrations/package.json | 1 - packages/migrations/src/migration.ts | 2 - packages/order-utils/package.json | 2 +- packages/order-utils/src/eip712_utils.ts | 2 +- packages/order-utils/src/order_hash_utils.ts | 2 +- packages/order-utils/src/signature_utils.ts | 2 +- .../order-utils/test/signature_utils_test.ts | 2 +- tsconfig.json | 1 - yarn.lock | 556 +----- 69 files changed, 245 insertions(+), 7357 deletions(-) delete mode 100644 packages/abi-gen-wrappers/CHANGELOG.json delete mode 100644 packages/abi-gen-wrappers/CHANGELOG.md delete mode 100644 packages/abi-gen-wrappers/README.md delete mode 100644 packages/abi-gen-wrappers/package.json delete mode 100644 packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts delete mode 100644 packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts delete mode 100644 packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts delete mode 100644 packages/abi-gen-wrappers/src/generated-wrappers/erc1155_mintable.ts delete mode 100644 packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts delete mode 100644 packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts delete mode 100644 packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts delete mode 100644 packages/abi-gen-wrappers/src/index.ts delete mode 100644 packages/abi-gen-wrappers/typedoc-tsconfig.json rename packages/{abi-gen-wrappers => contract-wrappers-test}/.npmignore (100%) rename packages/{contract-wrappers => contract-wrappers-test}/coverage/.gitkeep (100%) create mode 100644 packages/contract-wrappers-test/package.json rename packages/{contract-wrappers => contract-wrappers-test}/test/calldata_decoder_test.ts (84%) rename packages/{contract-wrappers => contract-wrappers-test}/test/global_hooks.ts (100%) rename packages/{contract-wrappers => contract-wrappers-test}/test/utils/chai_setup.ts (100%) rename packages/{contract-wrappers => contract-wrappers-test}/test/utils/constants.ts (100%) rename packages/{contract-wrappers => contract-wrappers-test}/test/utils/web3_wrapper.ts (100%) rename packages/{abi-gen-wrappers => contract-wrappers-test}/tsconfig.json (60%) rename packages/{abi-gen-wrappers => contract-wrappers-test}/tslint.json (100%) rename packages/{abi-gen-wrappers => contract-wrappers}/src/generated-wrappers/coordinator.ts (100%) rename packages/{abi-gen-wrappers => contract-wrappers}/src/generated-wrappers/dev_utils.ts (100%) rename packages/{abi-gen-wrappers => contract-wrappers}/src/generated-wrappers/erc20_token.ts (100%) rename packages/{abi-gen-wrappers => contract-wrappers}/src/generated-wrappers/erc721_token.ts (100%) rename packages/{abi-gen-wrappers => contract-wrappers}/src/generated-wrappers/exchange.ts (100%) rename packages/{abi-gen-wrappers => contract-wrappers}/src/generated-wrappers/forwarder.ts (100%) rename packages/{abi-gen-wrappers => contract-wrappers}/src/generated-wrappers/staking.ts (100%) rename packages/{abi-gen-wrappers => contract-wrappers}/src/generated-wrappers/staking_proxy.ts (100%) rename packages/{abi-gen-wrappers => contract-wrappers}/src/generated-wrappers/weth9.ts (100%) delete mode 100644 packages/contract-wrappers/test/utils/token_utils.ts diff --git a/.circleci/config.yml b/.circleci/config.yml index ff299feecc..b9fec4b985 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,7 +37,7 @@ jobs: - store_artifacts: path: ~/repo/packages/abi-gen/test-cli/output - store_artifacts: - path: ~/repo/packages/abi-gen-wrappers/generated_docs + path: ~/repo/packages/contract-wrappers/generated_docs test-contracts-ganache: resource_class: medium+ docker: @@ -121,7 +121,7 @@ jobs: - run: yarn wsrun test:circleci @0x/assert - run: yarn wsrun test:circleci @0x/base-contract - run: yarn wsrun test:circleci @0x/connect - - run: yarn wsrun test:circleci @0x/contract-wrappers + - run: yarn wsrun test:circleci @0x/contract-wrappers-test - run: yarn wsrun test:circleci @0x/dev-utils - run: yarn wsrun test:circleci @0x/json-schemas - run: yarn wsrun test:circleci @0x/order-utils @@ -154,9 +154,9 @@ jobs: paths: - ~/repo/packages/connect/coverage/lcov.info - save_cache: - key: coverage-contract-wrappers-{{ .Environment.CIRCLE_SHA1 }} + key: coverage-contract-wrappers-test-{{ .Environment.CIRCLE_SHA1 }} paths: - - ~/repo/packages/contract-wrappers/coverage/lcov.info + - ~/repo/packages/contract-wrappers-test/coverage/lcov.info - save_cache: key: coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }} paths: @@ -371,7 +371,7 @@ jobs: - coverage-connect-{{ .Environment.CIRCLE_SHA1 }} - restore_cache: keys: - - coverage-contract-wrappers-{{ .Environment.CIRCLE_SHA1 }} + - coverage-contract-wrappers-test-{{ .Environment.CIRCLE_SHA1 }} - restore_cache: keys: - coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }} diff --git a/.github/autolabeler.yml b/.github/autolabeler.yml index 246088988c..c916c93ab7 100644 --- a/.github/autolabeler.yml +++ b/.github/autolabeler.yml @@ -25,7 +25,6 @@ contracts: ['contracts'] @0x/base-contract: ['packages/base-contract'] @0x/typescript-typings: ['packages/typescript-typings'] 0x.js: ['packages/0x.js'] -@0x/abi-gen-wrappers: ['packages/abi-gen-wrappers'] @0x/contract-artifacts: ['packages/contract-artifacts'] @0x/dev-utils: ['packages/dev-utils'] @0x/contract-wrappers: ['packages/contract-wrappers'] diff --git a/README.md b/README.md index eb5f950445..67578fe7fa 100644 --- a/README.md +++ b/README.md @@ -61,8 +61,7 @@ These packages are all under development. See [/contracts/README.md](/contracts/ | [`@0x/order-utils`](/packages/order-utils) | [![npm](https://img.shields.io/npm/v/@0x/order-utils.svg)](https://www.npmjs.com/package/@0x/order-utils) | A set of utilities for generating, parsing, signing and validating 0x orders | | [`@0x/json-schemas`](/packages/json-schemas) | [![npm](https://img.shields.io/npm/v/@0x/json-schemas.svg)](https://www.npmjs.com/package/@0x/json-schemas) | 0x-related JSON schemas | | | [`@0x/migrations`](/packages/migrations) | [![npm](https://img.shields.io/npm/v/@0x/migrations.svg)](https://www.npmjs.com/package/@0x/migrations) | Migration tool for deploying 0x smart contracts on private testnets | -| [`@0x/contract-artifacts`](/packages/contract-artifacts) | [![npm](https://img.shields.io/npm/v/@0x/contract-artifacts.svg)](https://www.npmjs.com/package/@0x/contract-artifacts) | 0x smart contract compilation artifacts | -| [`@0x/abi-gen-wrappers`](/packages/abi-gen-wrappers) | [![npm](https://img.shields.io/npm/v/@0x/abi-gen-wrappers.svg)](https://www.npmjs.com/package/@0x/abi-gen-wrappers) | Low-level 0x smart contract wrappers generated using `@0x/abi-gen` | +| [`@0x/contract-artifacts`](/packages/contract-artifacts) | [![npm](https://img.shields.io/npm/v/@0x/contract-artifacts.svg)](https://www.npmjs.com/package/@0x/contract-artifacts) | 0x smart contract compilation artifacts | | | [`@0x/sra-spec`](/packages/sra-spec) | [![npm](https://img.shields.io/npm/v/@0x/sra-spec.svg)](https://www.npmjs.com/package/@0x/sra-spec) | OpenAPI specification for the Standard Relayer API | | [`@0x/connect`](/packages/connect) | [![npm](https://img.shields.io/npm/v/@0x/connect.svg)](https://www.npmjs.com/package/@0x/connect) | An HTTP/WS client for interacting with the Standard Relayer API | | [`@0x/asset-swapper`](/packages/asset-swapper) | [![npm](https://img.shields.io/npm/v/@0x/asset-swapper.svg)](https://www.npmjs.com/package/@0x/asset-swapper) | Convenience package for discovering and performing swaps for any ERC20 Assets | diff --git a/contracts/README.md b/contracts/README.md index 53194f3368..4759cc7f0d 100644 --- a/contracts/README.md +++ b/contracts/README.md @@ -13,4 +13,4 @@ #### Development -Building solidity files will update the contract artifact in `{package-name}/generated-artifacts/{contract}.json`, but does not automatically update the `abi-gen-wrappers` package, which are generated from the artifact JSON. To ensure consistency, clean and rebuild `abi-gen-wrappers` after any changes to the artifact JSON. +Building solidity files will update the contract artifact in `{package-name}/generated-artifacts/{contract}.json`, but does not automatically update the `contract-artifacts` or `contract-wrappers` packages, which are generated from the artifact JSON. See `contract-artifacts/README.md` for instructions on updating these packages. diff --git a/contracts/integrations/test/coordinator/client_test.ts b/contracts/integrations/test/coordinator/client_test.ts index 162156e7ee..d9da44e900 100644 --- a/contracts/integrations/test/coordinator/client_test.ts +++ b/contracts/integrations/test/coordinator/client_test.ts @@ -19,7 +19,7 @@ const coordinatorEndpoint = 'http://localhost:'; const DEFAULT_PROTOCOL_FEE_MULTIPLIER = new BigNumber(150000); // tslint:disable:custom-no-magic-numbers -blockchainTests('Coordinator Client', env => { +blockchainTests.skip('Coordinator Client', env => { const takerTokenFillAmount = new BigNumber(0); const chainId = 1337; const assetDataEncoder = new IAssetDataContract(constants.NULL_ADDRESS, env.provider); diff --git a/package.json b/package.json index e6e13c27f2..e7b6d4dff0 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "lerna": "lerna", "build": "lerna link && wsrun build $PKG -r --stages --fast-exit --exclude-missing --exclude @0x/contracts-extensions", "build:ci": "lerna link && wsrun build:ci $PKG --fast-exit -r --stages --exclude-missing --exclude @0x/contracts-extensions", - "build:contracts": "lerna link && wsrun build -p ${npm_package_config_contractsPackages} -c --fast-exit -r --stages --exclude-missing", + "build:contracts": "lerna link && wsrun build -p ${npm_package_config_contractsPackages} -c --fast-exit -r --stages --exclude-missing --exclude @0x/contracts-extensions", "build:monorepo_scripts": "PKG=@0x/monorepo-scripts yarn build", "build:ts": "tsc -b", "watch:ts": "tsc -b -w", diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 1e385abf1f..0a7f0fd6ec 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -33,7 +33,7 @@ export { ExchangeProtocolFeeCollectorAddressEventArgs, ExchangeProtocolFeeMultiplierEventArgs, ExchangeTransactionExecutionEventArgs, -} from '@0x/abi-gen-wrappers'; +} from '@0x/contract-wrappers'; export { ContractEvent, diff --git a/packages/abi-gen-wrappers/CHANGELOG.json b/packages/abi-gen-wrappers/CHANGELOG.json deleted file mode 100644 index 6e6271abcb..0000000000 --- a/packages/abi-gen-wrappers/CHANGELOG.json +++ /dev/null @@ -1,405 +0,0 @@ -[ - { - "version": "5.4.0-beta.3", - "changes": [ - { - "note": "Re-enable gas estimation when `gas` is not provided.", - "pr": 2343 - } - ], - "timestamp": 1574238768 - }, - { - "version": "5.4.0-beta.2", - "changes": [ - { - "note": "[Breaking] Remove `erc20Proxy`, `multiAssetProxy`, `erc1155Proxy`, `staticCallProxy`, `erc721Proxy`, `assetProxyOwner`, `ZRXToken` and `dutchAuction` wrappers", - "pr": 2324 - }, - { - "note": "[Breaking] Big refactor of contract wrapper interface. See https://github.com/0xProject/0x-monorepo/pull/2325 for details", - "pr": 2325 - }, - { - "note": "Updated Coordinator + Coordinator Registry wrappers", - "pr": 2346 - } - ], - "timestamp": 1574030254 - }, - { - "version": "5.4.0-beta.1", - "changes": [ - { - "note": "Remove debug functions `getABIDecodedTransactionData` and `getABIDecodedReturnData`", - "pr": 2243 - }, - { - "note": "Remove `getABIEncodedTransactionData` for constant functions (pure and view)", - "pr": 2243 - }, - { - "note": "Introduce TxOpts object for `sendTransactionAsync` and `awaitTransactionSuccessAsync`. Replaces `timeoutMs` and `pollingIntervalMs` arguments for `awaitTransactionSuccessAsync`", - "pr": 2243 - }, - { - "note": "Remove `validateAndSendTransactionAsync`. Replaced with `shouldValidate` key in TxOpts. Defaults to true", - "pr": 2243 - } - ], - "timestamp": 1573159180 - }, - { - "version": "5.4.0-beta.0", - "changes": [ - { - "note": "Use V3 contracts", - "pr": 2181 - }, - { - "note": "Hardcode bytecode for local EVM execution", - "pr": 2198 - } - ], - "timestamp": 1570135330 - }, - { - "version": "5.3.2", - "changes": [ - { - "note": "Redirect `callAsync` to use local EVM instead of eth_call for pure functions", - "pr": 2108 - } - ], - "timestamp": 1568744790 - }, - { - "timestamp": 1567521715, - "version": "5.3.1", - "changes": [ - { - "note": "Dependencies updated" - } - ] - }, - { - "version": "5.3.0", - "changes": [ - { - "note": "Added DevUtils", - "pr": 2060 - } - ], - "timestamp": 1566446343 - }, - { - "version": "5.2.0", - "changes": [ - { - "note": "Updated to include `getABIDecodedTransactionData` and `getABIDecodedReturnData`", - "pr": 2018 - } - ], - "timestamp": 1565296576 - }, - { - "version": "5.1.0", - "changes": [ - { - "note": "Add subscribe/unsubscribe methods for events", - "pr": 1970 - } - ], - "timestamp": 1564604963 - }, - { - "timestamp": 1563957393, - "version": "5.0.3", - "changes": [ - { - "note": "Dependencies updated" - } - ] - }, - { - "timestamp": 1563193019, - "version": "5.0.2", - "changes": [ - { - "note": "Dependencies updated" - } - ] - }, - { - "timestamp": 1563047529, - "version": "5.0.1", - "changes": [ - { - "note": "Dependencies updated" - } - ] - }, - { - "version": "5.0.0", - "changes": [ - { - "note": "Wrappers no longer require passing in the contract ABI at instantiation", - "pr": 1883 - }, - { - "note": "Contract addresses now re-exported from @0x/contract-addresses", - "pr": 1883 - }, - { - "note": "Update wrappers to include parameter assertions", - "pr": 1823 - }, - { - "note": "Update wrappers to normalize address inputs to lowercase", - "pr": 1951 - }, - { - "note": "Update wrappers to include `getABIEncodedTransactionData` for view and pure functions", - "pr": 1863 - } - ], - "timestamp": 1563006338 - }, - { - "version": "4.3.0", - "changes": [ - { - "note": "Update Coordinator and Exchange wrappers", - "pr": 1742 - }, - { - "note": "Update wrapper functions to expose `awaitTransactionSuccessAsync()` methods", - "pr": 1797 - }, - { - "note": "Update wrappers to automatically throw `RevertError` types when possible.", - "pr": 1819 - } - ], - "timestamp": 1557507213 - }, - { - "version": "4.2.0", - "changes": [ - { - "note": "Added IAssetProxy wrapper", - "pr": 1714 - } - ], - "timestamp": 1554997931 - }, - { - "version": "4.1.0", - "changes": [ - { - "note": "Add Coordinator and CoordinatorRegistry contract wrappers", - "pr": 1689 - } - ], - "timestamp": 1553183790 - }, - { - "timestamp": 1553091633, - "version": "4.0.3", - "changes": [ - { - "note": "Dependencies updated" - } - ] - }, - { - "timestamp": 1551479279, - "version": "4.0.2", - "changes": [ - { - "note": "Dependencies updated" - } - ] - }, - { - "timestamp": 1551220833, - "version": "4.0.1", - "changes": [ - { - "note": "Dependencies updated" - } - ] - }, - { - "version": "4.0.0", - "changes": [ - { - "note": "Add support for EIP1193 providers & Web3.js providers >= 1.0-beta.38", - "pr": 1627 - }, - { - "note": "Update provider params to type SupportedProvider which outlines all supported providers", - "pr": 1627 - } - ], - "timestamp": 1551130135 - }, - { - "timestamp": 1549733923, - "version": "3.0.3", - "changes": [ - { - "note": "Dependencies updated" - } - ] - }, - { - "version": "3.0.2", - "changes": [ - { - "note": "Dependencies updated" - } - ], - "timestamp": 1549547375 - }, - { - "timestamp": 1549452781, - "version": "3.0.1", - "changes": [ - { - "note": "Dependencies updated" - } - ] - }, - { - "version": "3.0.0", - "changes": [ - { - "note": "Upgrade the bignumber.js to v8.0.2", - "pr": 1517 - } - ], - "timestamp": 1549373905 - }, - { - "version": "2.2.0", - "changes": [ - { - "note": "Added `MultiAssetProxy`", - "pr": 1503 - } - ], - "timestamp": 1547561734 - }, - { - "timestamp": 1547225310, - "version": "2.1.1", - "changes": [ - { - "note": "Dependencies updated" - } - ] - }, - { - "version": "2.1.0", - "changes": [ - { - "note": "Added Dutch Auction Wrapper", - "pr": 1465 - } - ], - "timestamp": 1547040760 - }, - { - "version": "2.0.2", - "changes": [ - { - "note": "Dependencies updated" - } - ], - "timestamp": 1544739608 - }, - { - "version": "2.0.1", - "changes": [ - { - "note": "Dependencies updated" - } - ], - "timestamp": 1544570656 - }, - { - "version": "2.0.0", - "changes": [ - { - "pr": 1309, - "note": "Update Exchange artifact to receive ZRX asset data as a constructor argument" - } - ], - "timestamp": 1543401373 - }, - { - "version": "1.1.0", - "changes": [ - { - "note": "`deployFrom0xArtifactAsync` additionally accepts artifacts that conform to the `SimpleContractArtifact` interface", - "pr": 1298 - } - ], - "timestamp": 1542821676 - }, - { - "timestamp": 1542208198, - "version": "1.0.5", - "changes": [ - { - "note": "Dependencies updated" - } - ] - }, - { - "timestamp": 1542134075, - "version": "1.0.4", - "changes": [ - { - "note": "Dependencies updated" - } - ] - }, - { - "timestamp": 1542028948, - "version": "1.0.3", - "changes": [ - { - "note": "Dependencies updated" - } - ] - }, - { - "version": "1.0.2", - "changes": [ - { - "note": "Dependencies updated" - } - ], - "timestamp": 1541740904 - }, - { - "timestamp": 1539871071, - "version": "1.0.1", - "changes": [ - { - "note": "Dependencies updated" - } - ] - }, - { - "version": "1.0.0", - "changes": [ - { - "pr": 1105, - "note": "Initial release" - } - ] - } -] diff --git a/packages/abi-gen-wrappers/CHANGELOG.md b/packages/abi-gen-wrappers/CHANGELOG.md deleted file mode 100644 index 9fa7449117..0000000000 --- a/packages/abi-gen-wrappers/CHANGELOG.md +++ /dev/null @@ -1,167 +0,0 @@ - - -CHANGELOG - -## v5.4.0-beta.3 - _November 20, 2019_ - - * Re-enable gas estimation when `gas` is not provided. (#2343) - -## v5.4.0-beta.2 - _November 17, 2019_ - - * [Breaking] Remove `erc20Proxy`, `multiAssetProxy`, `erc1155Proxy`, `staticCallProxy`, `erc721Proxy`, `assetProxyOwner`, `ZRXToken` and `dutchAuction` wrappers (#2324) - * [Breaking] Big refactor of contract wrapper interface. See https://github.com/0xProject/0x-monorepo/pull/2325 for details (#2325) - * Updated Coordinator + Coordinator Registry wrappers (#2346) - -## v5.4.0-beta.1 - _November 7, 2019_ - - * Remove debug functions `getABIDecodedTransactionData` and `getABIDecodedReturnData` (#2243) - * Remove `getABIEncodedTransactionData` for constant functions (pure and view) (#2243) - * Introduce TxOpts object for `sendTransactionAsync` and `awaitTransactionSuccessAsync`. Replaces `timeoutMs` and `pollingIntervalMs` arguments for `awaitTransactionSuccessAsync` (#2243) - * Remove `validateAndSendTransactionAsync`. Replaced with `shouldValidate` key in TxOpts. Defaults to true (#2243) - -## v5.4.0-beta.0 - _October 3, 2019_ - - * Use V3 contracts (#2181) - * Hardcode bytecode for local EVM execution (#2198) - -## v5.3.2 - _September 17, 2019_ - - * Redirect `callAsync` to use local EVM instead of eth_call for pure functions (#2108) - -## v5.3.1 - _September 3, 2019_ - - * Dependencies updated - -## v5.3.0 - _August 22, 2019_ - - * Added DevUtils (#2060) - -## v5.2.0 - _August 8, 2019_ - - * Updated to include `getABIDecodedTransactionData` and `getABIDecodedReturnData` (#2018) - -## v5.1.0 - _July 31, 2019_ - - * Add subscribe/unsubscribe methods for events (#1970) - -## v5.0.3 - _July 24, 2019_ - - * Dependencies updated - -## v5.0.2 - _July 15, 2019_ - - * Dependencies updated - -## v5.0.1 - _July 13, 2019_ - - * Dependencies updated - -## v5.0.0 - _July 13, 2019_ - - * Wrappers no longer require passing in the contract ABI at instantiation (#1883) - * Contract addresses now re-exported from @0x/contract-addresses (#1883) - * Update wrappers to include parameter assertions (#1823) - * Update wrappers to normalize address inputs to lowercase (#1951) - * Update wrappers to include `getABIEncodedTransactionData` for view and pure functions (#1863) - -## v4.3.0 - _May 10, 2019_ - - * Update Coordinator and Exchange wrappers (#1742) - * Update wrapper functions to expose `awaitTransactionSuccessAsync()` methods (#1797) - * Update wrappers to automatically throw `RevertError` types when possible. (#1819) - -## v4.2.0 - _April 11, 2019_ - - * Added IAssetProxy wrapper (#1714) - -## v4.1.0 - _March 21, 2019_ - - * Add Coordinator and CoordinatorRegistry contract wrappers (#1689) - -## v4.0.3 - _March 20, 2019_ - - * Dependencies updated - -## v4.0.2 - _March 1, 2019_ - - * Dependencies updated - -## v4.0.1 - _February 26, 2019_ - - * Dependencies updated - -## v4.0.0 - _February 25, 2019_ - - * Add support for EIP1193 providers & Web3.js providers >= 1.0-beta.38 (#1627) - * Update provider params to type SupportedProvider which outlines all supported providers (#1627) - -## v3.0.3 - _February 9, 2019_ - - * Dependencies updated - -## v3.0.2 - _February 7, 2019_ - - * Dependencies updated - -## v3.0.1 - _February 6, 2019_ - - * Dependencies updated - -## v3.0.0 - _February 5, 2019_ - - * Upgrade the bignumber.js to v8.0.2 (#1517) - -## v2.2.0 - _January 15, 2019_ - - * Added `MultiAssetProxy` (#1503) - -## v2.1.1 - _January 11, 2019_ - - * Dependencies updated - -## v2.1.0 - _January 9, 2019_ - - * Added Dutch Auction Wrapper (#1465) - -## v2.0.2 - _December 13, 2018_ - - * Dependencies updated - -## v2.0.1 - _December 11, 2018_ - - * Dependencies updated - -## v2.0.0 - _November 28, 2018_ - - * Update Exchange artifact to receive ZRX asset data as a constructor argument (#1309) - -## v1.1.0 - _November 21, 2018_ - - * `deployFrom0xArtifactAsync` additionally accepts artifacts that conform to the `SimpleContractArtifact` interface (#1298) - -## v1.0.5 - _November 14, 2018_ - - * Dependencies updated - -## v1.0.4 - _November 13, 2018_ - - * Dependencies updated - -## v1.0.3 - _November 12, 2018_ - - * Dependencies updated - -## v1.0.2 - _November 9, 2018_ - - * Dependencies updated - -## v1.0.1 - _October 18, 2018_ - - * Dependencies updated - -## v1.0.0 - _Invalid date_ - - * Initial release (#1105) diff --git a/packages/abi-gen-wrappers/README.md b/packages/abi-gen-wrappers/README.md deleted file mode 100644 index c48ef6cab4..0000000000 --- a/packages/abi-gen-wrappers/README.md +++ /dev/null @@ -1,79 +0,0 @@ -## @0x/abi-gen-wrappers - -Low-level 0x smart contract wrappers generated using @0x/abi-gen. These -low-level wrappers are imported by other packages in the 0x monorepo and -application developers are not expected to import this package directly. - -You may also be interested in the -[@0x/contract-wrappers](../contract-wrappers/README.md) package which -includes some higher-level features. - -## Installation - -```bash -yarn add @0x/abi-gen-wrappers -``` - -**Import** - -```typescript -import * as wrappers from '@0x/abi-gen-wrappers'; -``` - -or - -```javascript -var wrappers = require('@0x/abi-gen-wrappers'); -``` - -## Contributing - -We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository. - -Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started. - -### Install dependencies - -If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them: - -```bash -yarn config set workspaces-experimental true -``` - -Then install dependencies - -```bash -yarn install -``` - -### Build - -To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory: - -```bash -PKG=@0x/abi-gen-wrappers yarn build -``` - -### Clean - -```bash -yarn clean -``` - -### Lint - -```bash -yarn lint -``` - -### Run Tests - -```bash -yarn test -``` - -### Documentation - -Documentation for this package is generated by TypeDoc, using the Solidity source code for 0x contracts. Each contract corresponds to one global-level module, which contains relevant enums and interfaces for its events and structs. Most significantly, each module exports a class, `Contract`, e.g. `ExchangeContract`, which implements helper methods for all the functions defined in the corresponding contract. - -A convention to note is that these contract-specific helper methods are defined as _object literals_, which are separated from methods in the generated documentation. Each contract method has a number of sub-methods, e.g. `sendTransactionAsync`, or `estimateGasAsync`, which are documented separately. This is an example of an expected method call signature: `exchangeContractInstance.fillOrder.sendTransactionAsync(...arguments)`. diff --git a/packages/abi-gen-wrappers/package.json b/packages/abi-gen-wrappers/package.json deleted file mode 100644 index 6dc13249e7..0000000000 --- a/packages/abi-gen-wrappers/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "@0x/abi-gen-wrappers", - "version": "5.4.0-beta.3", - "engines": { - "node": ">=6.12" - }, - "description": "Low-level 0x smart contract wrappers generated using @0x/abi-gen", - "main": "lib/src/index.js", - "directories": { - "test": "test" - }, - "scripts": { - "build": "yarn pre_build && tsc -b", - "build:ci": "yarn build", - "lint": "tslint --format stylish --project .", - "fix": "tslint --fix --format stylish --project .", - "pre_build": "yarn generate_contract_wrappers && yarn prettier_contract_wrappers", - "prettier": "prettier --write src/**/* --config ../../.prettierrc", - "prettier_contract_wrappers": "prettier --write src/generated-wrappers/* --config ../../.prettierrc", - "clean": "shx rm -rf lib src/generated-wrappers", - "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output src/generated-wrappers --backend ethers" - }, - "config": { - "abis": "../contract-artifacts/artifacts/@(DevUtils|DummyERC20Token|DummyERC721Token|ERC1155Mintable|ERC20Token|ERC721Token|Exchange|Forwarder|IValidator|IWallet|OrderValidator|WETH9|Coordinator|CoordinatorRegistry|Staking|StakingProxy).json" - }, - "repository": { - "type": "git", - "url": "https://github.com/0xProject/0x-monorepo.git" - }, - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/0xProject/0x-monorepo/issues" - }, - "homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen-wrappers/README.md", - "devDependencies": { - "@0x/abi-gen": "^4.4.0-beta.3", - "@0x/contract-artifacts": "^2.3.0-beta.3", - "@0x/tslint-config": "^3.1.0-beta.2", - "shx": "^0.2.2" - }, - "dependencies": { - "@0x/assert": "^2.2.0-beta.2", - "@0x/base-contract": "^5.5.0-beta.3", - "@0x/contract-addresses": "^3.3.0-beta.4", - "@0x/json-schemas": "^4.1.0-beta.2", - "@0x/types": "^2.5.0-beta.2", - "@0x/utils": "^4.6.0-beta.2", - "@0x/web3-wrapper": "^6.1.0-beta.2", - "ethereum-types": "^2.2.0-beta.2", - "ethers": "~4.0.4" - }, - "publishConfig": { - "access": "public" - } -} diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts deleted file mode 100644 index 5508fd531b..0000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts +++ /dev/null @@ -1,400 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma enum-naming -// tslint:disable:whitespace no-unbound-method no-trailing-whitespace -// tslint:disable:no-unused-variable -import { - AwaitTransactionSuccessOpts, - ContractFunctionObj, - ContractTxFunctionObj, - SendTransactionOpts, - BaseContract, - SubscriptionManager, - PromiseWithTransactionHash, - methodAbiToFunctionSignature, -} from '@0x/base-contract'; -import { schemas } from '@0x/json-schemas'; -import { - BlockParam, - BlockParamLiteral, - BlockRange, - CallData, - ContractAbi, - ContractArtifact, - DecodedLogArgs, - LogWithDecodedArgs, - MethodAbi, - TransactionReceiptWithDecodedLogs, - TxData, - TxDataPayable, - SupportedProvider, -} from 'ethereum-types'; -import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { EventCallback, IndexedFilterValues, 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 - -export type CoordinatorRegistryEventArgs = CoordinatorRegistryCoordinatorEndpointSetEventArgs; - -export enum CoordinatorRegistryEvents { - CoordinatorEndpointSet = 'CoordinatorEndpointSet', -} - -export interface CoordinatorRegistryCoordinatorEndpointSetEventArgs extends DecodedLogArgs { - coordinatorOperator: string; - coordinatorEndpoint: string; -} - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class CoordinatorRegistryContract extends BaseContract { - /** - * @ignore - */ - public static deployedBytecode: string | undefined; - private readonly _methodABIIndex: { [name: string]: number } = {}; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - ): 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 CoordinatorRegistryContract.deployAsync( - bytecode, - abi, - provider, - txDefaults, - logDecodeDependenciesAbiOnly, - ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractAbi }, - ): 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); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); - const iface = new ethers.utils.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToContractTxDataAsync( - { - 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(`CoordinatorRegistry successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new CoordinatorRegistryContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = []; - return contractInstance; - } - - /** - * @returns The contract ABI - */ - public static ABI(): ContractAbi { - const abi = [ - { - inputs: [], - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [ - { - name: 'coordinatorOperator', - type: 'address', - indexed: false, - }, - { - name: 'coordinatorEndpoint', - type: 'string', - indexed: false, - }, - ], - name: 'CoordinatorEndpointSet', - outputs: [], - type: 'event', - }, - { - constant: true, - inputs: [ - { - name: 'coordinatorOperator', - type: 'address', - }, - ], - name: 'getCoordinatorEndpoint', - outputs: [ - { - name: 'coordinatorEndpoint', - type: 'string', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'coordinatorEndpoint', - type: 'string', - }, - ], - name: 'setCoordinatorEndpoint', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - ] as ContractAbi; - return abi; - } - - public getFunctionSignature(methodName: string): string { - const index = this._methodABIIndex[methodName]; - const methodAbi = CoordinatorRegistryContract.ABI()[index] as MethodAbi; // tslint:disable-line:no-unnecessary-type-assertion - const functionSignature = methodAbiToFunctionSignature(methodAbi); - return functionSignature; - } - public getABIDecodedTransactionData(methodName: string, callData: string): T { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as CoordinatorRegistryContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - } - public getABIDecodedReturnData(methodName: string, callData: string): T { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as CoordinatorRegistryContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - const abiDecodedCallData = abiEncoder.strictDecodeReturnValue(callData); - return abiDecodedCallData; - } - public getSelector(methodName: string): string { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as CoordinatorRegistryContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.getSelector(); - } - - /** - * Gets the endpoint for a Coordinator. - * @param coordinatorOperator Operator of the Coordinator endpoint. - * @returns coordinatorEndpoint Endpoint of the Coordinator as a string. - */ - public getCoordinatorEndpoint(coordinatorOperator: string): ContractFunctionObj { - const self = (this as any) as CoordinatorRegistryContract; - assert.isString('coordinatorOperator', coordinatorOperator); - const functionSignature = 'getCoordinatorEndpoint(address)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [coordinatorOperator.toLowerCase()]); - }, - }; - } - /** - * Called by a Coordinator operator to set the endpoint of their Coordinator. - * @param coordinatorEndpoint Endpoint of the Coordinator as a string. - */ - public setCoordinatorEndpoint(coordinatorEndpoint: string): ContractTxFunctionObj { - const self = (this as any) as CoordinatorRegistryContract; - assert.isString('coordinatorEndpoint', coordinatorEndpoint); - const functionSignature = 'setCoordinatorEndpoint(string)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [coordinatorEndpoint]); - }, - }; - } - - /** - * Subscribe to an event type emitted by the CoordinatorRegistry contract. - * @param eventName The CoordinatorRegistry contract event you would like to subscribe to. - * @param indexFilterValues An object where the keys are indexed args returned by the event and - * the value is the value you are interested in. E.g `{maker: aUserAddressHex}` - * @param callback Callback that gets called when a log is added/removed - * @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered) - * @return Subscription token used later to unsubscribe - */ - public subscribe( - eventName: CoordinatorRegistryEvents, - indexFilterValues: IndexedFilterValues, - callback: EventCallback, - isVerbose: boolean = false, - blockPollingIntervalMs?: number, - ): string { - assert.doesBelongToStringEnum('eventName', eventName, CoordinatorRegistryEvents); - assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); - assert.isFunction('callback', callback); - const subscriptionToken = this._subscriptionManager.subscribe( - this.address, - eventName, - indexFilterValues, - CoordinatorRegistryContract.ABI(), - callback, - isVerbose, - blockPollingIntervalMs, - ); - return subscriptionToken; - } - /** - * Cancel a subscription - * @param subscriptionToken Subscription token returned by `subscribe()` - */ - public unsubscribe(subscriptionToken: string): void { - this._subscriptionManager.unsubscribe(subscriptionToken); - } - /** - * Cancels all existing subscriptions - */ - public unsubscribeAll(): void { - this._subscriptionManager.unsubscribeAll(); - } - /** - * Gets historical logs without creating a subscription - * @param eventName The CoordinatorRegistry contract event you would like to subscribe to. - * @param blockRange Block range to get logs from. - * @param indexFilterValues An object where the keys are indexed args returned by the event and - * the value is the value you are interested in. E.g `{_from: aUserAddressHex}` - * @return Array of logs that match the parameters - */ - public async getLogsAsync( - eventName: CoordinatorRegistryEvents, - blockRange: BlockRange, - indexFilterValues: IndexedFilterValues, - ): Promise>> { - assert.doesBelongToStringEnum('eventName', eventName, CoordinatorRegistryEvents); - assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema); - assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); - const logs = await this._subscriptionManager.getLogsAsync( - this.address, - eventName, - blockRange, - indexFilterValues, - CoordinatorRegistryContract.ABI(), - ); - return logs; - } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - deployedBytecode: string | undefined = CoordinatorRegistryContract.deployedBytecode, - ) { - super( - 'CoordinatorRegistry', - CoordinatorRegistryContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - deployedBytecode, - ); - classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); - this._subscriptionManager = new SubscriptionManager( - CoordinatorRegistryContract.ABI(), - this._web3Wrapper, - ); - CoordinatorRegistryContract.ABI().forEach((item, index) => { - if (item.type === 'function') { - const methodAbi = item as MethodAbi; - this._methodABIIndex[methodAbi.name] = index; - } - }); - } -} - -// 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/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts deleted file mode 100644 index e2ad6f1302..0000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts +++ /dev/null @@ -1,1079 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma enum-naming -// tslint:disable:whitespace no-unbound-method no-trailing-whitespace -// tslint:disable:no-unused-variable -import { - AwaitTransactionSuccessOpts, - ContractFunctionObj, - ContractTxFunctionObj, - SendTransactionOpts, - BaseContract, - SubscriptionManager, - PromiseWithTransactionHash, - methodAbiToFunctionSignature, -} from '@0x/base-contract'; -import { schemas } from '@0x/json-schemas'; -import { - BlockParam, - BlockParamLiteral, - BlockRange, - CallData, - ContractAbi, - ContractArtifact, - DecodedLogArgs, - LogWithDecodedArgs, - MethodAbi, - TransactionReceiptWithDecodedLogs, - TxData, - TxDataPayable, - SupportedProvider, -} from 'ethereum-types'; -import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { EventCallback, IndexedFilterValues, 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 - -export type DummyERC20TokenEventArgs = DummyERC20TokenApprovalEventArgs | DummyERC20TokenTransferEventArgs; - -export enum DummyERC20TokenEvents { - Approval = 'Approval', - Transfer = 'Transfer', -} - -export interface DummyERC20TokenApprovalEventArgs extends DecodedLogArgs { - _owner: string; - _spender: string; - _value: BigNumber; -} - -export interface DummyERC20TokenTransferEventArgs extends DecodedLogArgs { - _from: string; - _to: string; - _value: BigNumber; -} - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class DummyERC20TokenContract extends BaseContract { - /** - * @ignore - */ - public static deployedBytecode: string | undefined; - private readonly _methodABIIndex: { [name: string]: number } = {}; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - _name: string, - _symbol: string, - _decimals: BigNumber, - _totalSupply: BigNumber, - ): 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 DummyERC20TokenContract.deployAsync( - bytecode, - abi, - provider, - txDefaults, - logDecodeDependenciesAbiOnly, - _name, - _symbol, - _decimals, - _totalSupply, - ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractAbi }, - _name: string, - _symbol: string, - _decimals: BigNumber, - _totalSupply: BigNumber, - ): 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); - [_name, _symbol, _decimals, _totalSupply] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_name, _symbol, _decimals, _totalSupply], - BaseContract._bigNumberToString, - ); - const iface = new ethers.utils.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_name, _symbol, _decimals, _totalSupply]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToContractTxDataAsync( - { - 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(`DummyERC20Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DummyERC20TokenContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = [_name, _symbol, _decimals, _totalSupply]; - return contractInstance; - } - - /** - * @returns The contract ABI - */ - public static ABI(): ContractAbi { - const abi = [ - { - inputs: [ - { - name: '_name', - type: 'string', - }, - { - name: '_symbol', - type: 'string', - }, - { - name: '_decimals', - type: 'uint256', - }, - { - name: '_totalSupply', - type: 'uint256', - }, - ], - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [ - { - name: '_owner', - type: 'address', - indexed: true, - }, - { - name: '_spender', - type: 'address', - indexed: true, - }, - { - name: '_value', - type: 'uint256', - indexed: false, - }, - ], - name: 'Approval', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: '_from', - type: 'address', - indexed: true, - }, - { - name: '_to', - type: 'address', - indexed: true, - }, - { - name: '_value', - type: 'uint256', - indexed: false, - }, - ], - name: 'Transfer', - outputs: [], - type: 'event', - }, - { - constant: true, - inputs: [], - name: 'MAX_MINT_AMOUNT', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_owner', - type: 'address', - }, - { - name: '_spender', - type: 'address', - }, - ], - name: 'allowance', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_spender', - type: 'address', - }, - { - name: '_value', - type: 'uint256', - }, - ], - name: 'approve', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_owner', - type: 'address', - }, - ], - name: 'balanceOf', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'decimals', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_value', - type: 'uint256', - }, - ], - name: 'mint', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'name', - outputs: [ - { - name: '', - type: 'string', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'owner', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_target', - type: 'address', - }, - { - name: '_value', - type: 'uint256', - }, - ], - name: 'setBalance', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'symbol', - outputs: [ - { - name: '', - type: 'string', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'totalSupply', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_to', - type: 'address', - }, - { - name: '_value', - type: 'uint256', - }, - ], - name: 'transfer', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_from', - type: 'address', - }, - { - name: '_to', - type: 'address', - }, - { - name: '_value', - type: 'uint256', - }, - ], - name: 'transferFrom', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'newOwner', - type: 'address', - }, - ], - name: 'transferOwnership', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - ] as ContractAbi; - return abi; - } - - public getFunctionSignature(methodName: string): string { - const index = this._methodABIIndex[methodName]; - const methodAbi = DummyERC20TokenContract.ABI()[index] as MethodAbi; // tslint:disable-line:no-unnecessary-type-assertion - const functionSignature = methodAbiToFunctionSignature(methodAbi); - return functionSignature; - } - public getABIDecodedTransactionData(methodName: string, callData: string): T { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - } - public getABIDecodedReturnData(methodName: string, callData: string): T { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - const abiDecodedCallData = abiEncoder.strictDecodeReturnValue(callData); - return abiDecodedCallData; - } - public getSelector(methodName: string): string { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.getSelector(); - } - - public MAX_MINT_AMOUNT(): ContractFunctionObj { - const self = (this as any) as DummyERC20TokenContract; - const functionSignature = 'MAX_MINT_AMOUNT()'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, []); - }, - }; - } - public allowance(_owner: string, _spender: string): ContractFunctionObj { - const self = (this as any) as DummyERC20TokenContract; - assert.isString('_owner', _owner); - assert.isString('_spender', _spender); - const functionSignature = 'allowance(address,address)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [_owner.toLowerCase(), _spender.toLowerCase()]); - }, - }; - } - /** - * `msg.sender` approves `_spender` to spend `_value` tokens - * @param _spender The address of the account able to transfer the tokens - * @param _value The amount of wei to be approved for transfer - * @returns Always true if the call has enough gas to complete execution - */ - public approve(_spender: string, _value: BigNumber): ContractTxFunctionObj { - const self = (this as any) as DummyERC20TokenContract; - assert.isString('_spender', _spender); - assert.isBigNumber('_value', _value); - const functionSignature = 'approve(address,uint256)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [_spender.toLowerCase(), _value]); - }, - }; - } - /** - * Query the balance of owner - * @param _owner The address from which the balance will be retrieved - * @returns Balance of owner - */ - public balanceOf(_owner: string): ContractFunctionObj { - const self = (this as any) as DummyERC20TokenContract; - assert.isString('_owner', _owner); - const functionSignature = 'balanceOf(address)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [_owner.toLowerCase()]); - }, - }; - } - public decimals(): ContractFunctionObj { - const self = (this as any) as DummyERC20TokenContract; - const functionSignature = 'decimals()'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, []); - }, - }; - } - /** - * Mints new tokens for sender - * @param _value Amount of tokens to mint - */ - public mint(_value: BigNumber): ContractTxFunctionObj { - const self = (this as any) as DummyERC20TokenContract; - assert.isBigNumber('_value', _value); - const functionSignature = 'mint(uint256)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [_value]); - }, - }; - } - public name(): ContractFunctionObj { - const self = (this as any) as DummyERC20TokenContract; - const functionSignature = 'name()'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, []); - }, - }; - } - public owner(): ContractFunctionObj { - const self = (this as any) as DummyERC20TokenContract; - const functionSignature = 'owner()'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, []); - }, - }; - } - /** - * Sets the balance of target address - * @param _target Address or which balance will be updated - * @param _value New balance of target address - */ - public setBalance(_target: string, _value: BigNumber): ContractTxFunctionObj { - const self = (this as any) as DummyERC20TokenContract; - assert.isString('_target', _target); - assert.isBigNumber('_value', _value); - const functionSignature = 'setBalance(address,uint256)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [_target.toLowerCase(), _value]); - }, - }; - } - public symbol(): ContractFunctionObj { - const self = (this as any) as DummyERC20TokenContract; - const functionSignature = 'symbol()'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, []); - }, - }; - } - /** - * Query total supply of token - * @returns Total supply of token - */ - public totalSupply(): ContractFunctionObj { - const self = (this as any) as DummyERC20TokenContract; - const functionSignature = 'totalSupply()'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, []); - }, - }; - } - /** - * send `value` token to `to` from `msg.sender` - * @param _to The address of the recipient - * @param _value The amount of token to be transferred - * @returns True if transfer was successful - */ - public transfer(_to: string, _value: BigNumber): ContractTxFunctionObj { - const self = (this as any) as DummyERC20TokenContract; - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const functionSignature = 'transfer(address,uint256)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [_to.toLowerCase(), _value]); - }, - }; - } - /** - * ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance. See https://github.com/ethereum/EIPs/issues/717 - * @param _from Address to transfer from. - * @param _to Address to transfer to. - * @param _value Amount to transfer. - * @returns Success of transfer. - */ - public transferFrom(_from: string, _to: string, _value: BigNumber): ContractTxFunctionObj { - const self = (this as any) as DummyERC20TokenContract; - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_value', _value); - const functionSignature = 'transferFrom(address,address,uint256)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [_from.toLowerCase(), _to.toLowerCase(), _value]); - }, - }; - } - public transferOwnership(newOwner: string): ContractTxFunctionObj { - const self = (this as any) as DummyERC20TokenContract; - assert.isString('newOwner', newOwner); - const functionSignature = 'transferOwnership(address)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [newOwner.toLowerCase()]); - }, - }; - } - - /** - * Subscribe to an event type emitted by the DummyERC20Token contract. - * @param eventName The DummyERC20Token contract event you would like to subscribe to. - * @param indexFilterValues An object where the keys are indexed args returned by the event and - * the value is the value you are interested in. E.g `{maker: aUserAddressHex}` - * @param callback Callback that gets called when a log is added/removed - * @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered) - * @return Subscription token used later to unsubscribe - */ - public subscribe( - eventName: DummyERC20TokenEvents, - indexFilterValues: IndexedFilterValues, - callback: EventCallback, - isVerbose: boolean = false, - blockPollingIntervalMs?: number, - ): string { - assert.doesBelongToStringEnum('eventName', eventName, DummyERC20TokenEvents); - assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); - assert.isFunction('callback', callback); - const subscriptionToken = this._subscriptionManager.subscribe( - this.address, - eventName, - indexFilterValues, - DummyERC20TokenContract.ABI(), - callback, - isVerbose, - blockPollingIntervalMs, - ); - return subscriptionToken; - } - /** - * Cancel a subscription - * @param subscriptionToken Subscription token returned by `subscribe()` - */ - public unsubscribe(subscriptionToken: string): void { - this._subscriptionManager.unsubscribe(subscriptionToken); - } - /** - * Cancels all existing subscriptions - */ - public unsubscribeAll(): void { - this._subscriptionManager.unsubscribeAll(); - } - /** - * Gets historical logs without creating a subscription - * @param eventName The DummyERC20Token contract event you would like to subscribe to. - * @param blockRange Block range to get logs from. - * @param indexFilterValues An object where the keys are indexed args returned by the event and - * the value is the value you are interested in. E.g `{_from: aUserAddressHex}` - * @return Array of logs that match the parameters - */ - public async getLogsAsync( - eventName: DummyERC20TokenEvents, - blockRange: BlockRange, - indexFilterValues: IndexedFilterValues, - ): Promise>> { - assert.doesBelongToStringEnum('eventName', eventName, DummyERC20TokenEvents); - assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema); - assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); - const logs = await this._subscriptionManager.getLogsAsync( - this.address, - eventName, - blockRange, - indexFilterValues, - DummyERC20TokenContract.ABI(), - ); - return logs; - } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - deployedBytecode: string | undefined = DummyERC20TokenContract.deployedBytecode, - ) { - super( - 'DummyERC20Token', - DummyERC20TokenContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - deployedBytecode, - ); - classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); - this._subscriptionManager = new SubscriptionManager( - DummyERC20TokenContract.ABI(), - this._web3Wrapper, - ); - DummyERC20TokenContract.ABI().forEach((item, index) => { - if (item.type === 'function') { - const methodAbi = item as MethodAbi; - this._methodABIIndex[methodAbi.name] = index; - } - }); - } -} - -// 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/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts deleted file mode 100644 index 2c47baa76d..0000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts +++ /dev/null @@ -1,1264 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma enum-naming -// tslint:disable:whitespace no-unbound-method no-trailing-whitespace -// tslint:disable:no-unused-variable -import { - AwaitTransactionSuccessOpts, - ContractFunctionObj, - ContractTxFunctionObj, - SendTransactionOpts, - BaseContract, - SubscriptionManager, - PromiseWithTransactionHash, - methodAbiToFunctionSignature, -} from '@0x/base-contract'; -import { schemas } from '@0x/json-schemas'; -import { - BlockParam, - BlockParamLiteral, - BlockRange, - CallData, - ContractAbi, - ContractArtifact, - DecodedLogArgs, - LogWithDecodedArgs, - MethodAbi, - TransactionReceiptWithDecodedLogs, - TxData, - TxDataPayable, - SupportedProvider, -} from 'ethereum-types'; -import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { EventCallback, IndexedFilterValues, 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 - -export type DummyERC721TokenEventArgs = - | DummyERC721TokenApprovalEventArgs - | DummyERC721TokenApprovalForAllEventArgs - | DummyERC721TokenTransferEventArgs; - -export enum DummyERC721TokenEvents { - Approval = 'Approval', - ApprovalForAll = 'ApprovalForAll', - Transfer = 'Transfer', -} - -export interface DummyERC721TokenApprovalEventArgs extends DecodedLogArgs { - _owner: string; - _approved: string; - _tokenId: BigNumber; -} - -export interface DummyERC721TokenApprovalForAllEventArgs extends DecodedLogArgs { - _owner: string; - _operator: string; - _approved: boolean; -} - -export interface DummyERC721TokenTransferEventArgs extends DecodedLogArgs { - _from: string; - _to: string; - _tokenId: BigNumber; -} - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class DummyERC721TokenContract extends BaseContract { - /** - * @ignore - */ - public static deployedBytecode: string | undefined; - private readonly _methodABIIndex: { [name: string]: number } = {}; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - _name: string, - _symbol: 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 DummyERC721TokenContract.deployAsync( - bytecode, - abi, - provider, - txDefaults, - logDecodeDependenciesAbiOnly, - _name, - _symbol, - ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractAbi }, - _name: string, - _symbol: 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); - [_name, _symbol] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_name, _symbol], - BaseContract._bigNumberToString, - ); - const iface = new ethers.utils.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_name, _symbol]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToContractTxDataAsync( - { - 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(`DummyERC721Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DummyERC721TokenContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = [_name, _symbol]; - return contractInstance; - } - - /** - * @returns The contract ABI - */ - public static ABI(): ContractAbi { - const abi = [ - { - inputs: [ - { - name: '_name', - type: 'string', - }, - { - name: '_symbol', - type: 'string', - }, - ], - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [ - { - name: '_owner', - type: 'address', - indexed: true, - }, - { - name: '_approved', - type: 'address', - indexed: true, - }, - { - name: '_tokenId', - type: 'uint256', - indexed: true, - }, - ], - name: 'Approval', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: '_owner', - type: 'address', - indexed: true, - }, - { - name: '_operator', - type: 'address', - indexed: true, - }, - { - name: '_approved', - type: 'bool', - indexed: false, - }, - ], - name: 'ApprovalForAll', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: '_from', - type: 'address', - indexed: true, - }, - { - name: '_to', - type: 'address', - indexed: true, - }, - { - name: '_tokenId', - type: 'uint256', - indexed: true, - }, - ], - name: 'Transfer', - outputs: [], - type: 'event', - }, - { - constant: false, - inputs: [ - { - name: '_approved', - type: 'address', - }, - { - name: '_tokenId', - type: 'uint256', - }, - ], - name: 'approve', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_owner', - type: 'address', - }, - ], - name: 'balanceOf', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_owner', - type: 'address', - }, - { - name: '_tokenId', - type: 'uint256', - }, - ], - name: 'burn', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_tokenId', - type: 'uint256', - }, - ], - name: 'getApproved', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_owner', - type: 'address', - }, - { - name: '_operator', - type: 'address', - }, - ], - name: 'isApprovedForAll', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_to', - type: 'address', - }, - { - name: '_tokenId', - type: 'uint256', - }, - ], - name: 'mint', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'name', - outputs: [ - { - name: '', - type: 'string', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'owner', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: '_tokenId', - type: 'uint256', - }, - ], - name: 'ownerOf', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_from', - type: 'address', - }, - { - name: '_to', - type: 'address', - }, - { - name: '_tokenId', - type: 'uint256', - }, - ], - name: 'safeTransferFrom', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_from', - type: 'address', - }, - { - name: '_to', - type: 'address', - }, - { - name: '_tokenId', - type: 'uint256', - }, - { - name: '_data', - type: 'bytes', - }, - ], - name: 'safeTransferFrom', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_operator', - type: 'address', - }, - { - name: '_approved', - type: 'bool', - }, - ], - name: 'setApprovalForAll', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'symbol', - outputs: [ - { - name: '', - type: 'string', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: '_from', - type: 'address', - }, - { - name: '_to', - type: 'address', - }, - { - name: '_tokenId', - type: 'uint256', - }, - ], - name: 'transferFrom', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'newOwner', - type: 'address', - }, - ], - name: 'transferOwnership', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - ] as ContractAbi; - return abi; - } - - public getFunctionSignature(methodName: string): string { - const index = this._methodABIIndex[methodName]; - const methodAbi = DummyERC721TokenContract.ABI()[index] as MethodAbi; // tslint:disable-line:no-unnecessary-type-assertion - const functionSignature = methodAbiToFunctionSignature(methodAbi); - return functionSignature; - } - public getABIDecodedTransactionData(methodName: string, callData: string): T { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - } - public getABIDecodedReturnData(methodName: string, callData: string): T { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - const abiDecodedCallData = abiEncoder.strictDecodeReturnValue(callData); - return abiDecodedCallData; - } - public getSelector(methodName: string): string { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.getSelector(); - } - - /** - * The zero address indicates there is no approved address. - * Throws unless `msg.sender` is the current NFT owner, or an authorized - * operator of the current owner. - * @param _approved The new approved NFT controller - * @param _tokenId The NFT to approve - */ - public approve(_approved: string, _tokenId: BigNumber): ContractTxFunctionObj { - const self = (this as any) as DummyERC721TokenContract; - assert.isString('_approved', _approved); - assert.isBigNumber('_tokenId', _tokenId); - const functionSignature = 'approve(address,uint256)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [_approved.toLowerCase(), _tokenId]); - }, - }; - } - /** - * NFTs assigned to the zero address are considered invalid, and this - * function throws for queries about the zero address. - * @param _owner An address for whom to query the balance - * @returns The number of NFTs owned by `_owner`, possibly zero - */ - public balanceOf(_owner: string): ContractFunctionObj { - const self = (this as any) as DummyERC721TokenContract; - assert.isString('_owner', _owner); - const functionSignature = 'balanceOf(address)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [_owner.toLowerCase()]); - }, - }; - } - /** - * Function to burn a token - * Reverts if the given token ID doesn't exist or not called by contract owner - * @param _owner Owner of token with given token ID - * @param _tokenId ID of the token to be burned by the msg.sender - */ - public burn(_owner: string, _tokenId: BigNumber): ContractTxFunctionObj { - const self = (this as any) as DummyERC721TokenContract; - assert.isString('_owner', _owner); - assert.isBigNumber('_tokenId', _tokenId); - const functionSignature = 'burn(address,uint256)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [_owner.toLowerCase(), _tokenId]); - }, - }; - } - /** - * Throws if `_tokenId` is not a valid NFT. - * @param _tokenId The NFT to find the approved address for - * @returns The approved address for this NFT, or the zero address if there is none - */ - public getApproved(_tokenId: BigNumber): ContractFunctionObj { - const self = (this as any) as DummyERC721TokenContract; - assert.isBigNumber('_tokenId', _tokenId); - const functionSignature = 'getApproved(uint256)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [_tokenId]); - }, - }; - } - public isApprovedForAll(_owner: string, _operator: string): ContractFunctionObj { - const self = (this as any) as DummyERC721TokenContract; - assert.isString('_owner', _owner); - assert.isString('_operator', _operator); - const functionSignature = 'isApprovedForAll(address,address)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [_owner.toLowerCase(), _operator.toLowerCase()]); - }, - }; - } - /** - * Function to mint a new token - * Reverts if the given token ID already exists - * @param _to Address of the beneficiary that will own the minted token - * @param _tokenId ID of the token to be minted by the msg.sender - */ - public mint(_to: string, _tokenId: BigNumber): ContractTxFunctionObj { - const self = (this as any) as DummyERC721TokenContract; - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const functionSignature = 'mint(address,uint256)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [_to.toLowerCase(), _tokenId]); - }, - }; - } - public name(): ContractFunctionObj { - const self = (this as any) as DummyERC721TokenContract; - const functionSignature = 'name()'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, []); - }, - }; - } - public owner(): ContractFunctionObj { - const self = (this as any) as DummyERC721TokenContract; - const functionSignature = 'owner()'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, []); - }, - }; - } - /** - * NFTs assigned to zero address are considered invalid, and queries - * about them do throw. - * @param _tokenId The identifier for an NFT - * @returns The address of the owner of the NFT - */ - public ownerOf(_tokenId: BigNumber): ContractFunctionObj { - const self = (this as any) as DummyERC721TokenContract; - assert.isBigNumber('_tokenId', _tokenId); - const functionSignature = 'ownerOf(uint256)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [_tokenId]); - }, - }; - } - /** - * This works identically to the other function with an extra data parameter, - * except this function just sets data to "". - * @param _from The current owner of the NFT - * @param _to The new owner - * @param _tokenId The NFT to transfer - */ - public safeTransferFrom1(_from: string, _to: string, _tokenId: BigNumber): ContractTxFunctionObj { - const self = (this as any) as DummyERC721TokenContract; - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const functionSignature = 'safeTransferFrom(address,address,uint256)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); - }, - }; - } - /** - * Throws unless `msg.sender` is the current owner, an authorized - * operator, or the approved address for this NFT. Throws if `_from` is - * not the current owner. Throws if `_to` is the zero address. Throws if - * `_tokenId` is not a valid NFT. When transfer is complete, this function - * checks if `_to` is a smart contract (code size > 0). If so, it calls - * `onERC721Received` on `_to` and throws if the return value is not - * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`. - * @param _from The current owner of the NFT - * @param _to The new owner - * @param _tokenId The NFT to transfer - * @param _data Additional data with no specified format, sent in call to `_to` - */ - public safeTransferFrom2( - _from: string, - _to: string, - _tokenId: BigNumber, - _data: string, - ): ContractTxFunctionObj { - const self = (this as any) as DummyERC721TokenContract; - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - assert.isString('_data', _data); - const functionSignature = 'safeTransferFrom(address,address,uint256,bytes)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - _data, - ]); - }, - }; - } - /** - * Emits the ApprovalForAll event. The contract MUST allow - * multiple operators per owner. - * @param _operator Address to add to the set of authorized operators - * @param _approved True if the operator is approved, false to revoke approval - */ - public setApprovalForAll(_operator: string, _approved: boolean): ContractTxFunctionObj { - const self = (this as any) as DummyERC721TokenContract; - assert.isString('_operator', _operator); - assert.isBoolean('_approved', _approved); - const functionSignature = 'setApprovalForAll(address,bool)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [_operator.toLowerCase(), _approved]); - }, - }; - } - public symbol(): ContractFunctionObj { - const self = (this as any) as DummyERC721TokenContract; - const functionSignature = 'symbol()'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, []); - }, - }; - } - /** - * Throws unless `msg.sender` is the current owner, an authorized - * operator, or the approved address for this NFT. Throws if `_from` is - * not the current owner. Throws if `_to` is the zero address. Throws if - * `_tokenId` is not a valid NFT. - * @param _from The current owner of the NFT - * @param _to The new owner - * @param _tokenId The NFT to transfer - */ - public transferFrom(_from: string, _to: string, _tokenId: BigNumber): ContractTxFunctionObj { - const self = (this as any) as DummyERC721TokenContract; - assert.isString('_from', _from); - assert.isString('_to', _to); - assert.isBigNumber('_tokenId', _tokenId); - const functionSignature = 'transferFrom(address,address,uint256)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [ - _from.toLowerCase(), - _to.toLowerCase(), - _tokenId, - ]); - }, - }; - } - public transferOwnership(newOwner: string): ContractTxFunctionObj { - const self = (this as any) as DummyERC721TokenContract; - assert.isString('newOwner', newOwner); - const functionSignature = 'transferOwnership(address)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [newOwner.toLowerCase()]); - }, - }; - } - - /** - * Subscribe to an event type emitted by the DummyERC721Token contract. - * @param eventName The DummyERC721Token contract event you would like to subscribe to. - * @param indexFilterValues An object where the keys are indexed args returned by the event and - * the value is the value you are interested in. E.g `{maker: aUserAddressHex}` - * @param callback Callback that gets called when a log is added/removed - * @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered) - * @return Subscription token used later to unsubscribe - */ - public subscribe( - eventName: DummyERC721TokenEvents, - indexFilterValues: IndexedFilterValues, - callback: EventCallback, - isVerbose: boolean = false, - blockPollingIntervalMs?: number, - ): string { - assert.doesBelongToStringEnum('eventName', eventName, DummyERC721TokenEvents); - assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); - assert.isFunction('callback', callback); - const subscriptionToken = this._subscriptionManager.subscribe( - this.address, - eventName, - indexFilterValues, - DummyERC721TokenContract.ABI(), - callback, - isVerbose, - blockPollingIntervalMs, - ); - return subscriptionToken; - } - /** - * Cancel a subscription - * @param subscriptionToken Subscription token returned by `subscribe()` - */ - public unsubscribe(subscriptionToken: string): void { - this._subscriptionManager.unsubscribe(subscriptionToken); - } - /** - * Cancels all existing subscriptions - */ - public unsubscribeAll(): void { - this._subscriptionManager.unsubscribeAll(); - } - /** - * Gets historical logs without creating a subscription - * @param eventName The DummyERC721Token contract event you would like to subscribe to. - * @param blockRange Block range to get logs from. - * @param indexFilterValues An object where the keys are indexed args returned by the event and - * the value is the value you are interested in. E.g `{_from: aUserAddressHex}` - * @return Array of logs that match the parameters - */ - public async getLogsAsync( - eventName: DummyERC721TokenEvents, - blockRange: BlockRange, - indexFilterValues: IndexedFilterValues, - ): Promise>> { - assert.doesBelongToStringEnum('eventName', eventName, DummyERC721TokenEvents); - assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema); - assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); - const logs = await this._subscriptionManager.getLogsAsync( - this.address, - eventName, - blockRange, - indexFilterValues, - DummyERC721TokenContract.ABI(), - ); - return logs; - } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - deployedBytecode: string | undefined = DummyERC721TokenContract.deployedBytecode, - ) { - super( - 'DummyERC721Token', - DummyERC721TokenContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - deployedBytecode, - ); - classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); - this._subscriptionManager = new SubscriptionManager( - DummyERC721TokenContract.ABI(), - this._web3Wrapper, - ); - DummyERC721TokenContract.ABI().forEach((item, index) => { - if (item.type === 'function') { - const methodAbi = item as MethodAbi; - this._methodABIIndex[methodAbi.name] = index; - } - }); - } -} - -// 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/abi-gen-wrappers/src/generated-wrappers/erc1155_mintable.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc1155_mintable.ts deleted file mode 100644 index 589410378e..0000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc1155_mintable.ts +++ /dev/null @@ -1,1512 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma enum-naming -// tslint:disable:whitespace no-unbound-method no-trailing-whitespace -// tslint:disable:no-unused-variable -import { - AwaitTransactionSuccessOpts, - ContractFunctionObj, - ContractTxFunctionObj, - SendTransactionOpts, - BaseContract, - SubscriptionManager, - PromiseWithTransactionHash, - methodAbiToFunctionSignature, -} from '@0x/base-contract'; -import { schemas } from '@0x/json-schemas'; -import { - BlockParam, - BlockParamLiteral, - BlockRange, - CallData, - ContractAbi, - ContractArtifact, - DecodedLogArgs, - LogWithDecodedArgs, - MethodAbi, - TransactionReceiptWithDecodedLogs, - TxData, - TxDataPayable, - SupportedProvider, -} from 'ethereum-types'; -import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { EventCallback, IndexedFilterValues, 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 - -export type ERC1155MintableEventArgs = - | ERC1155MintableApprovalForAllEventArgs - | ERC1155MintableTransferBatchEventArgs - | ERC1155MintableTransferSingleEventArgs - | ERC1155MintableURIEventArgs; - -export enum ERC1155MintableEvents { - ApprovalForAll = 'ApprovalForAll', - TransferBatch = 'TransferBatch', - TransferSingle = 'TransferSingle', - URI = 'URI', -} - -export interface ERC1155MintableApprovalForAllEventArgs extends DecodedLogArgs { - owner: string; - operator: string; - approved: boolean; -} - -export interface ERC1155MintableTransferBatchEventArgs extends DecodedLogArgs { - operator: string; - from: string; - to: string; - ids: BigNumber[]; - values: BigNumber[]; -} - -export interface ERC1155MintableTransferSingleEventArgs extends DecodedLogArgs { - operator: string; - from: string; - to: string; - id: BigNumber; - value: BigNumber; -} - -export interface ERC1155MintableURIEventArgs extends DecodedLogArgs { - value: string; - id: BigNumber; -} - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class ERC1155MintableContract extends BaseContract { - /** - * @ignore - */ - public static deployedBytecode = - '0x608060405234801561001057600080fd5b50600436106101765760003560e01c80639f4b286a116100d8578063e0a5c9491161008c578063f242432a11610066578063f242432a146107bb578063f94190881461085d578063fc67bf1c146108d457610176565b8063e0a5c94914610726578063e44591f014610763578063e985e9c51461078057610176565b8063adebf6f2116100bd578063adebf6f21461067a578063cc10e40114610697578063cd53d08e1461070957610176565b80639f4b286a146105c8578063a22cb4651461063f57610176565b80636352211e1161012f5780637269a327116101145780637269a327146104c557806378b27221146104e25780639cca1c64146105ab57610176565b80636352211e146104625780636f969c2d146104a857610176565b80632eb2c2d6116101605780632eb2c2d6146101e35780634e1273f41461031f5780635e81b9581461043157610176565b8062fdd58e1461017b57806308d7d469146101c6575b600080fd5b6101b46004803603604081101561019157600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356108dc565b60408051918252519081900360200190f35b6101b4600480360360208110156101dc57600080fd5b5035610966565b61031d600480360360a08110156101f957600080fd5b73ffffffffffffffffffffffffffffffffffffffff823581169260208101359091169181019060608101604082013564010000000081111561023a57600080fd5b82018360208201111561024c57600080fd5b8035906020019184602083028401116401000000008311171561026e57600080fd5b91939092909160208101903564010000000081111561028c57600080fd5b82018360208201111561029e57600080fd5b803590602001918460208302840111640100000000831117156102c057600080fd5b9193909290916020810190356401000000008111156102de57600080fd5b8201836020820111156102f057600080fd5b8035906020019184600183028401116401000000008311171561031257600080fd5b509092509050610978565b005b6103e16004803603604081101561033557600080fd5b81019060208101813564010000000081111561035057600080fd5b82018360208201111561036257600080fd5b8035906020019184602083028401116401000000008311171561038457600080fd5b9193909290916020810190356401000000008111156103a257600080fd5b8201836020820111156103b457600080fd5b803590602001918460208302840111640100000000831117156103d657600080fd5b509092509050611192565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561041d578181015183820152602001610405565b505050509050019250505060405180910390f35b61044e6004803603602081101561044757600080fd5b5035611357565b604080519115158252519081900360200190f35b61047f6004803603602081101561047857600080fd5b503561139d565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101b4600480360360208110156104be57600080fd5b50356113c5565b61044e600480360360208110156104db57600080fd5b50356113ea565b61031d600480360360608110156104f857600080fd5b8135919081019060408101602082013564010000000081111561051a57600080fd5b82018360208201111561052c57600080fd5b8035906020019184602083028401116401000000008311171561054e57600080fd5b91939092909160208101903564010000000081111561056c57600080fd5b82018360208201111561057e57600080fd5b803590602001918460208302840111640100000000831117156105a057600080fd5b50909250905061142f565b6101b4600480360360208110156105c157600080fd5b5035611760565b61031d600480360360408110156105de57600080fd5b8135919081019060408101602082013564010000000081111561060057600080fd5b82018360208201111561061257600080fd5b8035906020019184600183028401116401000000008311171561063457600080fd5b509092509050611775565b61031d6004803603604081101561065557600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001351515611875565b61044e6004803603602081101561069057600080fd5b503561190e565b6101b4600480360360408110156106ad57600080fd5b8101906020810181356401000000008111156106c857600080fd5b8201836020820111156106da57600080fd5b803590602001918460018302840111640100000000831117156106fc57600080fd5b9193509150351515611934565b61047f6004803603602081101561071f57600080fd5b5035611a6d565b61072e611a95565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b61044e6004803603602081101561077957600080fd5b5035611ab9565b61044e6004803603604081101561079657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611ae1565b61031d600480360360a08110156107d157600080fd5b73ffffffffffffffffffffffffffffffffffffffff823581169260208101359091169160408201359160608101359181019060a08101608082013564010000000081111561081e57600080fd5b82018360208201111561083057600080fd5b8035906020019184600183028401116401000000008311171561085257600080fd5b509092509050611b1c565b61031d6004803603604081101561087357600080fd5b8135919081019060408101602082013564010000000081111561089557600080fd5b8201836020820111156108a757600080fd5b803590602001918460208302840111640100000000831117156108c957600080fd5b5090925090506120fb565b61072e61242b565b60006108e782611357565b1561092e5760008281526020819052604090205473ffffffffffffffffffffffffffffffffffffffff848116911614610921576000610924565b60015b60ff169050610960565b50600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff861684529091529020545b92915050565b60056020526000908152604090205481565b73ffffffffffffffffffffffffffffffffffffffff87166109fa57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43414e4e4f545f5452414e534645525f544f5f414444524553535f5a45524f00604482015290519081900360640190fd5b848314610a6857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f544f4b454e5f414e445f56414c5545535f4c454e4754485f4d49534d41544348604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8816331480610ac1575073ffffffffffffffffffffffffffffffffffffffff8816600090815260026020908152604080832033845290915290205460ff1615156001145b610b2c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f494e53554646494349454e545f414c4c4f57414e434500000000000000000000604482015290519081900360640190fd5b60005b85811015610deb576000878783818110610b4557fe5b9050602002013590506000868684818110610b5c57fe5b905060200201359050610b6e82611ab9565b15610cc85780600114610be257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f414d4f554e545f455155414c5f544f5f4f4e455f524551554952454400000000604482015290519081900360640190fd5b60008281526020819052604090205473ffffffffffffffffffffffffffffffffffffffff8c8116911614610c7757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4e46545f4e4f545f4f574e45445f42595f46524f4d5f41444452455353000000604482015290519081900360640190fd5b600082815260208190526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8c16179055610de1565b600082815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8f168452909152902054610d02908261244f565b6001600084815260200190815260200160002060008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610db06001600084815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482612473565b600083815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8f1684529091529020555b5050600101610b2f565b508673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb898989896040518080602001806020018381038352878782818152602001925060200280828437600083820152601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169091018481038352858152602090810191508690860280828437600083820152604051601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169092018290039850909650505050505050a4610f1f8773ffffffffffffffffffffffffffffffffffffffff1661248f565b156111885760008773ffffffffffffffffffffffffffffffffffffffff1663bc197c81338b8a8a8a8a8a8a6040518963ffffffff1660e01b8152600401808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001806020018060200184810384528a8a82818152602001925060200280828437600083820152601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169091018581038452888152602090810191508990890280828437600083820152601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690910185810383528681526020019050868680828437600081840152601f19601f8201169050808301925050509b505050505050505050505050602060405180830381600087803b1580156110a857600080fd5b505af11580156110bc573d6000803e3d6000fd5b505050506040513d60208110156110d257600080fd5b505190507fffffffff0000000000000000000000000000000000000000000000000000000081167fbc197c81000000000000000000000000000000000000000000000000000000001461118657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4241445f52454345495645525f52455455524e5f56414c554500000000000000604482015290519081900360640190fd5b505b5050505050505050565b60608382146111ec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061256a6024913960400191505060405180910390fd5b604080518581526020808702820101909152848015611215578160200160208202803883390190505b50905060005b8481101561134e57600084848381811061123157fe5b90506020020135905061124381611357565b156112b95786868381811061125457fe5b600084815260208181526040909120549102929092013573ffffffffffffffffffffffffffffffffffffffff9081169216919091149050611296576000611299565b60015b60ff168383815181106112a857fe5b602002602001018181525050611345565b6000818152600160205260408120908888858181106112d457fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483838151811061133857fe5b6020026020010181815250505b5060010161121b565b50949350505050565b60007f80000000000000000000000000000000000000000000000000000000000000008083161480156109605750506fffffffffffffffffffffffffffffffff16151590565b60009081526020819052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b7fffffffffffffffffffffffffffffffff000000000000000000000000000000001690565b60007f80000000000000000000000000000000000000000000000000000000000000008083161480156109605750506fffffffffffffffffffffffffffffffff161590565b600085815260046020526040902054859073ffffffffffffffffffffffffffffffffffffffff16331461146157600080fd5b61146a8661190e565b6114bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d81526020018061258e602d913960400191505060405180910390fd5b60005b848110156117575760008686838181106114d857fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff169050600085858481811061150557fe5b60008c815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8916845282529091205491029290920135925061154a91839150612473565b60008a815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083528184209490945580518d8152918201859052805133927fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6292908290030190a46115d68273ffffffffffffffffffffffffffffffffffffffff1661248f565b1561174d57604080517ff23a6e6100000000000000000000000000000000000000000000000000000000815233600482018190526024820152604481018b90526064810183905260a06084820152600060a48201819052915173ffffffffffffffffffffffffffffffffffffffff85169163f23a6e619160e480830192602092919082900301818787803b15801561166d57600080fd5b505af1158015611681573d6000803e3d6000fd5b505050506040513d602081101561169757600080fd5b505190507fffffffff0000000000000000000000000000000000000000000000000000000081167ff23a6e61000000000000000000000000000000000000000000000000000000001461174b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4241445f52454345495645525f52455455524e5f56414c554500000000000000604482015290519081900360640190fd5b505b50506001016114c2565b50505050505050565b6fffffffffffffffffffffffffffffffff1690565b600083815260046020908152604080832080547fffffffffffffffffffffffff0000000000000000000000000000000000000000163390811790915581518781529283018490528151849391927fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62928290030190a4801561187057827f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b838360405180806020018281038252848482818152602001925080828437600083820152604051601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169092018290039550909350505050a25b505050565b33600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b7f8000000000000000000000000000000000000000000000000000000000000000161590565b600380546001019081905560801b811561196b577f8000000000000000000000000000000000000000000000000000000000000000175b600081815260046020908152604080832080547fffffffffffffffffffffffff0000000000000000000000000000000000000000163390811790915581518581529283018490528151849391927fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62928290030190a48215611a6657807f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b858560405180806020018281038252848482818152602001925080828437600083820152604051601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169092018290039550909350505050a25b9392505050565b60046020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b7ff23a6e610000000000000000000000000000000000000000000000000000000081565b7f80000000000000000000000000000000000000000000000000000000000000009081161490565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260026020908152604080832093909416825291909152205460ff1690565b73ffffffffffffffffffffffffffffffffffffffff8516611b9e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43414e4e4f545f5452414e534645525f544f5f414444524553535f5a45524f00604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8616331480611bf7575073ffffffffffffffffffffffffffffffffffffffff8616600090815260026020908152604080832033845290915290205460ff1615156001145b611c6257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f494e53554646494349454e545f414c4c4f57414e434500000000000000000000604482015290519081900360640190fd5b611c6b84611ab9565b15611dc55782600114611cdf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f414d4f554e545f455155414c5f544f5f4f4e455f524551554952454400000000604482015290519081900360640190fd5b60008481526020819052604090205473ffffffffffffffffffffffffffffffffffffffff878116911614611d7457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4e46545f4e4f545f4f574e45445f42595f46524f4d5f41444452455353000000604482015290519081900360640190fd5b600084815260208190526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8716179055611e74565b600084815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8a168452909152902054611dff908461244f565b600085815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8b81168552925280832093909355871681522054611e439084612473565b600085815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8a1684529091529020555b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628787604051808381526020018281526020019250505060405180910390a4611f178573ffffffffffffffffffffffffffffffffffffffff1661248f565b156120f35760008573ffffffffffffffffffffffffffffffffffffffff1663f23a6e613389888888886040518763ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f820116905080830192505050975050505050505050602060405180830381600087803b15801561201557600080fd5b505af1158015612029573d6000803e3d6000fd5b505050506040513d602081101561203f57600080fd5b505190507fffffffff0000000000000000000000000000000000000000000000000000000081167ff23a6e61000000000000000000000000000000000000000000000000000000001461175757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4241445f52454345495645525f52455455524e5f56414c554500000000000000604482015290519081900360640190fd5b505050505050565b600083815260046020526040902054839073ffffffffffffffffffffffffffffffffffffffff16331461212d57600080fd5b61213684611ab9565b61218b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d81526020018061253d602d913960400191505060405180910390fd5b600084815260056020526040812054600101905b838110156123f75760008585838181106121b557fe5b8486018a176000818152602081815260408083208054958302979097013573ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff00000000000000000000000000000000000000009095168517909655855183815260019181019190915285519396509194869450909233927fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6292908290030190a46122768273ffffffffffffffffffffffffffffffffffffffff1661248f565b156123ed57604080517ff23a6e6100000000000000000000000000000000000000000000000000000000815233600482018190526024820152604481018390526001606482015260a06084820152600060a48201819052915173ffffffffffffffffffffffffffffffffffffffff85169163f23a6e619160e480830192602092919082900301818787803b15801561230d57600080fd5b505af1158015612321573d6000803e3d6000fd5b505050506040513d602081101561233757600080fd5b505190507fffffffff0000000000000000000000000000000000000000000000000000000081167ff23a6e6100000000000000000000000000000000000000000000000000000000146123eb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4241445f52454345495645525f52455455524e5f56414c554500000000000000604482015290519081900360640190fd5b505b505060010161219f565b50600085815260056020526040902054612412908490612473565b6000958652600560205260409095209490945550505050565b7fbc197c810000000000000000000000000000000000000000000000000000000081565b60008282111561246d5761246d61246860028585612495565b612534565b50900390565b600082820183811015611a6657611a6661246860008686612495565b3b151590565b606063e946c1bb60e01b848484604051602401808460038111156124b557fe5b60ff1681526020018381526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090509392505050565b805160208201fdfe54524945445f544f5f4d494e545f4e4f4e5f46554e4749424c455f464f525f46554e4749424c455f544f4b454e4f574e4552535f414e445f4944535f4d5553545f484156455f53414d455f4c454e47544854524945445f544f5f4d494e545f46554e4749424c455f464f525f4e4f4e5f46554e4749424c455f544f4b454ea265627a7a723158205af7d187cbffb255b374d24e5838a04f6b3a3245622025907396b2a61f9d93da64736f6c634300050c0032'; - private readonly _methodABIIndex: { [name: string]: number } = {}; - private readonly _subscriptionManager: SubscriptionManager; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - ): 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 ERC1155MintableContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractAbi }, - ): 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); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); - const iface = new ethers.utils.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToContractTxDataAsync( - { - 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(`ERC1155Mintable successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC1155MintableContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = []; - return contractInstance; - } - - /** - * @returns The contract ABI - */ - public static ABI(): ContractAbi { - const abi = [ - { - anonymous: false, - inputs: [ - { - name: 'owner', - type: 'address', - indexed: true, - }, - { - name: 'operator', - type: 'address', - indexed: true, - }, - { - name: 'approved', - type: 'bool', - indexed: false, - }, - ], - name: 'ApprovalForAll', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'operator', - type: 'address', - indexed: true, - }, - { - name: 'from', - type: 'address', - indexed: true, - }, - { - name: 'to', - type: 'address', - indexed: true, - }, - { - name: 'ids', - type: 'uint256[]', - indexed: false, - }, - { - name: 'values', - type: 'uint256[]', - indexed: false, - }, - ], - name: 'TransferBatch', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'operator', - type: 'address', - indexed: true, - }, - { - name: 'from', - type: 'address', - indexed: true, - }, - { - name: 'to', - type: 'address', - indexed: true, - }, - { - name: 'id', - type: 'uint256', - indexed: false, - }, - { - name: 'value', - type: 'uint256', - indexed: false, - }, - ], - name: 'TransferSingle', - outputs: [], - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - name: 'value', - type: 'string', - indexed: false, - }, - { - name: 'id', - type: 'uint256', - indexed: true, - }, - ], - name: 'URI', - outputs: [], - type: 'event', - }, - { - constant: true, - inputs: [], - name: 'ERC1155_BATCH_RECEIVED', - outputs: [ - { - name: '', - type: 'bytes4', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [], - name: 'ERC1155_RECEIVED', - outputs: [ - { - name: '', - type: 'bytes4', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'owner', - type: 'address', - }, - { - name: 'id', - type: 'uint256', - }, - ], - name: 'balanceOf', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'owners', - type: 'address[]', - }, - { - name: 'ids', - type: 'uint256[]', - }, - ], - name: 'balanceOfBatch', - outputs: [ - { - name: 'balances_', - type: 'uint256[]', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'uri', - type: 'string', - }, - { - name: 'isNF', - type: 'bool', - }, - ], - name: 'create', - outputs: [ - { - name: 'type_', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'type_', - type: 'uint256', - }, - { - name: 'uri', - type: 'string', - }, - ], - name: 'createWithType', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'index_0', - type: 'uint256', - }, - ], - name: 'creators', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'id', - type: 'uint256', - }, - ], - name: 'getNonFungibleBaseType', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'pure', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'id', - type: 'uint256', - }, - ], - name: 'getNonFungibleIndex', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'pure', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'owner', - type: 'address', - }, - { - name: 'operator', - type: 'address', - }, - ], - name: 'isApprovedForAll', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'id', - type: 'uint256', - }, - ], - name: 'isFungible', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'pure', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'id', - type: 'uint256', - }, - ], - name: 'isNonFungible', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'pure', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'id', - type: 'uint256', - }, - ], - name: 'isNonFungibleBaseType', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'pure', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'id', - type: 'uint256', - }, - ], - name: 'isNonFungibleItem', - outputs: [ - { - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'pure', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'index_0', - type: 'uint256', - }, - ], - name: 'maxIndex', - outputs: [ - { - name: '', - type: 'uint256', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'id', - type: 'uint256', - }, - { - name: 'to', - type: 'address[]', - }, - { - name: 'quantities', - type: 'uint256[]', - }, - ], - name: 'mintFungible', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'type_', - type: 'uint256', - }, - { - name: 'to', - type: 'address[]', - }, - ], - name: 'mintNonFungible', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'id', - type: 'uint256', - }, - ], - name: 'ownerOf', - outputs: [ - { - name: '', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'from', - type: 'address', - }, - { - name: 'to', - type: 'address', - }, - { - name: 'ids', - type: 'uint256[]', - }, - { - name: 'values', - type: 'uint256[]', - }, - { - name: 'data', - type: 'bytes', - }, - ], - name: 'safeBatchTransferFrom', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'from', - type: 'address', - }, - { - name: 'to', - type: 'address', - }, - { - name: 'id', - type: 'uint256', - }, - { - name: 'value', - type: 'uint256', - }, - { - name: 'data', - type: 'bytes', - }, - ], - name: 'safeTransferFrom', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - { - constant: false, - inputs: [ - { - name: 'operator', - type: 'address', - }, - { - name: 'approved', - type: 'bool', - }, - ], - name: 'setApprovalForAll', - outputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'function', - }, - ] as ContractAbi; - return abi; - } - - public getFunctionSignature(methodName: string): string { - const index = this._methodABIIndex[methodName]; - const methodAbi = ERC1155MintableContract.ABI()[index] as MethodAbi; // tslint:disable-line:no-unnecessary-type-assertion - const functionSignature = methodAbiToFunctionSignature(methodAbi); - return functionSignature; - } - public getABIDecodedTransactionData(methodName: string, callData: string): T { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as ERC1155MintableContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - } - public getABIDecodedReturnData(methodName: string, callData: string): T { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as ERC1155MintableContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - const abiDecodedCallData = abiEncoder.strictDecodeReturnValue(callData); - return abiDecodedCallData; - } - public getSelector(methodName: string): string { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as ERC1155MintableContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.getSelector(); - } - - public ERC1155_BATCH_RECEIVED(): ContractFunctionObj { - const self = (this as any) as ERC1155MintableContract; - const functionSignature = 'ERC1155_BATCH_RECEIVED()'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, []); - }, - }; - } - public ERC1155_RECEIVED(): ContractFunctionObj { - const self = (this as any) as ERC1155MintableContract; - const functionSignature = 'ERC1155_RECEIVED()'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, []); - }, - }; - } - public balanceOf(owner: string, id: BigNumber): ContractFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isString('owner', owner); - assert.isBigNumber('id', id); - const functionSignature = 'balanceOf(address,uint256)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [owner.toLowerCase(), id]); - }, - }; - } - public balanceOfBatch(owners: string[], ids: BigNumber[]): ContractFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isArray('owners', owners); - assert.isArray('ids', ids); - const functionSignature = 'balanceOfBatch(address[],uint256[])'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [owners, ids]); - }, - }; - } - /** - * creates a new token - * @param uri URI of token - * @param isNF is non-fungible token - * @returns type_ of token (a unique identifier) - */ - public create(uri: string, isNF: boolean): ContractTxFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isString('uri', uri); - assert.isBoolean('isNF', isNF); - const functionSignature = 'create(string,bool)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [uri, isNF]); - }, - }; - } - /** - * creates a new token - * @param type_ of token - * @param uri URI of token - */ - public createWithType(type_: BigNumber, uri: string): ContractTxFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isBigNumber('type_', type_); - assert.isString('uri', uri); - const functionSignature = 'createWithType(uint256,string)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [type_, uri]); - }, - }; - } - public creators(index_0: BigNumber): ContractFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isBigNumber('index_0', index_0); - const functionSignature = 'creators(uint256)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [index_0]); - }, - }; - } - /** - * Returns base type of non-fungible token - */ - public getNonFungibleBaseType(id: BigNumber): ContractFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isBigNumber('id', id); - const functionSignature = 'getNonFungibleBaseType(uint256)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._evmExecAsync(this.getABIEncodedTransactionData()); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [id]); - }, - }; - } - /** - * Returns index of non-fungible token - */ - public getNonFungibleIndex(id: BigNumber): ContractFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isBigNumber('id', id); - const functionSignature = 'getNonFungibleIndex(uint256)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._evmExecAsync(this.getABIEncodedTransactionData()); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [id]); - }, - }; - } - public isApprovedForAll(owner: string, operator: string): ContractFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isString('owner', owner); - assert.isString('operator', operator); - const functionSignature = 'isApprovedForAll(address,address)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [owner.toLowerCase(), operator.toLowerCase()]); - }, - }; - } - /** - * Returns true if token is fungible - */ - public isFungible(id: BigNumber): ContractFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isBigNumber('id', id); - const functionSignature = 'isFungible(uint256)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._evmExecAsync(this.getABIEncodedTransactionData()); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [id]); - }, - }; - } - /** - * Returns true if token is non-fungible - */ - public isNonFungible(id: BigNumber): ContractFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isBigNumber('id', id); - const functionSignature = 'isNonFungible(uint256)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._evmExecAsync(this.getABIEncodedTransactionData()); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [id]); - }, - }; - } - /** - * Returns true if input is base-type of a non-fungible token - */ - public isNonFungibleBaseType(id: BigNumber): ContractFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isBigNumber('id', id); - const functionSignature = 'isNonFungibleBaseType(uint256)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._evmExecAsync(this.getABIEncodedTransactionData()); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [id]); - }, - }; - } - /** - * Returns true if input is a non-fungible token - */ - public isNonFungibleItem(id: BigNumber): ContractFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isBigNumber('id', id); - const functionSignature = 'isNonFungibleItem(uint256)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._evmExecAsync(this.getABIEncodedTransactionData()); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [id]); - }, - }; - } - public maxIndex(index_0: BigNumber): ContractFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isBigNumber('index_0', index_0); - const functionSignature = 'maxIndex(uint256)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [index_0]); - }, - }; - } - /** - * mints fungible tokens - * @param id token type - * @param to beneficiaries of minted tokens - * @param quantities amounts of minted tokens - */ - public mintFungible(id: BigNumber, to: string[], quantities: BigNumber[]): ContractTxFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isBigNumber('id', id); - assert.isArray('to', to); - assert.isArray('quantities', quantities); - const functionSignature = 'mintFungible(uint256,address[],uint256[])'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [id, to, quantities]); - }, - }; - } - /** - * mints a non-fungible token - * @param type_ token type - * @param to beneficiaries of minted tokens - */ - public mintNonFungible(type_: BigNumber, to: string[]): ContractTxFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isBigNumber('type_', type_); - assert.isArray('to', to); - const functionSignature = 'mintNonFungible(uint256,address[])'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [type_, to]); - }, - }; - } - /** - * returns owner of a non-fungible token - */ - public ownerOf(id: BigNumber): ContractFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isBigNumber('id', id); - const functionSignature = 'ownerOf(uint256)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [id]); - }, - }; - } - /** - * MUST emit TransferBatch event on success. Caller must be approved to manage the _from account's tokens (see isApprovedForAll). MUST throw if `_to` is the zero address. MUST throw if length of `_ids` is not the same as length of `_values`. MUST throw if any of the balance of sender for token `_ids` is lower than the respective `_values` sent. MUST throw on any other error. When transfer is complete, this function MUST check if `_to` is a smart contract (code size > 0). If so, it MUST call `onERC1155BatchReceived` on `_to` and revert if the return value is not `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`. - * @param from Source addresses - * @param to Target addresses - * @param ids IDs of each token type - * @param values Transfer amounts per token type - * @param data Additional data with no specified format, sent in call to `_to` - */ - public safeBatchTransferFrom( - from: string, - to: string, - ids: BigNumber[], - values: BigNumber[], - data: string, - ): ContractTxFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isString('from', from); - assert.isString('to', to); - assert.isArray('ids', ids); - assert.isArray('values', values); - assert.isString('data', data); - const functionSignature = 'safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [ - from.toLowerCase(), - to.toLowerCase(), - ids, - values, - data, - ]); - }, - }; - } - /** - * MUST emit TransferSingle event on success. Caller must be approved to manage the _from account's tokens (see isApprovedForAll). MUST throw if `_to` is the zero address. MUST throw if balance of sender for token `_id` is lower than the `_value` sent. MUST throw on any other error. When transfer is complete, this function MUST check if `_to` is a smart contract (code size > 0). If so, it MUST call `onERC1155Received` on `_to` and revert if the return value is not `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`. - * @param from Source address - * @param to Target address - * @param id ID of the token type - * @param value Transfer amount - * @param data Additional data with no specified format, sent in call to `_to` - */ - public safeTransferFrom( - from: string, - to: string, - id: BigNumber, - value: BigNumber, - data: string, - ): ContractTxFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isString('from', from); - assert.isString('to', to); - assert.isBigNumber('id', id); - assert.isBigNumber('value', value); - assert.isString('data', data); - const functionSignature = 'safeTransferFrom(address,address,uint256,uint256,bytes)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [ - from.toLowerCase(), - to.toLowerCase(), - id, - value, - data, - ]); - }, - }; - } - /** - * MUST emit the ApprovalForAll event on success. - * @param operator Address to add to the set of authorized operators - * @param approved True if the operator is approved, false to revoke approval - */ - public setApprovalForAll(operator: string, approved: boolean): ContractTxFunctionObj { - const self = (this as any) as ERC1155MintableContract; - assert.isString('operator', operator); - assert.isBoolean('approved', approved); - const functionSignature = 'setApprovalForAll(address,bool)'; - - return { - async sendTransactionAsync( - txData?: Partial | undefined, - opts: SendTransactionOpts = { shouldValidate: true }, - ): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( - { ...txData, data: this.getABIEncodedTransactionData() }, - this.estimateGasAsync.bind(this), - ); - if (opts.shouldValidate !== false) { - await this.callAsync(txDataWithDefaults); - } - return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - }, - awaitTransactionSuccessAsync( - txData?: Partial, - opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, - ): PromiseWithTransactionHash { - return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts); - }, - async estimateGasAsync(txData?: Partial | undefined): Promise { - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({ - ...txData, - data: this.getABIEncodedTransactionData(), - }); - return self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - }, - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [operator.toLowerCase(), approved]); - }, - }; - } - - /** - * Subscribe to an event type emitted by the ERC1155Mintable contract. - * @param eventName The ERC1155Mintable contract event you would like to subscribe to. - * @param indexFilterValues An object where the keys are indexed args returned by the event and - * the value is the value you are interested in. E.g `{maker: aUserAddressHex}` - * @param callback Callback that gets called when a log is added/removed - * @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered) - * @return Subscription token used later to unsubscribe - */ - public subscribe( - eventName: ERC1155MintableEvents, - indexFilterValues: IndexedFilterValues, - callback: EventCallback, - isVerbose: boolean = false, - blockPollingIntervalMs?: number, - ): string { - assert.doesBelongToStringEnum('eventName', eventName, ERC1155MintableEvents); - assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); - assert.isFunction('callback', callback); - const subscriptionToken = this._subscriptionManager.subscribe( - this.address, - eventName, - indexFilterValues, - ERC1155MintableContract.ABI(), - callback, - isVerbose, - blockPollingIntervalMs, - ); - return subscriptionToken; - } - /** - * Cancel a subscription - * @param subscriptionToken Subscription token returned by `subscribe()` - */ - public unsubscribe(subscriptionToken: string): void { - this._subscriptionManager.unsubscribe(subscriptionToken); - } - /** - * Cancels all existing subscriptions - */ - public unsubscribeAll(): void { - this._subscriptionManager.unsubscribeAll(); - } - /** - * Gets historical logs without creating a subscription - * @param eventName The ERC1155Mintable contract event you would like to subscribe to. - * @param blockRange Block range to get logs from. - * @param indexFilterValues An object where the keys are indexed args returned by the event and - * the value is the value you are interested in. E.g `{_from: aUserAddressHex}` - * @return Array of logs that match the parameters - */ - public async getLogsAsync( - eventName: ERC1155MintableEvents, - blockRange: BlockRange, - indexFilterValues: IndexedFilterValues, - ): Promise>> { - assert.doesBelongToStringEnum('eventName', eventName, ERC1155MintableEvents); - assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema); - assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema); - const logs = await this._subscriptionManager.getLogsAsync( - this.address, - eventName, - blockRange, - indexFilterValues, - ERC1155MintableContract.ABI(), - ); - return logs; - } - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - deployedBytecode: string | undefined = ERC1155MintableContract.deployedBytecode, - ) { - super( - 'ERC1155Mintable', - ERC1155MintableContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - deployedBytecode, - ); - classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); - this._subscriptionManager = new SubscriptionManager( - ERC1155MintableContract.ABI(), - this._web3Wrapper, - ); - ERC1155MintableContract.ABI().forEach((item, index) => { - if (item.type === 'function') { - const methodAbi = item as MethodAbi; - this._methodABIIndex[methodAbi.name] = index; - } - }); - } -} - -// 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/abi-gen-wrappers/src/generated-wrappers/i_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts deleted file mode 100644 index 7923f1478f..0000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts +++ /dev/null @@ -1,231 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma enum-naming -// tslint:disable:whitespace no-unbound-method no-trailing-whitespace -// tslint:disable:no-unused-variable -import { - AwaitTransactionSuccessOpts, - ContractFunctionObj, - ContractTxFunctionObj, - SendTransactionOpts, - BaseContract, - PromiseWithTransactionHash, - methodAbiToFunctionSignature, -} from '@0x/base-contract'; -import { schemas } from '@0x/json-schemas'; -import { - BlockParam, - BlockParamLiteral, - BlockRange, - CallData, - ContractAbi, - ContractArtifact, - DecodedLogArgs, - MethodAbi, - TransactionReceiptWithDecodedLogs, - TxData, - TxDataPayable, - SupportedProvider, -} from 'ethereum-types'; -import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { EventCallback, IndexedFilterValues, 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 IValidatorContract extends BaseContract { - /** - * @ignore - */ - public static deployedBytecode: string | undefined; - private readonly _methodABIIndex: { [name: string]: number } = {}; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - ): 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 IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractAbi }, - ): 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); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); - const iface = new ethers.utils.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToContractTxDataAsync( - { - 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(`IValidator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IValidatorContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = []; - return contractInstance; - } - - /** - * @returns The contract ABI - */ - public static ABI(): ContractAbi { - const abi = [ - { - constant: true, - inputs: [ - { - name: 'hash', - type: 'bytes32', - }, - { - name: 'signerAddress', - type: 'address', - }, - { - name: 'signature', - type: 'bytes', - }, - ], - name: 'isValidSignature', - outputs: [ - { - name: '', - type: 'bytes4', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - ] as ContractAbi; - return abi; - } - - public getFunctionSignature(methodName: string): string { - const index = this._methodABIIndex[methodName]; - const methodAbi = IValidatorContract.ABI()[index] as MethodAbi; // tslint:disable-line:no-unnecessary-type-assertion - const functionSignature = methodAbiToFunctionSignature(methodAbi); - return functionSignature; - } - public getABIDecodedTransactionData(methodName: string, callData: string): T { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as IValidatorContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - } - public getABIDecodedReturnData(methodName: string, callData: string): T { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as IValidatorContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - const abiDecodedCallData = abiEncoder.strictDecodeReturnValue(callData); - return abiDecodedCallData; - } - public getSelector(methodName: string): string { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as IValidatorContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.getSelector(); - } - - /** - * Verifies that a signature is valid. - * @param hash Message hash that is signed. - * @param signerAddress Address that should have signed the given hash. - * @param signature Proof of signing. - * @returns Magic bytes4 value if the signature is valid. Magic value is bytes4(keccak256("isValidValidatorSignature(address,bytes32,address,bytes)")) - */ - public isValidSignature(hash: string, signerAddress: string, signature: string): ContractFunctionObj { - const self = (this as any) as IValidatorContract; - assert.isString('hash', hash); - assert.isString('signerAddress', signerAddress); - assert.isString('signature', signature); - const functionSignature = 'isValidSignature(bytes32,address,bytes)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [hash, signerAddress.toLowerCase(), signature]); - }, - }; - } - - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - deployedBytecode: string | undefined = IValidatorContract.deployedBytecode, - ) { - super( - 'IValidator', - IValidatorContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - deployedBytecode, - ); - classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); - IValidatorContract.ABI().forEach((item, index) => { - if (item.type === 'function') { - const methodAbi = item as MethodAbi; - this._methodABIIndex[methodAbi.name] = index; - } - }); - } -} - -// 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/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts deleted file mode 100644 index 84a3815a4a..0000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts +++ /dev/null @@ -1,225 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma enum-naming -// tslint:disable:whitespace no-unbound-method no-trailing-whitespace -// tslint:disable:no-unused-variable -import { - AwaitTransactionSuccessOpts, - ContractFunctionObj, - ContractTxFunctionObj, - SendTransactionOpts, - BaseContract, - PromiseWithTransactionHash, - methodAbiToFunctionSignature, -} from '@0x/base-contract'; -import { schemas } from '@0x/json-schemas'; -import { - BlockParam, - BlockParamLiteral, - BlockRange, - CallData, - ContractAbi, - ContractArtifact, - DecodedLogArgs, - MethodAbi, - TransactionReceiptWithDecodedLogs, - TxData, - TxDataPayable, - SupportedProvider, -} from 'ethereum-types'; -import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { EventCallback, IndexedFilterValues, 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 IWalletContract extends BaseContract { - /** - * @ignore - */ - public static deployedBytecode: string | undefined; - private readonly _methodABIIndex: { [name: string]: number } = {}; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractArtifact | SimpleContractArtifact }, - ): 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 IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, logDecodeDependenciesAbiOnly); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - supportedProvider: SupportedProvider, - txDefaults: Partial, - logDecodeDependencies: { [contractName: string]: ContractAbi }, - ): 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); - [] = BaseContract._formatABIDataItemList(constructorAbi.inputs, [], BaseContract._bigNumberToString); - const iface = new ethers.utils.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToContractTxDataAsync( - { - 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(`IWallet successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IWalletContract( - txReceipt.contractAddress as string, - provider, - txDefaults, - logDecodeDependencies, - ); - contractInstance.constructorArgs = []; - return contractInstance; - } - - /** - * @returns The contract ABI - */ - public static ABI(): ContractAbi { - const abi = [ - { - constant: true, - inputs: [ - { - name: 'hash', - type: 'bytes32', - }, - { - name: 'signature', - type: 'bytes', - }, - ], - name: 'isValidSignature', - outputs: [ - { - name: 'magicValue', - type: 'bytes4', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - ] as ContractAbi; - return abi; - } - - public getFunctionSignature(methodName: string): string { - const index = this._methodABIIndex[methodName]; - const methodAbi = IWalletContract.ABI()[index] as MethodAbi; // tslint:disable-line:no-unnecessary-type-assertion - const functionSignature = methodAbiToFunctionSignature(methodAbi); - return functionSignature; - } - public getABIDecodedTransactionData(methodName: string, callData: string): T { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as IWalletContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - } - public getABIDecodedReturnData(methodName: string, callData: string): T { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as IWalletContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - const abiDecodedCallData = abiEncoder.strictDecodeReturnValue(callData); - return abiDecodedCallData; - } - public getSelector(methodName: string): string { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as IWalletContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.getSelector(); - } - - /** - * Validates a hash with the `Wallet` signature type. - * @param hash Message hash that is signed. - * @param signature Proof of signing. - * @returns magicValue `bytes4(0xb0671381)` if the signature check succeeds. - */ - public isValidSignature(hash: string, signature: string): ContractFunctionObj { - const self = (this as any) as IWalletContract; - assert.isString('hash', hash); - assert.isString('signature', signature); - const functionSignature = 'isValidSignature(bytes32,bytes)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [hash, signature]); - }, - }; - } - - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - deployedBytecode: string | undefined = IWalletContract.deployedBytecode, - ) { - super( - 'IWallet', - IWalletContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - deployedBytecode, - ); - classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); - IWalletContract.ABI().forEach((item, index) => { - if (item.type === 'function') { - const methodAbi = item as MethodAbi; - this._methodABIIndex[methodAbi.name] = index; - } - }); - } -} - -// 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/abi-gen-wrappers/src/generated-wrappers/order_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts deleted file mode 100644 index 5ee04254ef..0000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts +++ /dev/null @@ -1,1128 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma enum-naming -// tslint:disable:whitespace no-unbound-method no-trailing-whitespace -// tslint:disable:no-unused-variable -import { - AwaitTransactionSuccessOpts, - ContractFunctionObj, - ContractTxFunctionObj, - SendTransactionOpts, - BaseContract, - PromiseWithTransactionHash, - methodAbiToFunctionSignature, -} from '@0x/base-contract'; -import { schemas } from '@0x/json-schemas'; -import { - BlockParam, - BlockParamLiteral, - BlockRange, - CallData, - ContractAbi, - ContractArtifact, - DecodedLogArgs, - MethodAbi, - TransactionReceiptWithDecodedLogs, - TxData, - TxDataPayable, - SupportedProvider, -} from 'ethereum-types'; -import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { EventCallback, IndexedFilterValues, 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 OrderValidatorContract extends BaseContract { - /** - * @ignore - */ - public static deployedBytecode: string | undefined; - private readonly _methodABIIndex: { [name: string]: number } = {}; - 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 OrderValidatorContract.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._applyDefaultsToContractTxDataAsync( - { - 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(`OrderValidator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new OrderValidatorContract( - 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: '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: 'takerAddress', - type: 'address', - }, - ], - name: 'getOrderAndTraderInfo', - outputs: [ - { - name: 'orderInfo', - type: 'tuple', - components: [ - { - name: 'orderStatus', - type: 'uint8', - }, - { - name: 'orderHash', - type: 'bytes32', - }, - { - name: 'orderTakerAssetFilledAmount', - type: 'uint256', - }, - ], - }, - { - name: 'traderInfo', - type: 'tuple', - components: [ - { - name: 'makerBalance', - type: 'uint256', - }, - { - name: 'makerAllowance', - type: 'uint256', - }, - { - name: 'takerBalance', - type: 'uint256', - }, - { - name: 'takerAllowance', - type: 'uint256', - }, - { - name: 'makerZrxBalance', - type: 'uint256', - }, - { - name: 'makerZrxAllowance', - type: 'uint256', - }, - { - name: 'takerZrxBalance', - type: 'uint256', - }, - { - name: 'takerZrxAllowance', - type: 'uint256', - }, - ], - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'target', - type: 'address', - }, - { - name: 'assetData', - type: 'bytes', - }, - ], - name: 'getBalanceAndAllowance', - outputs: [ - { - name: 'balance', - type: 'uint256', - }, - { - name: 'allowance', - 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: 'takerAddresses', - type: 'address[]', - }, - ], - name: 'getOrdersAndTradersInfo', - outputs: [ - { - name: 'ordersInfo', - type: 'tuple[]', - components: [ - { - name: 'orderStatus', - type: 'uint8', - }, - { - name: 'orderHash', - type: 'bytes32', - }, - { - name: 'orderTakerAssetFilledAmount', - type: 'uint256', - }, - ], - }, - { - name: 'tradersInfo', - type: 'tuple[]', - components: [ - { - name: 'makerBalance', - type: 'uint256', - }, - { - name: 'makerAllowance', - type: 'uint256', - }, - { - name: 'takerBalance', - type: 'uint256', - }, - { - name: 'takerAllowance', - type: 'uint256', - }, - { - name: 'makerZrxBalance', - type: 'uint256', - }, - { - name: 'makerZrxAllowance', - type: 'uint256', - }, - { - name: 'takerZrxBalance', - type: 'uint256', - }, - { - name: 'takerZrxAllowance', - 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: 'takerAddresses', - type: 'address[]', - }, - ], - name: 'getTradersInfo', - outputs: [ - { - name: '', - type: 'tuple[]', - components: [ - { - name: 'makerBalance', - type: 'uint256', - }, - { - name: 'makerAllowance', - type: 'uint256', - }, - { - name: 'takerBalance', - type: 'uint256', - }, - { - name: 'takerAllowance', - type: 'uint256', - }, - { - name: 'makerZrxBalance', - type: 'uint256', - }, - { - name: 'makerZrxAllowance', - type: 'uint256', - }, - { - name: 'takerZrxBalance', - type: 'uint256', - }, - { - name: 'takerZrxAllowance', - type: 'uint256', - }, - ], - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'token', - type: 'address', - }, - { - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getERC721TokenOwner', - outputs: [ - { - name: 'owner', - type: 'address', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, - { - constant: true, - inputs: [ - { - name: 'target', - type: 'address', - }, - { - name: 'assetData', - type: 'bytes[]', - }, - ], - name: 'getBalancesAndAllowances', - outputs: [ - { - name: '', - type: 'uint256[]', - }, - { - name: '', - type: 'uint256[]', - }, - ], - payable: false, - stateMutability: 'view', - 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: 'takerAddress', - type: 'address', - }, - ], - name: 'getTraderInfo', - outputs: [ - { - name: 'traderInfo', - type: 'tuple', - components: [ - { - name: 'makerBalance', - type: 'uint256', - }, - { - name: 'makerAllowance', - type: 'uint256', - }, - { - name: 'takerBalance', - type: 'uint256', - }, - { - name: 'takerAllowance', - type: 'uint256', - }, - { - name: 'makerZrxBalance', - type: 'uint256', - }, - { - name: 'makerZrxAllowance', - type: 'uint256', - }, - { - name: 'takerZrxBalance', - type: 'uint256', - }, - { - name: 'takerZrxAllowance', - 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; - } - - public getFunctionSignature(methodName: string): string { - const index = this._methodABIIndex[methodName]; - const methodAbi = OrderValidatorContract.ABI()[index] as MethodAbi; // tslint:disable-line:no-unnecessary-type-assertion - const functionSignature = methodAbiToFunctionSignature(methodAbi); - return functionSignature; - } - public getABIDecodedTransactionData(methodName: string, callData: string): T { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as OrderValidatorContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - } - public getABIDecodedReturnData(methodName: string, callData: string): T { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as OrderValidatorContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - const abiDecodedCallData = abiEncoder.strictDecodeReturnValue(callData); - return abiDecodedCallData; - } - public getSelector(methodName: string): string { - const functionSignature = this.getFunctionSignature(methodName); - const self = (this as any) as OrderValidatorContract; - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.getSelector(); - } - - public getOrderAndTraderInfo( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - takerAddress: string, - ): ContractFunctionObj< - [ - { orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, - { - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - } - ] - > { - const self = (this as any) as OrderValidatorContract; - - assert.isString('takerAddress', takerAddress); - const functionSignature = - 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)'; - - return { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise< - [ - { orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, - { - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - } - ] - > { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue< - [ - { orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, - { - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - } - ] - >(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [order, takerAddress.toLowerCase()]); - }, - }; - } - public getBalanceAndAllowance(target: string, assetData: string): ContractFunctionObj<[BigNumber, BigNumber]> { - const self = (this as any) as OrderValidatorContract; - assert.isString('target', target); - assert.isString('assetData', assetData); - const functionSignature = 'getBalanceAndAllowance(address,bytes)'; - - return { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise<[BigNumber, BigNumber]> { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber]>(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [target.toLowerCase(), assetData]); - }, - }; - } - public getOrdersAndTradersInfo( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - takerAddresses: string[], - ): ContractFunctionObj< - [ - Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, - Array<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> - ] - > { - const self = (this as any) as OrderValidatorContract; - assert.isArray('orders', orders); - assert.isArray('takerAddresses', takerAddresses); - const functionSignature = - 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])'; - - return { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise< - [ - Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, - Array<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> - ] - > { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue< - [ - Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, - Array<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> - ] - >(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [orders, takerAddresses]); - }, - }; - } - public getTradersInfo( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }>, - takerAddresses: string[], - ): ContractFunctionObj< - Array<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> - > { - const self = (this as any) as OrderValidatorContract; - assert.isArray('orders', orders); - assert.isArray('takerAddresses', takerAddresses); - const functionSignature = - 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])'; - - return { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise< - Array<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> - > { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue< - Array<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> - >(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [orders, takerAddresses]); - }, - }; - } - public getERC721TokenOwner(token: string, tokenId: BigNumber): ContractFunctionObj { - const self = (this as any) as OrderValidatorContract; - assert.isString('token', token); - assert.isBigNumber('tokenId', tokenId); - const functionSignature = 'getERC721TokenOwner(address,uint256)'; - - return { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [token.toLowerCase(), tokenId]); - }, - }; - } - public getBalancesAndAllowances( - target: string, - assetData: string[], - ): ContractFunctionObj<[BigNumber[], BigNumber[]]> { - const self = (this as any) as OrderValidatorContract; - assert.isString('target', target); - assert.isArray('assetData', assetData); - const functionSignature = 'getBalancesAndAllowances(address,bytes[])'; - - return { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise<[BigNumber[], BigNumber[]]> { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]]>(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [target.toLowerCase(), assetData]); - }, - }; - } - public getTraderInfo( - order: { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }, - takerAddress: string, - ): ContractFunctionObj<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> { - const self = (this as any) as OrderValidatorContract; - - assert.isString('takerAddress', takerAddress); - const functionSignature = - 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)'; - - return { - async callAsync( - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> { - BaseContract._assertCallParams(callData, defaultBlock); - const rawCallResult = await self._performCallAsync( - { ...callData, data: this.getABIEncodedTransactionData() }, - defaultBlock, - ); - const abiEncoder = self._lookupAbiEncoder(functionSignature); - return abiEncoder.strictDecodeReturnValue<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }>(rawCallResult); - }, - getABIEncodedTransactionData(): string { - return self._strictEncodeArguments(functionSignature, [order, takerAddress.toLowerCase()]); - }, - }; - } - - constructor( - address: string, - supportedProvider: SupportedProvider, - txDefaults?: Partial, - logDecodeDependencies?: { [contractName: string]: ContractAbi }, - deployedBytecode: string | undefined = OrderValidatorContract.deployedBytecode, - ) { - super( - 'OrderValidator', - OrderValidatorContract.ABI(), - address, - supportedProvider, - txDefaults, - logDecodeDependencies, - deployedBytecode, - ); - classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']); - OrderValidatorContract.ABI().forEach((item, index) => { - if (item.type === 'function') { - const methodAbi = item as MethodAbi; - this._methodABIIndex[methodAbi.name] = index; - } - }); - } -} - -// 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/abi-gen-wrappers/src/index.ts b/packages/abi-gen-wrappers/src/index.ts deleted file mode 100644 index be9d79a8bd..0000000000 --- a/packages/abi-gen-wrappers/src/index.ts +++ /dev/null @@ -1,112 +0,0 @@ -export { DevUtilsContract } from './generated-wrappers/dev_utils'; -export { - DummyERC20TokenEventArgs, - DummyERC20TokenEvents, - DummyERC20TokenTransferEventArgs, - DummyERC20TokenApprovalEventArgs, - DummyERC20TokenContract, -} from './generated-wrappers/dummy_erc20_token'; -export { - DummyERC721TokenEventArgs, - DummyERC721TokenEvents, - DummyERC721TokenTransferEventArgs, - DummyERC721TokenApprovalEventArgs, - DummyERC721TokenApprovalForAllEventArgs, - DummyERC721TokenContract, -} from './generated-wrappers/dummy_erc721_token'; -export { - ERC1155MintableContract, - ERC1155MintableApprovalForAllEventArgs, - ERC1155MintableTransferBatchEventArgs, - ERC1155MintableTransferSingleEventArgs, - ERC1155MintableURIEventArgs, -} from './generated-wrappers/erc1155_mintable'; -export { - ERC20TokenEventArgs, - ERC20TokenEvents, - ERC20TokenTransferEventArgs, - ERC20TokenApprovalEventArgs, - ERC20TokenContract, -} from './generated-wrappers/erc20_token'; -export { - ERC721TokenEventArgs, - ERC721TokenEvents, - ERC721TokenTransferEventArgs, - ERC721TokenApprovalEventArgs, - ERC721TokenApprovalForAllEventArgs, - ERC721TokenContract, -} from './generated-wrappers/erc721_token'; -export { - ExchangeEventArgs, - ExchangeEvents, - ExchangeSignatureValidatorApprovalEventArgs, - ExchangeFillEventArgs, - ExchangeCancelEventArgs, - ExchangeCancelUpToEventArgs, - ExchangeAssetProxyRegisteredEventArgs, - ExchangeContract, - ExchangeProtocolFeeCollectorAddressEventArgs, - ExchangeProtocolFeeMultiplierEventArgs, - ExchangeTransactionExecutionEventArgs, -} from './generated-wrappers/exchange'; -export { ForwarderContract } from './generated-wrappers/forwarder'; -export { IValidatorContract } from './generated-wrappers/i_validator'; -export { IWalletContract } from './generated-wrappers/i_wallet'; -export { OrderValidatorContract } from './generated-wrappers/order_validator'; -export { - StakingAuthorizedAddressAddedEventArgs, - StakingAuthorizedAddressRemovedEventArgs, - StakingContract, - StakingEpochEndedEventArgs, - StakingEpochFinalizedEventArgs, - StakingEventArgs, - StakingEvents, - StakingExchangeAddedEventArgs, - StakingExchangeRemovedEventArgs, - StakingMakerStakingPoolSetEventArgs, - StakingMoveStakeEventArgs, - StakingOperatorShareDecreasedEventArgs, - StakingOwnershipTransferredEventArgs, - StakingParamsSetEventArgs, - StakingRewardsPaidEventArgs, - StakingStakeEventArgs, - StakingStakingPoolCreatedEventArgs, - StakingStakingPoolEarnedRewardsInEpochEventArgs, - StakingUnstakeEventArgs, -} from './generated-wrappers/staking'; -export { - StakingProxyAuthorizedAddressAddedEventArgs, - StakingProxyAuthorizedAddressRemovedEventArgs, - StakingProxyContract, - StakingProxyEventArgs, - StakingProxyEvents, - StakingProxyOwnershipTransferredEventArgs, - StakingProxyStakingContractAttachedToProxyEventArgs, - StakingProxyStakingContractDetachedFromProxyEventArgs, -} from './generated-wrappers/staking_proxy'; -export { - WETH9EventArgs, - WETH9Events, - WETH9ApprovalEventArgs, - WETH9TransferEventArgs, - WETH9DepositEventArgs, - WETH9WithdrawalEventArgs, - WETH9Contract, -} from './generated-wrappers/weth9'; -export { CoordinatorContract } from './generated-wrappers/coordinator'; -export { - CoordinatorRegistryEventArgs, - CoordinatorRegistryEvents, - CoordinatorRegistryCoordinatorEndpointSetEventArgs, - CoordinatorRegistryContract, -} from './generated-wrappers/coordinator_registry'; - -export * from '@0x/contract-addresses'; -export { - ContractEvent, - SendTransactionOpts, - AwaitTransactionSuccessOpts, - ContractFunctionObj, - ContractTxFunctionObj, - SubscriptionErrors, -} from '@0x/base-contract'; diff --git a/packages/abi-gen-wrappers/typedoc-tsconfig.json b/packages/abi-gen-wrappers/typedoc-tsconfig.json deleted file mode 100644 index a4c669cb6d..0000000000 --- a/packages/abi-gen-wrappers/typedoc-tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../../typedoc-tsconfig", - "compilerOptions": { - "outDir": "lib" - }, - "include": ["./src/**/*"] -} diff --git a/packages/asset-swapper/package.json b/packages/asset-swapper/package.json index 0182105318..55c36bc63c 100644 --- a/packages/asset-swapper/package.json +++ b/packages/asset-swapper/package.json @@ -42,7 +42,7 @@ "dependencies": { "@0x/assert": "^2.2.0-beta.2", "@0x/contract-addresses": "^3.3.0-beta.4", - "@0x/abi-gen-wrappers": "^5.4.0-beta.3", + "@0x/contract-wrappers": "^12.2.0-beta.3", "@0x/json-schemas": "^4.1.0-beta.2", "@0x/order-utils": "^8.5.0-beta.3", "@0x/orderbook": "^0.1.0-beta.3", diff --git a/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts b/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts index a657c960f6..a933d38596 100644 --- a/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts +++ b/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts @@ -1,5 +1,5 @@ -import { ExchangeContract } from '@0x/abi-gen-wrappers'; import { ContractAddresses } from '@0x/contract-addresses'; +import { ExchangeContract } from '@0x/contract-wrappers'; import { AbiEncoder, providerUtils } from '@0x/utils'; import { SupportedProvider, ZeroExProvider } from '@0x/web3-wrapper'; import { MethodAbi } from 'ethereum-types'; diff --git a/packages/asset-swapper/src/quote_consumers/forwarder_swap_quote_consumer.ts b/packages/asset-swapper/src/quote_consumers/forwarder_swap_quote_consumer.ts index 8c6f5c63f6..c9bab3be4f 100644 --- a/packages/asset-swapper/src/quote_consumers/forwarder_swap_quote_consumer.ts +++ b/packages/asset-swapper/src/quote_consumers/forwarder_swap_quote_consumer.ts @@ -1,5 +1,5 @@ -import { DevUtilsContract, ForwarderContract } from '@0x/abi-gen-wrappers'; import { ContractAddresses } from '@0x/contract-addresses'; +import { DevUtilsContract, ForwarderContract } from '@0x/contract-wrappers'; import { AbiEncoder, providerUtils } from '@0x/utils'; import { SupportedProvider, ZeroExProvider } from '@0x/web3-wrapper'; import { MethodAbi } from 'ethereum-types'; diff --git a/packages/asset-swapper/src/swap_quoter.ts b/packages/asset-swapper/src/swap_quoter.ts index bdb52786dd..217a49175a 100644 --- a/packages/asset-swapper/src/swap_quoter.ts +++ b/packages/asset-swapper/src/swap_quoter.ts @@ -1,5 +1,5 @@ -import { DevUtilsContract } from '@0x/abi-gen-wrappers'; import { ContractAddresses, getContractAddressesForChainOrThrow } from '@0x/contract-addresses'; +import { DevUtilsContract } from '@0x/contract-wrappers'; import { schemas } from '@0x/json-schemas'; import { SignedOrder } from '@0x/order-utils'; import { MeshOrderProviderOpts, Orderbook, SRAPollingOrderProviderOpts } from '@0x/orderbook'; diff --git a/packages/asset-swapper/src/utils/order_prune_utils.ts b/packages/asset-swapper/src/utils/order_prune_utils.ts index cf13432f40..ceec95a157 100644 --- a/packages/asset-swapper/src/utils/order_prune_utils.ts +++ b/packages/asset-swapper/src/utils/order_prune_utils.ts @@ -1,4 +1,4 @@ -import { DevUtilsContract } from '@0x/abi-gen-wrappers'; +import { DevUtilsContract } from '@0x/contract-wrappers'; import { orderCalculationUtils } from '@0x/order-utils'; import { OrderStatus, SignedOrder } from '@0x/types'; import * as _ from 'lodash'; diff --git a/packages/asset-swapper/src/utils/swap_quote_consumer_utils.ts b/packages/asset-swapper/src/utils/swap_quote_consumer_utils.ts index 90e714cfed..3eb2b04a09 100644 --- a/packages/asset-swapper/src/utils/swap_quote_consumer_utils.ts +++ b/packages/asset-swapper/src/utils/swap_quote_consumer_utils.ts @@ -1,5 +1,5 @@ -import { DevUtilsContract, WETH9Contract } from '@0x/abi-gen-wrappers'; import { ContractAddresses } from '@0x/contract-addresses'; +import { DevUtilsContract, WETH9Contract } from '@0x/contract-wrappers'; import { SignedOrder } from '@0x/types'; import { BigNumber } from '@0x/utils'; import { SupportedProvider, Web3Wrapper } from '@0x/web3-wrapper'; diff --git a/packages/asset-swapper/test/exchange_swap_quote_consumer_test.ts b/packages/asset-swapper/test/exchange_swap_quote_consumer_test.ts index 5e76393f15..a9d3c9bd0d 100644 --- a/packages/asset-swapper/test/exchange_swap_quote_consumer_test.ts +++ b/packages/asset-swapper/test/exchange_swap_quote_consumer_test.ts @@ -1,5 +1,5 @@ -import { DevUtilsContract, ERC20TokenContract, ExchangeContract } from '@0x/abi-gen-wrappers'; import { ContractAddresses } from '@0x/contract-addresses'; +import { DevUtilsContract, ERC20TokenContract, ExchangeContract } from '@0x/contract-wrappers'; import { constants as devConstants, OrderFactory } from '@0x/contracts-test-utils'; import { BlockchainLifecycle, tokenUtils } from '@0x/dev-utils'; import { migrateOnceAsync } from '@0x/migrations'; diff --git a/packages/asset-swapper/test/forwarder_swap_quote_consumer_test.ts b/packages/asset-swapper/test/forwarder_swap_quote_consumer_test.ts index 5fd5f63e51..00597cb65b 100644 --- a/packages/asset-swapper/test/forwarder_swap_quote_consumer_test.ts +++ b/packages/asset-swapper/test/forwarder_swap_quote_consumer_test.ts @@ -1,5 +1,5 @@ -import { DevUtilsContract, ERC20TokenContract, ForwarderContract } from '@0x/abi-gen-wrappers'; import { ContractAddresses } from '@0x/contract-addresses'; +import { DevUtilsContract, ERC20TokenContract, ForwarderContract } from '@0x/contract-wrappers'; import { constants as devConstants, OrderFactory } from '@0x/contracts-test-utils'; import { BlockchainLifecycle, tokenUtils } from '@0x/dev-utils'; import { migrateOnceAsync } from '@0x/migrations'; diff --git a/packages/asset-swapper/test/order_prune_utils_test.ts b/packages/asset-swapper/test/order_prune_utils_test.ts index c731f925b7..dea927eaf6 100644 --- a/packages/asset-swapper/test/order_prune_utils_test.ts +++ b/packages/asset-swapper/test/order_prune_utils_test.ts @@ -1,5 +1,5 @@ -import { DevUtilsContract, ERC20TokenContract, ExchangeContract } from '@0x/abi-gen-wrappers'; import { ContractAddresses } from '@0x/contract-addresses'; +import { DevUtilsContract, ERC20TokenContract, ExchangeContract } from '@0x/contract-wrappers'; import { constants as devConstants, getLatestBlockTimestampAsync, OrderFactory } from '@0x/contracts-test-utils'; import { BlockchainLifecycle, tokenUtils } from '@0x/dev-utils'; import { migrateOnceAsync } from '@0x/migrations'; diff --git a/packages/asset-swapper/test/swap_quote_consumer_utils_test.ts b/packages/asset-swapper/test/swap_quote_consumer_utils_test.ts index 8b96c0402c..5b9a294965 100644 --- a/packages/asset-swapper/test/swap_quote_consumer_utils_test.ts +++ b/packages/asset-swapper/test/swap_quote_consumer_utils_test.ts @@ -1,5 +1,5 @@ -import { DevUtilsContract, WETH9Contract } from '@0x/abi-gen-wrappers'; import { ContractAddresses } from '@0x/contract-addresses'; +import { DevUtilsContract, WETH9Contract } from '@0x/contract-wrappers'; import { constants as devConstants, OrderFactory } from '@0x/contracts-test-utils'; import { BlockchainLifecycle, tokenUtils } from '@0x/dev-utils'; import { migrateOnceAsync } from '@0x/migrations'; diff --git a/packages/contract-addresses/src/index.ts b/packages/contract-addresses/src/index.ts index 95f5808613..b91ee25e83 100644 --- a/packages/contract-addresses/src/index.ts +++ b/packages/contract-addresses/src/index.ts @@ -12,8 +12,6 @@ export interface ContractAddresses { assetProxyOwner: string; zeroExGovernor: string; forwarder: string; - orderValidator: string; - dutchAuction: string; coordinatorRegistry: string; coordinator: string; multiAssetProxy: string; diff --git a/packages/contract-artifacts/README.md b/packages/contract-artifacts/README.md index 5a382c3081..1467fc496d 100644 --- a/packages/contract-artifacts/README.md +++ b/packages/contract-artifacts/README.md @@ -65,3 +65,12 @@ yarn lint ```bash yarn test ``` + +### Development + +This package needs to be updated manually when deploying a new contract. +Post-deployment workflow: + +1. Update `@0x/contract-addresses` +2. Copy the contract artifact into `@0x/contract-artifacts`. If updating all the artifacts at once, you can use `yarn artifacts_update`. If manually coping an artifact, make sure to use `yarn artifacts_transform` to remove unwanted fields. +3. Regenerate the wrappers. `cd ../contract-wrappers && yarn rebuild` diff --git a/packages/contract-artifacts/src/index.ts b/packages/contract-artifacts/src/index.ts index 9b565b5f11..c64a9c1255 100644 --- a/packages/contract-artifacts/src/index.ts +++ b/packages/contract-artifacts/src/index.ts @@ -4,7 +4,6 @@ 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'; import * as ERC1155Mintable from '../artifacts/ERC1155Mintable.json'; import * as ERC1155Proxy from '../artifacts/ERC1155Proxy.json'; import * as ERC20Proxy from '../artifacts/ERC20Proxy.json'; @@ -17,7 +16,6 @@ import * as IAssetProxy from '../artifacts/IAssetProxy.json'; import * as IValidator from '../artifacts/IValidator.json'; import * as IWallet from '../artifacts/IWallet.json'; import * as MultiAssetProxy from '../artifacts/MultiAssetProxy.json'; -import * as OrderValidator from '../artifacts/OrderValidator.json'; import * as Staking from '../artifacts/Staking.json'; import * as StakingProxy from '../artifacts/StakingProxy.json'; import * as StaticCallProxy from '../artifacts/StaticCallProxy.json'; @@ -28,7 +26,6 @@ import * as ZrxVault from '../artifacts/ZrxVault.json'; export { AssetProxyOwner, - DutchAuction, DevUtils, DummyERC20Token, DummyERC721Token, @@ -45,7 +42,6 @@ export { IValidator, IWallet, MultiAssetProxy, - OrderValidator, StaticCallProxy, WETH9, ZRXToken, diff --git a/packages/abi-gen-wrappers/.npmignore b/packages/contract-wrappers-test/.npmignore similarity index 100% rename from packages/abi-gen-wrappers/.npmignore rename to packages/contract-wrappers-test/.npmignore diff --git a/packages/contract-wrappers/coverage/.gitkeep b/packages/contract-wrappers-test/coverage/.gitkeep similarity index 100% rename from packages/contract-wrappers/coverage/.gitkeep rename to packages/contract-wrappers-test/coverage/.gitkeep diff --git a/packages/contract-wrappers-test/package.json b/packages/contract-wrappers-test/package.json new file mode 100644 index 0000000000..b5eb987b5c --- /dev/null +++ b/packages/contract-wrappers-test/package.json @@ -0,0 +1,57 @@ +{ + "name": "@0x/contract-wrappers-test", + "version": "12.2.0-beta.3", + "engines": { + "node": ">=6.12" + }, + "description": "Tests for @0x/contract-wrappers", + "directories": { + "test": "test" + }, + "scripts": { + "build": "tsc -b", + "build:ci": "yarn build", + "lint": "tslint --format stylish --project . --exclude **/lib/**/*", + "fix": "tslint --fix --format stylish --project .--exclude **/lib/**/*", + "test:circleci": "run-s test:coverage", + "test": "yarn run_mocha", + "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", + "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", + "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", + "prettier": "prettier --write **/* --config ../../.prettierrc", + "clean": "shx rm -rf lib" + }, + "repository": { + "type": "git", + "url": "https://github.com/0xProject/0x-monorepo.git" + }, + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/0xProject/0x-monorepo/issues" + }, + "homepage": "https://github.com/0xProject/0x-monorepo/packages/contract-wrappers-test/README.md", + "devDependencies": { + "@0x/contract-wrappers": "^12.2.0-beta.3", + "@0x/contracts-test-utils": "^3.2.0-beta.3", + "@0x/dev-utils": "^2.4.0-beta.3", + "@0x/migrations": "^4.4.0-beta.3", + "@0x/order-utils": "^8.5.0-beta.3", + "@0x/subproviders": "^5.1.0-beta.2", + "@0x/ts-doc-gen": "^0.0.22", + "@0x/tslint-config": "^3.1.0-beta.2", + "@0x/types": "^2.5.0-beta.2", + "@0x/utils": "^4.6.0-beta.2", + "@0x/web3-wrapper": "^6.1.0-beta.2", + "@types/nock": "^10.0.3", + "chai": "^4.0.1", + "dirty-chai": "^2.0.1", + "mocha": "^6.2.0", + "shx": "^0.2.2", + "tslint": "5.11.0", + "typescript": "3.0.1" + }, + "private": true, + "publishConfig": { + "access": "private" + } +} diff --git a/packages/contract-wrappers/test/calldata_decoder_test.ts b/packages/contract-wrappers-test/test/calldata_decoder_test.ts similarity index 84% rename from packages/contract-wrappers/test/calldata_decoder_test.ts rename to packages/contract-wrappers-test/test/calldata_decoder_test.ts index 9afe43e3be..ce6a9c7499 100644 --- a/packages/contract-wrappers/test/calldata_decoder_test.ts +++ b/packages/contract-wrappers-test/test/calldata_decoder_test.ts @@ -4,10 +4,9 @@ import { migrateOnceAsync } from '@0x/migrations'; import { SignedOrder } from '@0x/types'; import { addressUtils, BigNumber } from '@0x/utils'; import * as chai from 'chai'; -import * as _ from 'lodash'; import 'mocha'; -import { ContractAddresses, ContractWrappers } from '../src'; +import { ContractAddresses, ContractWrappers } from '@0x/contract-wrappers'; import { chaiSetup } from './utils/chai_setup'; import { provider, web3Wrapper } from './utils/web3_wrapper'; @@ -112,24 +111,7 @@ describe('ABI Decoding Calldata', () => { }); describe('decode', () => { - // TODO (xianny): dutch auction contract is broken, revisit when it is fixed - it.skip('should successfully decode DutchAuction.matchOrders calldata', async () => { - const contractName = 'DutchAuction'; - const decodedTxData = contractWrappers - .getAbiDecoder() - .decodeCalldataOrThrow(matchOrdersTxData, contractName); - const expectedFunctionName = 'matchOrders'; - const expectedFunctionArguments = { - buyOrder: orderLeft, - sellOrder: orderRight, - buySignature: signedOrderLeft.signature, - sellSignature: signedOrderRight.signature, - }; - expect(decodedTxData.functionName).to.be.equal(expectedFunctionName); - expect(decodedTxData.functionSignature).to.be.equal(matchOrdersSignature); - expect(decodedTxData.functionArguments).to.be.deep.equal(expectedFunctionArguments); - }); - it('should successfully decode Exchange.matchOrders calldata (and distinguish from DutchAuction.matchOrders)', async () => { + it('should successfully decode Exchange.matchOrders calldata', async () => { const contractName = 'Exchange'; const decodedTxData = contractWrappers .getAbiDecoder() diff --git a/packages/contract-wrappers/test/global_hooks.ts b/packages/contract-wrappers-test/test/global_hooks.ts similarity index 100% rename from packages/contract-wrappers/test/global_hooks.ts rename to packages/contract-wrappers-test/test/global_hooks.ts diff --git a/packages/contract-wrappers/test/utils/chai_setup.ts b/packages/contract-wrappers-test/test/utils/chai_setup.ts similarity index 100% rename from packages/contract-wrappers/test/utils/chai_setup.ts rename to packages/contract-wrappers-test/test/utils/chai_setup.ts diff --git a/packages/contract-wrappers/test/utils/constants.ts b/packages/contract-wrappers-test/test/utils/constants.ts similarity index 100% rename from packages/contract-wrappers/test/utils/constants.ts rename to packages/contract-wrappers-test/test/utils/constants.ts diff --git a/packages/contract-wrappers/test/utils/web3_wrapper.ts b/packages/contract-wrappers-test/test/utils/web3_wrapper.ts similarity index 100% rename from packages/contract-wrappers/test/utils/web3_wrapper.ts rename to packages/contract-wrappers-test/test/utils/web3_wrapper.ts diff --git a/packages/abi-gen-wrappers/tsconfig.json b/packages/contract-wrappers-test/tsconfig.json similarity index 60% rename from packages/abi-gen-wrappers/tsconfig.json rename to packages/contract-wrappers-test/tsconfig.json index 233008d61c..03390d35cc 100644 --- a/packages/abi-gen-wrappers/tsconfig.json +++ b/packages/contract-wrappers-test/tsconfig.json @@ -4,5 +4,6 @@ "outDir": "lib", "rootDir": "." }, - "include": ["./src/**/*"] + "include": ["./src/**/*", "./test/**/*"], + "exclude": ["node_modules"] } diff --git a/packages/abi-gen-wrappers/tslint.json b/packages/contract-wrappers-test/tslint.json similarity index 100% rename from packages/abi-gen-wrappers/tslint.json rename to packages/contract-wrappers-test/tslint.json diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index 90985b1883..d9f7832114 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -1,4 +1,12 @@ [ + { + "version": "12.2.0-beta.4", + "changes": [ + { + "note": "Remove dependency on `abi-gen-wrappers`" + } + ] + }, { "version": "12.2.0-beta.3", "changes": [ diff --git a/packages/contract-wrappers/README.md b/packages/contract-wrappers/README.md index 0ab599a249..77b1daa7c5 100644 --- a/packages/contract-wrappers/README.md +++ b/packages/contract-wrappers/README.md @@ -75,3 +75,7 @@ yarn test Documentation for this package is generated by TypeDoc, using the Solidity source code for 0x contracts. Each contract corresponds to one global-level module, which contains relevant enums and interfaces for its events and structs. Most significantly, each module exports a class, `Contract`, e.g. `ExchangeContract`, which implements helper methods for all the functions defined in the corresponding contract. A convention to note is that these contract-specific helper methods are defined as _object literals_, which are separated from methods in the generated documentation. Each contract method has a number of sub-methods, e.g. `sendTransactionAsync`, or `estimateGasAsync`, which are documented separately. This is an example of an expected method call signature: `exchangeContractInstance.fillOrder.sendTransactionAsync(...arguments)`. + +### Development + +This package contains generated code. We use the `abi-gen` utility to generate wrappers from compiler artifacts in `@0x/contract-artifacts`. To re-generate wrappers, e.g. when `@0x/contract-artifacts` has been updated, run `yarn wrappers:generate && yarn wrappers:prettier`. diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index 08836ae14b..44c0fd5dd1 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -13,26 +13,25 @@ ], "main": "lib/src/index.js", "types": "lib/src/index.d.ts", - "directories": { - "test": "test" - }, "scripts": { "build": "tsc -b", + "rebuild": "yarn wrappers:clean && yarn wrappers:generate && yarn wrappers:prettier && yarn build", "build:ci": "yarn build", "lint": "tslint --format stylish --project . --exclude **/lib/**/*", "fix": "tslint --fix --format stylish --project .--exclude **/lib/**/*", - "test:circleci": "run-s test:coverage", - "test": "yarn run_mocha", - "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", - "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", - "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "prettier": "prettier --write **/* --config ../../.prettierrc", "clean": "shx rm -rf lib generated_docs", "docs_test": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --out generated_docs ./src/generated-wrappers/*", "diff_docs": "git diff --exit-code ./docs", "s3:sync_md_docs": "aws s3 sync ./docs s3://docs-markdown/${npm_package_name}/v${npm_package_version} --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers", "docs:md": "ts-doc-gen --sourceDir='$PROJECT_FILES' --output=$MD_FILE_DIR --fileExtension=mdx --tsconfig=./typedoc-tsconfig.json", - "docs:json": "typedoc --excludePrivate --excludeExternals --excludeProtected --ignoreCompilerErrors --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES" + "docs:json": "typedoc --excludePrivate --excludeExternals --excludeProtected --ignoreCompilerErrors --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES", + "wrappers:prettier": "prettier --write src/generated-wrappers/* --config ../../.prettierrc", + "wrappers:clean": "rm -rf src/generated-wrappers", + "wrappers:generate": "abi-gen --abis ${npm_package_config_abis} --output src/generated-wrappers --backend ethers" + }, + "config": { + "abis": "../contract-artifacts/artifacts/@(DevUtils|ERC20Token|ERC721Token|Exchange|Forwarder|WETH9|Coordinator|Staking|StakingProxy).json" }, "repository": { "type": "git", @@ -44,37 +43,22 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/contract-wrappers/README.md", "devDependencies": { - "@0x/assert": "^2.2.0-beta.2", - "@0x/contracts-test-utils": "^3.2.0-beta.3", - "@0x/coordinator-server": "^0.1.3", - "@0x/dev-utils": "^2.4.0-beta.3", - "@0x/json-schemas": "^4.1.0-beta.2", - "@0x/migrations": "^4.4.0-beta.3", - "@0x/subproviders": "^5.1.0-beta.2", "@0x/ts-doc-gen": "^0.0.22", "@0x/tslint-config": "^3.1.0-beta.2", - "@0x/types": "^2.5.0-beta.2", - "@0x/utils": "^4.6.0-beta.2", - "@0x/web3-wrapper": "^6.1.0-beta.2", - "@types/nock": "^10.0.3", - "chai": "^4.0.1", - "chai-as-promised": "^7.1.0", - "chai-bignumber": "^3.0.0", - "dirty-chai": "^2.0.1", - "ethereum-types": "^2.2.0-beta.2", - "lodash": "^4.17.11", - "mocha": "^6.2.0", - "shx": "^0.2.2", "tslint": "5.11.0", "typedoc": "^0.15.0", "typescript": "3.0.1" }, "dependencies": { - "@0x/abi-gen-wrappers": "^5.4.0-beta.3", + "@0x/assert": "^2.2.0-beta.2", "@0x/base-contract": "^5.5.0-beta.3", "@0x/contract-addresses": "^3.3.0-beta.4", "@0x/contract-artifacts": "^2.3.0-beta.3", - "@0x/order-utils": "^8.5.0-beta.3", + "@0x/json-schemas": "^4.1.0-beta.2", + "@0x/types": "^2.5.0-beta.2", + "@0x/utils": "^4.6.0-beta.2", + "@0x/web3-wrapper": "^6.1.0-beta.2", + "ethereum-types": "^2.2.0-beta.2", "ethers": "~4.0.4" }, "publishConfig": { diff --git a/packages/contract-wrappers/src/contract_wrappers.ts b/packages/contract-wrappers/src/contract_wrappers.ts index 725f4ff0fd..42a351caca 100644 --- a/packages/contract-wrappers/src/contract_wrappers.ts +++ b/packages/contract-wrappers/src/contract_wrappers.ts @@ -1,30 +1,28 @@ -import { - CoordinatorContract, - DevUtilsContract, - ExchangeContract, - ForwarderContract, - OrderValidatorContract, - WETH9Contract, -} from '@0x/abi-gen-wrappers'; import { assert } from '@0x/assert'; import { ContractAddresses } from '@0x/contract-addresses'; import { Coordinator, DevUtils, - DutchAuction, ERC20Token, ERC721Token, Exchange, Forwarder, - OrderValidator, + Staking, + StakingProxy, WETH9, } from '@0x/contract-artifacts'; import { AbiDecoder } from '@0x/utils'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { SupportedProvider } from 'ethereum-types'; -import * as _ from 'lodash'; import { ContractWrappersConfigSchema } from './contract_wrappers_config_schema'; +import { CoordinatorContract } from './generated-wrappers/coordinator'; +import { DevUtilsContract } from './generated-wrappers/dev_utils'; +import { ExchangeContract } from './generated-wrappers/exchange'; +import { ForwarderContract } from './generated-wrappers/forwarder'; +import { StakingContract } from './generated-wrappers/staking'; +import { WETH9Contract } from './generated-wrappers/weth9'; + import { ContractWrappersConfig } from './types'; import { _getDefaultContractAddresses } from './utils/contract_addresses'; @@ -49,11 +47,6 @@ export class ContractWrappers { * An instance of the ForwarderContract class containing methods for interacting with any Forwarder smart contract. */ public forwarder: ForwarderContract; - // TODO(fabio): Remove orderValidator after @0x/asset-buyer is deleted - /** - * An instance of the OrderValidatorContract class containing methods for interacting with any OrderValidator smart contract. - */ - public orderValidator: OrderValidatorContract; /** * An instance of the DevUtilsContract class containing methods for interacting with the DevUtils smart contract. */ @@ -62,6 +55,10 @@ export class ContractWrappers { * An instance of the CoordinatorContract class containing methods for interacting with the Coordinator extension contract. */ public coordinator: CoordinatorContract; + /** + * An instance of the StakingContract class containing methods for interacting with the Coordinator extension contract. + */ + public staking: StakingContract; private readonly _web3Wrapper: Web3Wrapper; /** @@ -80,15 +77,15 @@ export class ContractWrappers { const artifactsArray = [ Coordinator, DevUtils, - DutchAuction, ERC20Token, ERC721Token, Exchange, Forwarder, - OrderValidator, + Staking, + StakingProxy, WETH9, ]; - _.forEach(artifactsArray, artifact => { + artifactsArray.forEach(artifact => { this._web3Wrapper.abiDecoder.addABI(artifact.compilerOutput.abi, artifact.contractName); }); const contractAddresses = @@ -98,7 +95,7 @@ export class ContractWrappers { this.weth9 = new WETH9Contract(contractAddresses.etherToken, this.getProvider()); this.exchange = new ExchangeContract(contractAddresses.exchange, this.getProvider()); this.forwarder = new ForwarderContract(contractAddresses.forwarder, this.getProvider()); - this.orderValidator = new OrderValidatorContract(contractAddresses.orderValidator, this.getProvider()); + this.staking = new StakingContract(contractAddresses.stakingProxy, this.getProvider()); this.devUtils = new DevUtilsContract(contractAddresses.devUtils, this.getProvider()); this.coordinator = new CoordinatorContract(contractAddresses.coordinator, this.getProvider()); this.contractAddresses = contractAddresses; diff --git a/packages/contract-wrappers/src/contract_wrappers_config_schema.ts b/packages/contract-wrappers/src/contract_wrappers_config_schema.ts index b12d5123b1..95e992144c 100644 --- a/packages/contract-wrappers/src/contract_wrappers_config_schema.ts +++ b/packages/contract-wrappers/src/contract_wrappers_config_schema.ts @@ -15,7 +15,7 @@ export const ContractWrappersConfigSchema = { exchange: { $ref: '/addressSchema' }, assetProxyOwner: { $ref: '/addressSchema' }, forwarder: { $ref: '/addressSchema' }, - orderValidator: { $ref: '/addressSchema' }, + staking: { $ref: '/addressSchema' }, }, }, blockPollingIntervalMs: { type: 'number' }, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts b/packages/contract-wrappers/src/generated-wrappers/coordinator.ts similarity index 100% rename from packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts rename to packages/contract-wrappers/src/generated-wrappers/coordinator.ts diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dev_utils.ts b/packages/contract-wrappers/src/generated-wrappers/dev_utils.ts similarity index 100% rename from packages/abi-gen-wrappers/src/generated-wrappers/dev_utils.ts rename to packages/contract-wrappers/src/generated-wrappers/dev_utils.ts diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts b/packages/contract-wrappers/src/generated-wrappers/erc20_token.ts similarity index 100% rename from packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts rename to packages/contract-wrappers/src/generated-wrappers/erc20_token.ts diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts b/packages/contract-wrappers/src/generated-wrappers/erc721_token.ts similarity index 100% rename from packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts rename to packages/contract-wrappers/src/generated-wrappers/erc721_token.ts diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/contract-wrappers/src/generated-wrappers/exchange.ts similarity index 100% rename from packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts rename to packages/contract-wrappers/src/generated-wrappers/exchange.ts diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts b/packages/contract-wrappers/src/generated-wrappers/forwarder.ts similarity index 100% rename from packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts rename to packages/contract-wrappers/src/generated-wrappers/forwarder.ts diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/staking.ts b/packages/contract-wrappers/src/generated-wrappers/staking.ts similarity index 100% rename from packages/abi-gen-wrappers/src/generated-wrappers/staking.ts rename to packages/contract-wrappers/src/generated-wrappers/staking.ts diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/staking_proxy.ts b/packages/contract-wrappers/src/generated-wrappers/staking_proxy.ts similarity index 100% rename from packages/abi-gen-wrappers/src/generated-wrappers/staking_proxy.ts rename to packages/contract-wrappers/src/generated-wrappers/staking_proxy.ts diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts b/packages/contract-wrappers/src/generated-wrappers/weth9.ts similarity index 100% rename from packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts rename to packages/contract-wrappers/src/generated-wrappers/weth9.ts diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index 8134407d09..d4d9d22436 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -1,7 +1,22 @@ export { ContractAddresses } from '@0x/contract-addresses'; export { ContractWrappers } from './contract_wrappers'; - +export { DevUtilsContract } from './generated-wrappers/dev_utils'; +export { + ERC20TokenEventArgs, + ERC20TokenEvents, + ERC20TokenTransferEventArgs, + ERC20TokenApprovalEventArgs, + ERC20TokenContract, +} from './generated-wrappers/erc20_token'; +export { + ERC721TokenEventArgs, + ERC721TokenEvents, + ERC721TokenTransferEventArgs, + ERC721TokenApprovalEventArgs, + ERC721TokenApprovalForAllEventArgs, + ERC721TokenContract, +} from './generated-wrappers/erc721_token'; export { ExchangeEventArgs, ExchangeEvents, @@ -11,15 +26,12 @@ export { ExchangeCancelUpToEventArgs, ExchangeAssetProxyRegisteredEventArgs, ExchangeContract, - DevUtilsContract, - ForwarderContract, - CoordinatorContract, - CoordinatorRegistryEventArgs, - CoordinatorRegistryEvents, - CoordinatorRegistryCoordinatorEndpointSetEventArgs, - CoordinatorRegistryContract, - IValidatorContract, - IWalletContract, + ExchangeProtocolFeeCollectorAddressEventArgs, + ExchangeProtocolFeeMultiplierEventArgs, + ExchangeTransactionExecutionEventArgs, +} from './generated-wrappers/exchange'; +export { ForwarderContract } from './generated-wrappers/forwarder'; +export { WETH9EventArgs, WETH9Events, WETH9ApprovalEventArgs, @@ -27,36 +39,40 @@ export { WETH9DepositEventArgs, WETH9WithdrawalEventArgs, WETH9Contract, - ERC20TokenEventArgs, - ERC20TokenEvents, - ERC20TokenTransferEventArgs, - ERC20TokenApprovalEventArgs, - ERC20TokenContract, - ERC721TokenEventArgs, - ERC721TokenEvents, - ERC721TokenTransferEventArgs, - ERC721TokenApprovalEventArgs, - ERC721TokenApprovalForAllEventArgs, - ERC721TokenContract, - DummyERC20TokenEventArgs, - DummyERC20TokenEvents, - DummyERC20TokenTransferEventArgs, - DummyERC20TokenApprovalEventArgs, - DummyERC20TokenContract, - DummyERC721TokenEventArgs, - DummyERC721TokenEvents, - DummyERC721TokenTransferEventArgs, - DummyERC721TokenApprovalEventArgs, - DummyERC721TokenApprovalForAllEventArgs, - DummyERC721TokenContract, - OrderValidatorContract, - ExchangeProtocolFeeCollectorAddressEventArgs, - ExchangeProtocolFeeMultiplierEventArgs, - ExchangeTransactionExecutionEventArgs, -} from '@0x/abi-gen-wrappers'; - +} from './generated-wrappers/weth9'; +export { CoordinatorContract } from './generated-wrappers/coordinator'; export { OrderStatus, ContractError, ForwarderError, ContractWrappersConfig, OrderInfo } from './types'; - +export { + StakingAuthorizedAddressAddedEventArgs, + StakingAuthorizedAddressRemovedEventArgs, + StakingContract, + StakingEpochEndedEventArgs, + StakingEpochFinalizedEventArgs, + StakingEventArgs, + StakingEvents, + StakingExchangeAddedEventArgs, + StakingExchangeRemovedEventArgs, + StakingMakerStakingPoolSetEventArgs, + StakingMoveStakeEventArgs, + StakingOperatorShareDecreasedEventArgs, + StakingOwnershipTransferredEventArgs, + StakingParamsSetEventArgs, + StakingRewardsPaidEventArgs, + StakingStakeEventArgs, + StakingStakingPoolCreatedEventArgs, + StakingStakingPoolEarnedRewardsInEpochEventArgs, + StakingUnstakeEventArgs, +} from './generated-wrappers/staking'; +export { + StakingProxyAuthorizedAddressAddedEventArgs, + StakingProxyAuthorizedAddressRemovedEventArgs, + StakingProxyContract, + StakingProxyEventArgs, + StakingProxyEvents, + StakingProxyOwnershipTransferredEventArgs, + StakingProxyStakingContractAttachedToProxyEventArgs, + StakingProxyStakingContractDetachedFromProxyEventArgs, +} from './generated-wrappers/staking_proxy'; export { BlockRange, SupportedProvider, @@ -125,8 +141,10 @@ export { export { AbiDecoder, DecodedCalldata } from '@0x/utils'; export { - AwaitTransactionSuccessOpts, + ContractEvent, SendTransactionOpts, + AwaitTransactionSuccessOpts, ContractFunctionObj, ContractTxFunctionObj, + SubscriptionErrors, } from '@0x/base-contract'; diff --git a/packages/contract-wrappers/src/utils/contract_addresses.ts b/packages/contract-wrappers/src/utils/contract_addresses.ts index 443bbd3f0e..43af03443d 100644 --- a/packages/contract-wrappers/src/utils/contract_addresses.ts +++ b/packages/contract-wrappers/src/utils/contract_addresses.ts @@ -1,5 +1,4 @@ import { ChainId, ContractAddresses, getContractAddressesForChainOrThrow } from '@0x/contract-addresses'; -import * as _ from 'lodash'; /** * Returns the default contract addresses for the given chainId or throws with diff --git a/packages/contract-wrappers/test/utils/token_utils.ts b/packages/contract-wrappers/test/utils/token_utils.ts deleted file mode 100644 index cf98bddb6a..0000000000 --- a/packages/contract-wrappers/test/utils/token_utils.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { generatePseudoRandomSalt } from '@0x/order-utils'; -import { BigNumber } from '@0x/utils'; - -import { DummyERC721TokenContract } from '../../src/index'; - -import { provider, txDefaults, web3Wrapper } from './web3_wrapper'; - -// Those addresses come from migrations. They're deterministic so it's relatively safe to hard-code them here. -// Before we were fetching them from the TokenRegistry but now we can't as it's deprecated and removed. -// TODO(albrow): Import these from the migrations package instead of hard-coding them. -const DUMMY_ERC_20_ADRESSES = [ - '0x34d402f14d58e001d8efbe6585051bf9706aa064', - '0x25b8fe1de9daf8ba351890744ff28cf7dfa8f5e3', - '0xcdb594a32b1cc3479d8746279712c39d18a07fc0', - '0x1e2f9e10d02a6b8f8f69fcbf515e75039d2ea30d', - '0xbe0037eaf2d64fe5529bca93c18c9702d3930376', -]; - -const DUMMY_ERC_721_ADRESSES = ['0x07f96aa816c1f244cbc6ef114bb2b023ba54a2eb']; - -export const tokenUtils = { - getDummyERC20TokenAddresses(): string[] { - return DUMMY_ERC_20_ADRESSES; - }, - getDummyERC721TokenAddresses(): string[] { - return DUMMY_ERC_721_ADRESSES; - }, - async mintDummyERC721Async(address: string, tokenOwner: string): Promise { - const erc721 = new DummyERC721TokenContract(address, provider, txDefaults); - const tokenId = generatePseudoRandomSalt(); - const txHash = await erc721.mint(tokenOwner, tokenId).sendTransactionAsync(); - web3Wrapper.awaitTransactionSuccessAsync(txHash); - return tokenId; - }, -}; diff --git a/packages/migrations/package.json b/packages/migrations/package.json index 8fd18c63b8..07988fbf2b 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -61,7 +61,6 @@ "yargs": "^10.0.3" }, "dependencies": { - "@0x/abi-gen-wrappers": "^5.4.0-beta.3", "@0x/base-contract": "^5.5.0-beta.3", "@0x/contract-addresses": "^3.3.0-beta.4", "@0x/contract-artifacts": "^2.3.0-beta.3", diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts index 65b773518f..beef50c7dc 100644 --- a/packages/migrations/src/migration.ts +++ b/packages/migrations/src/migration.ts @@ -286,8 +286,6 @@ export async function runMigrationsAsync( erc20BridgeProxy: erc20BridgeProxy.address, zeroExGovernor: constants.NULL_ADDRESS, forwarder: forwarder.address, - orderValidator: constants.NULL_ADDRESS, - dutchAuction: constants.NULL_ADDRESS, coordinatorRegistry: coordinatorRegistry.address, coordinator: coordinator.address, multiAssetProxy: multiAssetProxy.address, diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index a07b42e0ee..5eb281d4ae 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -63,10 +63,10 @@ "web3-provider-engine": "14.0.6" }, "dependencies": { - "@0x/abi-gen-wrappers": "^5.4.0-beta.3", "@0x/assert": "^2.2.0-beta.2", "@0x/contract-addresses": "^3.3.0-beta.4", "@0x/contract-artifacts": "^2.3.0-beta.3", + "@0x/contract-wrappers": "^12.2.0-beta.3", "@0x/json-schemas": "^4.1.0-beta.2", "@0x/utils": "^4.6.0-beta.2", "@0x/web3-wrapper": "^6.1.0-beta.2", diff --git a/packages/order-utils/src/eip712_utils.ts b/packages/order-utils/src/eip712_utils.ts index d0de86691e..6c7594fe87 100644 --- a/packages/order-utils/src/eip712_utils.ts +++ b/packages/order-utils/src/eip712_utils.ts @@ -1,5 +1,5 @@ -import { DevUtilsContract } from '@0x/abi-gen-wrappers'; import { assert } from '@0x/assert'; +import { DevUtilsContract } from '@0x/contract-wrappers'; import { schemas } from '@0x/json-schemas'; import { EIP712DomainWithDefaultSchema, diff --git a/packages/order-utils/src/order_hash_utils.ts b/packages/order-utils/src/order_hash_utils.ts index 6bee74577f..503b6dd710 100644 --- a/packages/order-utils/src/order_hash_utils.ts +++ b/packages/order-utils/src/order_hash_utils.ts @@ -1,4 +1,4 @@ -import { DevUtilsContract } from '@0x/abi-gen-wrappers'; +import { DevUtilsContract } from '@0x/contract-wrappers'; import { Order } from '@0x/types'; import { BigNumber } from '@0x/utils'; diff --git a/packages/order-utils/src/signature_utils.ts b/packages/order-utils/src/signature_utils.ts index 81e879a93d..3e787c4fa9 100644 --- a/packages/order-utils/src/signature_utils.ts +++ b/packages/order-utils/src/signature_utils.ts @@ -1,4 +1,4 @@ -import { DevUtilsContract } from '@0x/abi-gen-wrappers'; +import { DevUtilsContract } from '@0x/contract-wrappers'; import { schemas } from '@0x/json-schemas'; import { ECSignature, diff --git a/packages/order-utils/test/signature_utils_test.ts b/packages/order-utils/test/signature_utils_test.ts index 3d3dd8d0b2..6d6d848418 100644 --- a/packages/order-utils/test/signature_utils_test.ts +++ b/packages/order-utils/test/signature_utils_test.ts @@ -1,5 +1,5 @@ -import { DevUtilsContract } from '@0x/abi-gen-wrappers'; import { assert } from '@0x/assert'; +import { DevUtilsContract } from '@0x/contract-wrappers'; import { Order, SignatureType, ZeroExTransaction } from '@0x/types'; import { BigNumber } from '@0x/utils'; import * as chai from 'chai'; diff --git a/tsconfig.json b/tsconfig.json index ece1f9a521..1949c951d3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -36,7 +36,6 @@ { "path": "./contracts/dev-utils" }, { "path": "./contracts/integrations" }, { "path": "./packages/0x.js" }, - { "path": "./packages/abi-gen-wrappers" }, { "path": "./packages/abi-gen" }, { "path": "./packages/assert" }, { "path": "./packages/asset-swapper" }, diff --git a/yarn.lock b/yarn.lock index f2bce7af2a..fbd30a243f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -643,42 +643,19 @@ npmlog "^4.1.2" write-file-atomic "^2.3.0" -"@0x/abi-gen-wrappers@^5.0.3", "@0x/abi-gen-wrappers@^5.3.2": - version "5.3.2" - resolved "https://registry.npmjs.org/@0x/abi-gen-wrappers/-/abi-gen-wrappers-5.3.2.tgz#bf7d1942f56916b7d13fae627f6455f309c5c8b5" +"@0x/abi-gen-wrappers@^5.4.0-beta.2", "@0x/abi-gen-wrappers@^5.4.0-beta.3": + version "5.4.0-beta.3" + resolved "https://registry.yarnpkg.com/@0x/abi-gen-wrappers/-/abi-gen-wrappers-5.4.0-beta.3.tgz#8c2d71ef5695fe2d73359917375cfc99b7ba8112" dependencies: - "@0x/base-contract" "^5.4.0" - "@0x/contract-addresses" "^3.2.0" - "@0x/contract-artifacts" "^2.2.2" - -"@0x/assert@^2.1.0", "@0x/assert@^2.1.1", "@0x/assert@^2.1.6": - version "2.1.6" - resolved "https://registry.npmjs.org/@0x/assert/-/assert-2.1.6.tgz#61c5854b555bca1f1f0503754f2fd0169bee0ef1" - dependencies: - "@0x/json-schemas" "^4.0.2" - "@0x/typescript-typings" "^4.3.0" - "@0x/utils" "^4.5.2" - lodash "^4.17.11" - valid-url "^1.0.9" - -"@0x/base-contract@^5.4.0": - version "5.4.0" - resolved "https://registry.npmjs.org/@0x/base-contract/-/base-contract-5.4.0.tgz#466ea98af22d7e629a21a7d16211c825664e2a48" - dependencies: - "@0x/assert" "^2.1.6" - "@0x/json-schemas" "^4.0.2" - "@0x/typescript-typings" "^4.3.0" - "@0x/utils" "^4.5.2" - "@0x/web3-wrapper" "^6.0.13" - ethereum-types "^2.1.6" - ethereumjs-account "^3.0.0" - ethereumjs-blockstream "^7.0.0" - ethereumjs-util "^5.1.1" - ethereumjs-vm "^4.0.0" + "@0x/assert" "^2.2.0-beta.2" + "@0x/base-contract" "^5.5.0-beta.3" + "@0x/contract-addresses" "^3.3.0-beta.4" + "@0x/json-schemas" "^4.1.0-beta.2" + "@0x/types" "^2.5.0-beta.2" + "@0x/utils" "^4.6.0-beta.2" + "@0x/web3-wrapper" "^6.1.0-beta.2" + ethereum-types "^2.2.0-beta.2" ethers "~4.0.4" - js-sha3 "^0.7.0" - lodash "^4.17.11" - uuid "^3.3.2" "@0x/contract-addresses@3.3.0-beta.3": version "3.3.0-beta.3" @@ -686,16 +663,6 @@ dependencies: lodash "^4.17.11" -"@0x/contract-addresses@^3.0.1", "@0x/contract-addresses@^3.0.2", "@0x/contract-addresses@^3.2.0": - version "3.2.0" - resolved "https://registry.npmjs.org/@0x/contract-addresses/-/contract-addresses-3.2.0.tgz#606307696d9622764220a34e9d4638b899093eec" - dependencies: - lodash "^4.17.11" - -"@0x/contract-artifacts@^2.0.2", "@0x/contract-artifacts@^2.2.2": - version "2.2.2" - resolved "https://registry.npmjs.org/@0x/contract-artifacts/-/contract-artifacts-2.2.2.tgz#e6d771afb58d0b59c19c5364af5a42a3dfd17219" - "@0x/contract-wrappers@12.2.0-beta.2": version "12.2.0-beta.2" resolved "https://registry.yarnpkg.com/@0x/contract-wrappers/-/contract-wrappers-12.2.0-beta.2.tgz#62b3c13e35282df14734d1f6b1a617ed51901a27" @@ -708,30 +675,6 @@ ethers "~4.0.4" http-status-codes "^1.3.2" -"@0x/contract-wrappers@^9.1.6": - version "9.1.8" - resolved "https://registry.yarnpkg.com/@0x/contract-wrappers/-/contract-wrappers-9.1.8.tgz#5923d35af3e4b442a57d02f74e02620b2d5b1356" - dependencies: - "@0x/abi-gen-wrappers" "^5.0.3" - "@0x/assert" "^2.1.1" - "@0x/contract-addresses" "^3.0.2" - "@0x/contract-artifacts" "^2.0.2" - "@0x/json-schemas" "^3.1.11" - "@0x/order-utils" "^8.2.3" - "@0x/types" "^2.4.1" - "@0x/typescript-typings" "^4.2.4" - "@0x/utils" "^4.4.1" - "@0x/web3-wrapper" "^6.0.8" - ethereum-types "^2.1.4" - ethereumjs-abi "0.6.5" - ethereumjs-blockstream "6.0.0" - ethereumjs-util "^5.1.1" - ethers "~4.0.4" - http-status-codes "^1.3.2" - js-sha3 "^0.7.0" - lodash "^4.17.11" - uuid "^3.3.2" - "@0x/contracts-erc20@2.3.0-beta.2": version "2.3.0-beta.2" resolved "https://registry.yarnpkg.com/@0x/contracts-erc20/-/contracts-erc20-2.3.0-beta.2.tgz#218239f5594fdbbf8c1ff757a6356ac6fb787421" @@ -741,63 +684,6 @@ "@0x/typescript-typings" "^4.4.0-beta.2" ethereum-types "^2.2.0-beta.2" -"@0x/contracts-erc20@^2.2.7": - version "2.2.14" - resolved "https://registry.yarnpkg.com/@0x/contracts-erc20/-/contracts-erc20-2.2.14.tgz#bac2528a590c0f9668811cfd23948a941ae0ad30" - dependencies: - "@0x/base-contract" "^5.4.0" - "@0x/contracts-utils" "^3.2.4" - "@0x/types" "^2.4.3" - "@0x/typescript-typings" "^4.3.0" - "@0x/utils" "^4.5.2" - "@0x/web3-wrapper" "^6.0.13" - ethereum-types "^2.1.6" - lodash "^4.17.11" - -"@0x/contracts-utils@^3.2.4": - version "3.2.4" - resolved "https://registry.yarnpkg.com/@0x/contracts-utils/-/contracts-utils-3.2.4.tgz#b5ae80684ac0542eb59925f52113ce2c8b1bdb2b" - dependencies: - "@0x/base-contract" "^5.4.0" - "@0x/order-utils" "^8.4.0" - "@0x/types" "^2.4.3" - "@0x/typescript-typings" "^4.3.0" - "@0x/utils" "^4.5.2" - "@0x/web3-wrapper" "^6.0.13" - bn.js "^4.11.8" - ethereum-types "^2.1.6" - ethereumjs-util "^5.1.1" - lodash "^4.17.11" - -"@0x/coordinator-server@^0.1.3": - version "0.1.3" - resolved "https://registry.yarnpkg.com/@0x/coordinator-server/-/coordinator-server-0.1.3.tgz#5fbb7c11bb641aa5386797769cab9a68a7d15b79" - dependencies: - "@0x/assert" "^2.1.0" - "@0x/contract-addresses" "^3.0.1" - "@0x/contract-wrappers" "^9.1.6" - "@0x/contracts-erc20" "^2.2.7" - "@0x/json-schemas" "^3.0.11" - "@0x/order-utils" "^8.2.1" - "@0x/subproviders" "^4.1.1" - "@0x/types" "^2.4.0" - "@0x/typescript-typings" "^4.2.3" - "@0x/utils" "^4.4.0" - "@0x/web3-wrapper" "^6.0.7" - "@babel/polyfill" "^7.0.0" - body-parser "^1.18.3" - cors "^2.8.5" - express "^4.16.3" - express-async-handler "^1.1.4" - forever "^0.15.3" - http-status-codes "^1.3.0" - jsonschema "^1.2.4" - lodash "^4.17.11" - reflect-metadata "^0.1.10" - sqlite3 "^4.0.2" - typeorm "0.2.7" - websocket "^1.0.25" - "@0x/coordinator-server@^1.0.3": version "1.0.3" resolved "https://registry.yarnpkg.com/@0x/coordinator-server/-/coordinator-server-1.0.3.tgz#736640edc5960bd65674436f96050fd7b4da7ac3" @@ -827,24 +713,6 @@ typeorm "0.2.7" websocket "^1.0.25" -"@0x/json-schemas@^3.0.11", "@0x/json-schemas@^3.1.11": - version "3.1.13" - resolved "https://registry.yarnpkg.com/@0x/json-schemas/-/json-schemas-3.1.13.tgz#4b9010f1bdeaf2aef1daba1753aa2e5ecf57f654" - dependencies: - "@0x/typescript-typings" "^4.2.4" - "@types/node" "*" - jsonschema "^1.2.0" - lodash.values "^4.3.0" - -"@0x/json-schemas@^4.0.2": - version "4.0.2" - resolved "https://registry.npmjs.org/@0x/json-schemas/-/json-schemas-4.0.2.tgz#6f7c1dcde04d3acc3e8ca2f24177b9705c10e772" - dependencies: - "@0x/typescript-typings" "^4.3.0" - "@types/node" "*" - jsonschema "^1.2.0" - lodash.values "^4.3.0" - "@0x/mesh-rpc-client@^7.0.4-beta-0xv3": version "7.0.4-beta-0xv3" resolved "https://registry.yarnpkg.com/@0x/mesh-rpc-client/-/mesh-rpc-client-7.0.4-beta-0xv3.tgz#5e933a0b9cf20ca900f309fc4adee03b081eb335" @@ -880,57 +748,6 @@ ethers "~4.0.4" lodash "^4.17.11" -"@0x/order-utils@^8.2.1", "@0x/order-utils@^8.2.3", "@0x/order-utils@^8.4.0": - version "8.4.0" - resolved "https://registry.npmjs.org/@0x/order-utils/-/order-utils-8.4.0.tgz#f7fe9c73f9fd82ab05ec3c04951049e904aab46a" - dependencies: - "@0x/abi-gen-wrappers" "^5.3.2" - "@0x/assert" "^2.1.6" - "@0x/base-contract" "^5.4.0" - "@0x/contract-addresses" "^3.2.0" - "@0x/contract-artifacts" "^2.2.2" - "@0x/json-schemas" "^4.0.2" - "@0x/types" "^2.4.3" - "@0x/typescript-typings" "^4.3.0" - "@0x/utils" "^4.5.2" - "@0x/web3-wrapper" "^6.0.13" - "@types/node" "*" - bn.js "^4.11.8" - ethereum-types "^2.1.6" - ethereumjs-abi "0.6.5" - ethereumjs-util "^5.1.1" - ethers "~4.0.4" - lodash "^4.17.11" - -"@0x/subproviders@^4.1.1": - version "4.1.2" - resolved "https://registry.yarnpkg.com/@0x/subproviders/-/subproviders-4.1.2.tgz#ab7bb0f482b11ccb4615fb5dd8ca85199cd0ae23" - dependencies: - "@0x/assert" "^2.1.1" - "@0x/types" "^2.4.1" - "@0x/typescript-typings" "^4.2.4" - "@0x/utils" "^4.4.1" - "@0x/web3-wrapper" "^6.0.8" - "@ledgerhq/hw-app-eth" "^4.3.0" - "@ledgerhq/hw-transport-u2f" "4.24.0" - "@types/eth-lightwallet" "^3.0.0" - "@types/hdkey" "^0.7.0" - "@types/web3-provider-engine" "^14.0.0" - bip39 "^2.5.0" - bn.js "^4.11.8" - eth-lightwallet "^3.0.1" - ethereum-types "^2.1.4" - ethereumjs-tx "^1.3.5" - ethereumjs-util "^5.1.1" - ganache-core "^2.5.3" - hdkey "^0.7.1" - json-rpc-error "2.0.0" - lodash "^4.17.11" - semaphore-async-await "^1.5.1" - web3-provider-engine "14.0.6" - optionalDependencies: - "@ledgerhq/hw-transport-node-hid" "^4.3.0" - "@0x/ts-doc-gen@^0.0.22": version "0.0.22" resolved "https://registry.yarnpkg.com/@0x/ts-doc-gen/-/ts-doc-gen-0.0.22.tgz#c9c215899695dcd4320a1711291be40050ddbc0e" @@ -944,7 +761,7 @@ typedoc-plugin-markdown "^2.1.0" yargs "^10.0.3" -"@0x/types@^2.4.0", "@0x/types@^2.4.1", "@0x/types@^2.4.3": +"@0x/types@^2.4.3": version "2.4.3" resolved "https://registry.npmjs.org/@0x/types/-/types-2.4.3.tgz#ea014889789e9013fdf48ce97b79f2c016e10fb3" dependencies: @@ -952,7 +769,7 @@ bignumber.js "~8.0.2" ethereum-types "^2.1.6" -"@0x/typescript-typings@^4.2.2", "@0x/typescript-typings@^4.2.3", "@0x/typescript-typings@^4.2.4", "@0x/typescript-typings@^4.3.0": +"@0x/typescript-typings@^4.2.2", "@0x/typescript-typings@^4.3.0": version "4.3.0" resolved "https://registry.npmjs.org/@0x/typescript-typings/-/typescript-typings-4.3.0.tgz#4813a996ac5101841d1c22f4aa1738ab56168857" dependencies: @@ -962,7 +779,7 @@ ethereum-types "^2.1.6" popper.js "1.14.3" -"@0x/utils@^4.3.3", "@0x/utils@^4.4.0", "@0x/utils@^4.4.1", "@0x/utils@^4.5.2": +"@0x/utils@^4.3.3": version "4.5.2" resolved "https://registry.npmjs.org/@0x/utils/-/utils-4.5.2.tgz#6cc89f2d0dda341e0fb4e76049a35abfb67a4ac5" dependencies: @@ -996,19 +813,6 @@ websocket "^1.0.28" xhr2-cookies "1.1.0" -"@0x/web3-wrapper@^6.0.13", "@0x/web3-wrapper@^6.0.7", "@0x/web3-wrapper@^6.0.8": - version "6.0.13" - resolved "https://registry.npmjs.org/@0x/web3-wrapper/-/web3-wrapper-6.0.13.tgz#2e666221bd44ceebe02762028214d4aa41ad7247" - dependencies: - "@0x/assert" "^2.1.6" - "@0x/json-schemas" "^4.0.2" - "@0x/typescript-typings" "^4.3.0" - "@0x/utils" "^4.5.2" - ethereum-types "^2.1.6" - ethereumjs-util "^5.1.1" - ethers "~4.0.4" - lodash "^4.17.11" - "@0xproject/npm-cli-login@^0.0.11": version "0.0.11" resolved "https://registry.yarnpkg.com/@0xproject/npm-cli-login/-/npm-cli-login-0.0.11.tgz#3f1ec06112ce62aad300ff0575358f68aeecde2e" @@ -2137,12 +1941,6 @@ "@types/cheerio" "*" "@types/react" "*" -"@types/eth-lightwallet@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/eth-lightwallet/-/eth-lightwallet-3.0.0.tgz#9be5b59dc6fb3fcdb01e65c2c2a79cd601f72dd4" - dependencies: - "@types/node" "*" - "@types/ethereum-protocol@*": version "1.0.0" resolved "https://registry.npmjs.org/@types/ethereum-protocol/-/ethereum-protocol-1.0.0.tgz#416e3827d5fdfa4658b0045b35a008747871b271" @@ -3087,12 +2885,6 @@ async@2.6.1, async@^2.1.4: dependencies: lodash "^4.17.10" -async@2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/async/-/async-2.6.2.tgz#18330ea7e6e313887f5d2f2a904bac6fe4dd5381" - dependencies: - lodash "^4.17.11" - async@^0.9.0, async@~0.9.0: version "0.9.2" resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" @@ -3914,10 +3706,6 @@ bignumber.js@7.2.1: version "7.2.1" resolved "https://registry.npmjs.org/bignumber.js/-/bignumber.js-7.2.1.tgz#80c048759d826800807c4bfd521e50edbba57a5f" -"bignumber.js@git+https://github.com/frozeman/bignumber.js-nolookahead.git": - version "2.0.7" - resolved "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934" - bignumber.js@~4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-4.1.0.tgz#db6f14067c140bd46624815a7916c92d9b6c24b1" @@ -3958,35 +3746,6 @@ bip66@^1.1.3: dependencies: safe-buffer "^5.0.1" -bitcore-lib@^0.15.0: - version "0.15.0" - resolved "https://registry.yarnpkg.com/bitcore-lib/-/bitcore-lib-0.15.0.tgz#f924be13869f2aab7e04aeec5642ad3359b6cec2" - dependencies: - bn.js "=4.11.8" - bs58 "=4.0.1" - buffer-compare "=1.1.1" - elliptic "=6.4.0" - inherits "=2.0.1" - lodash "=4.17.4" - -bitcore-lib@^0.16.0: - version "0.16.0" - resolved "https://registry.yarnpkg.com/bitcore-lib/-/bitcore-lib-0.16.0.tgz#a2c3ec1108cdb90386f728282ab833e0c77c9533" - dependencies: - bn.js "=4.11.8" - bs58 "=4.0.1" - buffer-compare "=1.1.1" - elliptic "=6.4.0" - inherits "=2.0.1" - lodash "=4.17.11" - -bitcore-mnemonic@^1.5.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/bitcore-mnemonic/-/bitcore-mnemonic-1.7.0.tgz#253295a773135e1a0b455871de614996afc8f5e1" - dependencies: - bitcore-lib "^0.16.0" - unorm "^1.4.1" - bl@^1.0.0: version "1.2.2" resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.2.tgz#a160911717103c07410cef63ef51b397c025af9c" @@ -4030,14 +3789,10 @@ bn.js@4.11.7: version "4.11.7" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.7.tgz#ddb048e50d9482790094c13eb3fcfc833ce7ab46" -bn.js@4.11.8, bn.js@=4.11.8, bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.10.0, bn.js@^4.11.0, bn.js@^4.11.1, bn.js@^4.11.3, bn.js@^4.11.6, bn.js@^4.11.8, bn.js@^4.4.0, bn.js@^4.8.0: +bn.js@4.11.8, bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.10.0, bn.js@^4.11.0, bn.js@^4.11.1, bn.js@^4.11.3, bn.js@^4.11.6, bn.js@^4.11.8, bn.js@^4.4.0, bn.js@^4.8.0: version "4.11.8" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" -bn.js@^2.0.3: - version "2.2.0" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-2.2.0.tgz#12162bc2ae71fc40a5626c33438f3a875cd37625" - body-parser@1.18.2, body-parser@^1.16.0: version "1.18.2" resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.18.2.tgz#87678a19d84b47d859b83199bd59bce222b10454" @@ -4278,16 +4033,16 @@ bs-logger@0.x: dependencies: fast-json-stable-stringify "^2.0.0" -bs58@=4.0.1, bs58@^4.0.0: +bs58@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/bs58/-/bs58-2.0.1.tgz#55908d58f1982aba2008fa1bed8f91998a29bf8d" + +bs58@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" dependencies: base-x "^3.0.2" -bs58@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/bs58/-/bs58-2.0.1.tgz#55908d58f1982aba2008fa1bed8f91998a29bf8d" - bs58check@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" @@ -4306,10 +4061,6 @@ btoa-lite@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/btoa-lite/-/btoa-lite-1.0.0.tgz#337766da15801210fdd956c22e9c6891ab9d0337" -buffer-compare@=1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/buffer-compare/-/buffer-compare-1.1.1.tgz#5be7be853af89198d1f4ddc090d1d66a48aef596" - buffer-crc32@~0.2.3: version "0.2.13" resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" @@ -4338,7 +4089,7 @@ buffer-xor@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" -buffer@4.9.1, buffer@^4.3.0, buffer@^4.9.0: +buffer@4.9.1, buffer@^4.3.0: version "4.9.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.1.tgz#6d1bb601b07a4efced97094132093027c95bc298" dependencies: @@ -5570,10 +5321,6 @@ crypto-browserify@3.12.0, crypto-browserify@^3.11.0: randombytes "^2.0.0" randomfill "^1.0.3" -crypto-js@^3.1.4, crypto-js@^3.1.5: - version "3.1.8" - resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-3.1.8.tgz#715f070bf6014f2ae992a98b3929258b713f08d5" - crypto-random-string@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e" @@ -6277,7 +6024,7 @@ elliptic@6.3.3: hash.js "^1.0.0" inherits "^2.0.1" -elliptic@=6.4.0, elliptic@^6.0.0, elliptic@^6.2.3, elliptic@^6.4.0: +elliptic@^6.0.0, elliptic@^6.2.3, elliptic@^6.4.0: version "6.4.0" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.0.tgz#cac9af8762c85836187003c8dfe193e5e2eae5df" dependencies: @@ -6289,15 +6036,6 @@ elliptic@=6.4.0, elliptic@^6.0.0, elliptic@^6.2.3, elliptic@^6.4.0: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.0" -elliptic@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-3.1.0.tgz#c21682ef762769b56a74201609105da11d5f60cc" - dependencies: - bn.js "^2.0.3" - brorand "^1.0.1" - hash.js "^1.0.0" - inherits "^2.0.1" - emoji-regex@^7.0.1, emoji-regex@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" @@ -6730,22 +6468,6 @@ eth-lib@0.2.8: elliptic "^6.4.0" xhr-request-promise "^0.1.2" -eth-lightwallet@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/eth-lightwallet/-/eth-lightwallet-3.0.1.tgz#297022932aa568f4e4eb0873bff257f5e5b78709" - dependencies: - bitcore-lib "^0.15.0" - bitcore-mnemonic "^1.5.0" - buffer "^4.9.0" - crypto-js "^3.1.5" - elliptic "^3.1.0" - ethereumjs-tx "^1.3.3" - ethereumjs-util "^5.1.1" - rlp "^2.0.0" - scrypt-async "^1.2.0" - tweetnacl "0.13.2" - web3 "0.20.2" - eth-query@^2.0.2, eth-query@^2.1.0, eth-query@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/eth-query/-/eth-query-2.1.2.tgz#d6741d9000106b51510c72db92d6365456a6da5e" @@ -6764,17 +6486,6 @@ eth-sig-util@2.1.2: tweetnacl "^1.0.0" tweetnacl-util "^0.15.0" -eth-sig-util@2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/eth-sig-util/-/eth-sig-util-2.2.0.tgz#769fa3d296b450f6618dedeefe076642c923a16f" - dependencies: - buffer "^5.2.1" - elliptic "^6.4.0" - ethereumjs-abi "0.6.5" - ethereumjs-util "^5.1.1" - tweetnacl "^1.0.0" - tweetnacl-util "^0.15.0" - eth-sig-util@^1.4.2: version "1.4.2" resolved "https://registry.yarnpkg.com/eth-sig-util/-/eth-sig-util-1.4.2.tgz#8d958202c7edbaae839707fba6f09ff327606210" @@ -6817,7 +6528,7 @@ ethereum-common@^0.0.18: version "0.0.18" resolved "https://registry.yarnpkg.com/ethereum-common/-/ethereum-common-0.0.18.tgz#2fdc3576f232903358976eb39da783213ff9523f" -ethereum-types@^2.1.4, ethereum-types@^2.1.6: +ethereum-types@^2.1.6: version "2.1.6" resolved "https://registry.npmjs.org/ethereum-types/-/ethereum-types-2.1.6.tgz#57d9d515fad86ab987c0f6962c4203be37da8579" dependencies: @@ -6831,13 +6542,6 @@ ethereumjs-abi@0.6.5: bn.js "^4.10.0" ethereumjs-util "^4.3.0" -ethereumjs-abi@0.6.7: - version "0.6.7" - resolved "https://registry.yarnpkg.com/ethereumjs-abi/-/ethereumjs-abi-0.6.7.tgz#d1d1c5cdb8d910a7d97645ba9e93be5d153bba2e" - dependencies: - bn.js "^4.11.8" - ethereumjs-util "^6.0.0" - "ethereumjs-abi@git+https://github.com/ethereumjs/ethereumjs-abi.git": version "0.6.5" resolved "git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7" @@ -6853,14 +6557,6 @@ ethereumjs-account@2.0.5: rlp "^2.0.0" safe-buffer "^5.1.1" -ethereumjs-account@3.0.0, ethereumjs-account@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ethereumjs-account/-/ethereumjs-account-3.0.0.tgz#728f060c8e0c6e87f1e987f751d3da25422570a9" - dependencies: - ethereumjs-util "^6.0.0" - rlp "^2.2.1" - safe-buffer "^5.1.1" - ethereumjs-account@^2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/ethereumjs-account/-/ethereumjs-account-2.0.4.tgz#f8c30231bcb707f4514d8a052c1f9da103624d47" @@ -6868,6 +6564,14 @@ ethereumjs-account@^2.0.3: ethereumjs-util "^4.0.1" rlp "^2.0.0" +ethereumjs-account@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ethereumjs-account/-/ethereumjs-account-3.0.0.tgz#728f060c8e0c6e87f1e987f751d3da25422570a9" + dependencies: + ethereumjs-util "^6.0.0" + rlp "^2.2.1" + safe-buffer "^5.1.1" + ethereumjs-block@2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/ethereumjs-block/-/ethereumjs-block-2.1.0.tgz#71d1b19e18061f14cf6371bf34ba31a359931360" @@ -6878,16 +6582,6 @@ ethereumjs-block@2.1.0: ethereumjs-util "^5.0.0" merkle-patricia-tree "^2.1.2" -ethereumjs-block@2.2.0, ethereumjs-block@~2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/ethereumjs-block/-/ethereumjs-block-2.2.0.tgz#8c6c3ab4a5eff0a16d9785fbeedbe643f4dbcbef" - dependencies: - async "^2.0.1" - ethereumjs-common "^1.1.0" - ethereumjs-tx "^1.2.2" - ethereumjs-util "^5.0.0" - merkle-patricia-tree "^2.1.2" - ethereumjs-block@^1.2.2, ethereumjs-block@^1.4.1, ethereumjs-block@^1.6.0, ethereumjs-block@~1.7.0: version "1.7.1" resolved "https://registry.yarnpkg.com/ethereumjs-block/-/ethereumjs-block-1.7.1.tgz#78b88e6cc56de29a6b4884ee75379b6860333c3f" @@ -6898,20 +6592,15 @@ ethereumjs-block@^1.2.2, ethereumjs-block@^1.4.1, ethereumjs-block@^1.6.0, ether ethereumjs-util "^5.0.0" merkle-patricia-tree "^2.1.2" -ethereumjs-blockchain@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/ethereumjs-blockchain/-/ethereumjs-blockchain-3.4.0.tgz#92240da6ecd86b3d8d324df69510b381f26c966b" +ethereumjs-block@~2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/ethereumjs-block/-/ethereumjs-block-2.2.0.tgz#8c6c3ab4a5eff0a16d9785fbeedbe643f4dbcbef" dependencies: - async "^2.6.1" - ethashjs "~0.0.7" - ethereumjs-block "~2.2.0" + async "^2.0.1" ethereumjs-common "^1.1.0" - ethereumjs-util "~6.0.0" - flow-stoplight "^1.0.0" - level-mem "^3.0.1" - lru-cache "^5.1.1" - safe-buffer "^5.1.2" - semaphore "^1.1.0" + ethereumjs-tx "^1.2.2" + ethereumjs-util "^5.0.0" + merkle-patricia-tree "^2.1.2" ethereumjs-blockchain@^4.0.1: version "4.0.1" @@ -6928,14 +6617,6 @@ ethereumjs-blockchain@^4.0.1: rlp "^2.2.2" semaphore "^1.1.0" -ethereumjs-blockstream@6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/ethereumjs-blockstream/-/ethereumjs-blockstream-6.0.0.tgz#79d726d1f358935eb65195e91d40344c31e87eff" - dependencies: - immutable "3.8.2" - source-map-support "0.5.6" - uuid "3.2.1" - ethereumjs-blockstream@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/ethereumjs-blockstream/-/ethereumjs-blockstream-7.0.0.tgz#b8d7b6257dd1100bc6ddb36d6bef58c2490f9999" @@ -6989,18 +6670,6 @@ ethereumjs-util@5.2.0: safe-buffer "^5.1.1" secp256k1 "^3.0.1" -ethereumjs-util@6.1.0, ethereumjs-util@^6.0.0, ethereumjs-util@^6.1.0, ethereumjs-util@~6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-6.1.0.tgz#e9c51e5549e8ebd757a339cc00f5380507e799c8" - dependencies: - bn.js "^4.11.0" - create-hash "^1.1.2" - ethjs-util "0.1.6" - keccak "^1.0.2" - rlp "^2.0.0" - safe-buffer "^5.1.1" - secp256k1 "^3.0.1" - ethereumjs-util@^4.0.1, ethereumjs-util@^4.3.0: version "4.5.0" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-4.5.0.tgz#3e9428b317eebda3d7260d854fddda954b1f1bc6" @@ -7023,13 +6692,13 @@ ethereumjs-util@^5.0.0, ethereumjs-util@^5.0.1, ethereumjs-util@^5.1.1, ethereum safe-buffer "^5.1.1" secp256k1 "^3.0.1" -ethereumjs-util@~6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-6.0.0.tgz#f14841c182b918615afefd744207c7932c8536c0" +ethereumjs-util@^6.0.0, ethereumjs-util@^6.1.0, ethereumjs-util@~6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-6.1.0.tgz#e9c51e5549e8ebd757a339cc00f5380507e799c8" dependencies: bn.js "^4.11.0" create-hash "^1.1.2" - ethjs-util "^0.1.6" + ethjs-util "0.1.6" keccak "^1.0.2" rlp "^2.0.0" safe-buffer "^5.1.1" @@ -7051,23 +6720,6 @@ ethereumjs-vm@2.6.0: rustbn.js "~0.2.0" safe-buffer "^5.1.1" -ethereumjs-vm@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ethereumjs-vm/-/ethereumjs-vm-3.0.0.tgz#70fea2964a6797724b0d93fe080f9984ad18fcdd" - dependencies: - async "^2.1.2" - async-eventemitter "^0.2.2" - ethereumjs-account "^2.0.3" - ethereumjs-block "~2.2.0" - ethereumjs-blockchain "^3.4.0" - ethereumjs-common "^1.1.0" - ethereumjs-util "^6.0.0" - fake-merkle-patricia-tree "^1.0.1" - functional-red-black-tree "^1.0.1" - merkle-patricia-tree "^2.3.2" - rustbn.js "~0.2.0" - safe-buffer "^5.1.1" - ethereumjs-vm@^2.0.2, ethereumjs-vm@^2.1.0, ethereumjs-vm@^2.3.4: version "2.3.4" resolved "https://registry.yarnpkg.com/ethereumjs-vm/-/ethereumjs-vm-2.3.4.tgz#f635d7cb047571a1840a6e9a74d29de4488f8ad6" @@ -7148,7 +6800,7 @@ ethjs-unit@0.1.6, ethjs-unit@^0.1.6: bn.js "4.11.6" number-to-bn "1.7.0" -ethjs-util@0.1.6, ethjs-util@^0.1.6: +ethjs-util@0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" dependencies: @@ -8058,38 +7710,6 @@ ganache-cli@6.4.1: source-map-support "0.5.9" yargs "11.1.0" -ganache-core@^2.5.3: - version "2.6.1" - resolved "https://registry.yarnpkg.com/ganache-core/-/ganache-core-2.6.1.tgz#b97156cd53d0492477c1229d57f8a97763d30d46" - dependencies: - abstract-leveldown "3.0.0" - async "2.6.2" - bip39 "2.5.0" - cachedown "1.0.0" - clone "2.1.2" - debug "3.2.6" - encoding-down "5.0.4" - eth-sig-util "2.2.0" - ethereumjs-abi "0.6.7" - ethereumjs-account "3.0.0" - ethereumjs-block "2.2.0" - ethereumjs-tx "1.3.7" - ethereumjs-util "6.1.0" - ethereumjs-vm "3.0.0" - heap "0.2.6" - level-sublevel "6.6.4" - levelup "3.1.1" - lodash "4.17.14" - merkle-patricia-tree "2.3.2" - seedrandom "3.0.1" - source-map-support "0.5.12" - tmp "0.1.0" - web3-provider-engine "14.2.0" - websocket "1.0.29" - optionalDependencies: - ethereumjs-wallet "0.6.3" - web3 "1.0.0-beta.35" - ganache-core@^2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/ganache-core/-/ganache-core-2.6.0.tgz#19001547893ff9f6d494fcaed66c52edd808f3c0" @@ -9111,7 +8731,7 @@ inherits@2, inherits@2.0.3, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, i version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" -inherits@2.0.1, inherits@=2.0.1: +inherits@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" @@ -11246,18 +10866,10 @@ lodash.values@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/lodash.values/-/lodash.values-4.3.0.tgz#a3a6c2b0ebecc5c2cba1c17e6e620fe81b53d347" -lodash@4.17.11, lodash@=4.17.11: +lodash@4.17.11: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" -lodash@4.17.14: - version "4.17.14" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba" - -lodash@=4.17.4: - version "4.17.4" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" - lodash@^4.0.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.1: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" @@ -11644,7 +11256,7 @@ merge@^1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/merge/-/merge-1.2.0.tgz#7531e39d4949c281a66b8c5a6e0265e8b05894da" -merkle-patricia-tree@2.3.1, merkle-patricia-tree@2.3.2, merkle-patricia-tree@^2.1.2, merkle-patricia-tree@^2.3.2: +merkle-patricia-tree@2.3.1, merkle-patricia-tree@^2.1.2, merkle-patricia-tree@^2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/merkle-patricia-tree/-/merkle-patricia-tree-2.3.2.tgz#982ca1b5a0fde00eed2f6aeed1f9152860b8208a" dependencies: @@ -14793,10 +14405,6 @@ schema-utils@^2.2.0: ajv "^6.10.2" ajv-keywords "^3.4.1" -scrypt-async@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/scrypt-async/-/scrypt-async-1.3.1.tgz#a11fd6fac981b4b823ee01dee0221169500ddae9" - scrypt-js@2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-2.0.4.tgz#32f8c5149f0797672e551c07e230f834b6af5f16" @@ -14845,10 +14453,6 @@ seedrandom@2.4.4: version "2.4.4" resolved "https://registry.yarnpkg.com/seedrandom/-/seedrandom-2.4.4.tgz#b25ea98632c73e45f58b77cfaa931678df01f9ba" -seedrandom@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/seedrandom/-/seedrandom-3.0.1.tgz#eb3dde015bcf55df05a233514e5df44ef9dce083" - seek-bzip@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/seek-bzip/-/seek-bzip-1.0.5.tgz#cfe917cb3d274bcffac792758af53173eb1fabdc" @@ -15330,13 +14934,6 @@ source-map-resolve@^0.5.2: source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@0.5.12: - version "0.5.12" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.12.tgz#b4f3b10d51857a5af0138d3ce8003b201613d599" - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - source-map-support@0.5.6, source-map-support@^0.5.6: version "0.5.6" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.6.tgz#4435cee46b1aab62b8e8610ce60f788091c51c13" @@ -16187,12 +15784,6 @@ tmp@0.0.33, tmp@^0.0.33: dependencies: os-tmpdir "~1.0.2" -tmp@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.1.0.tgz#ee434a4e22543082e294ba6201dcc6eafefa2877" - dependencies: - rimraf "^2.6.3" - tmpl@1.0.x: version "1.0.4" resolved "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" @@ -16446,10 +16037,6 @@ tweetnacl-util@^0.15.0: version "0.15.0" resolved "https://registry.yarnpkg.com/tweetnacl-util/-/tweetnacl-util-0.15.0.tgz#4576c1cee5e2d63d207fee52f1ba02819480bc75" -tweetnacl@0.13.2: - version "0.13.2" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.13.2.tgz#453161770469d45cd266c36404e2bc99a8fa9944" - tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" @@ -16741,10 +16328,6 @@ unorm@^1.3.3: version "1.4.1" resolved "https://registry.yarnpkg.com/unorm/-/unorm-1.4.1.tgz#364200d5f13646ca8bcd44490271335614792300" -unorm@^1.4.1: - version "1.6.0" - resolved "https://registry.yarnpkg.com/unorm/-/unorm-1.6.0.tgz#029b289661fba714f1a9af439eb51d9b16c205af" - unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" @@ -16868,10 +16451,6 @@ utf8@2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/utf8/-/utf8-2.1.1.tgz#2e01db02f7d8d0944f77104f1609eb0c304cf768" -utf8@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/utf8/-/utf8-2.1.2.tgz#1fa0d9270e9be850d9b05027f63519bf46457d96" - utf8@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" @@ -17349,31 +16928,6 @@ web3-provider-engine@14.1.0: xhr "^2.2.0" xtend "^4.0.1" -web3-provider-engine@14.2.0: - version "14.2.0" - resolved "https://registry.yarnpkg.com/web3-provider-engine/-/web3-provider-engine-14.2.0.tgz#2efec157b2c429c5c674c079aea96b0a06de8b3d" - dependencies: - async "^2.5.0" - backoff "^2.5.0" - clone "^2.0.0" - cross-fetch "^2.1.0" - eth-block-tracker "^3.0.0" - eth-json-rpc-infura "^3.1.0" - eth-sig-util "^1.4.2" - ethereumjs-block "^1.2.2" - ethereumjs-tx "^1.2.0" - ethereumjs-util "^5.1.5" - ethereumjs-vm "^2.3.4" - json-rpc-error "^2.0.0" - json-stable-stringify "^1.0.1" - promise-to-callback "^1.0.0" - readable-stream "^2.2.9" - request "^2.85.0" - semaphore "^1.0.3" - ws "^5.1.1" - xhr "^2.2.0" - xtend "^4.0.1" - web3-provider-engine@^13.3.2: version "13.8.0" resolved "https://registry.yarnpkg.com/web3-provider-engine/-/web3-provider-engine-13.8.0.tgz#4c7c1ad2af5f1fe10343b8a65495879a2f9c00df" @@ -17491,16 +17045,6 @@ web3-utils@2.0.0-alpha: randombytes "^2.1.0" utf8 "2.1.1" -web3@0.20.2: - version "0.20.2" - resolved "https://registry.yarnpkg.com/web3/-/web3-0.20.2.tgz#c54dac5fc0e377399c04c1a6ecbb12e4513278d6" - dependencies: - bignumber.js "git+https://github.com/frozeman/bignumber.js-nolookahead.git" - crypto-js "^3.1.4" - utf8 "^2.1.1" - xhr2 "*" - xmlhttprequest "*" - web3@1.0.0-beta.35: version "1.0.0-beta.35" resolved "https://registry.yarnpkg.com/web3/-/web3-1.0.0-beta.35.tgz#6475095bd451a96e50a32b997ddee82279292f11" @@ -17660,7 +17204,7 @@ websocket@1.0.26: typedarray-to-buffer "^3.1.2" yaeti "^0.0.6" -websocket@1.0.29, websocket@^1.0.25, websocket@^1.0.28, websocket@^1.0.29: +websocket@^1.0.25, websocket@^1.0.28, websocket@^1.0.29: version "1.0.29" resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.29.tgz#3f83e49d3279657c58b02a22d90749c806101b98" dependencies: @@ -17957,10 +17501,6 @@ xhr2-cookies@1.1.0: dependencies: cookiejar "^2.1.1" -xhr2@*: - version "0.1.4" - resolved "https://registry.yarnpkg.com/xhr2/-/xhr2-0.1.4.tgz#7f87658847716db5026323812f818cadab387a5f" - xhr@^2.0.4, xhr@^2.2.0, xhr@^2.3.3: version "2.4.1" resolved "https://registry.yarnpkg.com/xhr/-/xhr-2.4.1.tgz#ba982cced205ae5eec387169ac9dc77ca4853d38" @@ -17998,7 +17538,7 @@ xmlbuilder@~9.0.1: version "9.0.7" resolved "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d" -xmlhttprequest@*, xmlhttprequest@1.8.0: +xmlhttprequest@1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc"