From 901d400d629e277fe24b0eac2b290b69a05a3a0d Mon Sep 17 00:00:00 2001 From: Lawrence Forman Date: Wed, 2 Jun 2021 00:21:14 -0400 Subject: [PATCH] Address spot check feedback (#251) * UniswapV3 VIP (#237) * `@0x/contracts-zero-ex`: Add UniswapV3Feature * `@0x/contracts-zero-ex`: Add UniswapV3 VIP `@0x/contract-artifacts`: Regenerate. `@0x/contract-wrappers`: Regenerate. `@0x/asset-swapper`: Add UniswapV3 VIP support. * address review comments and appease linter * `@0x/contracts-zero-ex`: Add UniswapV3Feature tests * Multiplex UniswapV3 (#241) * Add UniswapV3 support to Multiplex batchFill * Add AssetSwapper support for Multiplex UniswapV3 * fix repo scripts that use PKG= env var (#242) Co-authored-by: Lawrence Forman * `@0x/asset-swapper`: Adjust uniswap gas overhead Co-authored-by: Lawrence Forman Co-authored-by: mzhu25 * OTC orders feature (#244) * Add OTC orders feature contracts * Address PR feedback * Remove partial fills for takerSigned variant * Add function to query the min valid nonce * Add ETH support * Tightly pack expiry, nonceBucket, and nonce * Address PR feedback * OTC orders unit tests * Bump prettier version * Skip unnecessary math if takerTokenFillAmount == order.takerAmount * appease CI * Update contract-artifacts and contract-wrappers and CHANGELOGs * `@0x/contracts-zero-ex`: Address spot check feedback * `regen wrappers * prettier * `@0x/asset-swapper`: prettier and tweak gas schedule slightly for uni3 Co-authored-by: Lawrence Forman Co-authored-by: mzhu25 --- .circleci/config.yml | 4 +- .prettierrc | 3 +- ISSUE_TEMPLATE.md | 1 - README.md | 4 +- contracts/broker/src/gods_unchained_utils.ts | 5 +- .../exchange/src/exchange_data_encoder.ts | 6 +- contracts/exchange/test/reentrancy_tests.ts | 5 +- .../exchange/test/utils/exchange_wrapper.ts | 6 +- .../test/coordinator/client_test.ts | 33 +- .../test/coordinator/coordinator_test.ts | 24 +- .../test/dev-utils/lib_asset_data.ts | 14 +- .../test/exchange/batch_match_orders_test.ts | 40 +- .../test/forwarder/forwarder_mainnet_test.ts | 15 +- .../test/framework/actors/maker.ts | 11 +- .../test/framework/actors/utils.ts | 5 +- .../exchange_signature_validation_test.ts | 23 +- .../staking/test/actors/finalizer_actor.ts | 15 +- contracts/staking/test/migration_test.ts | 16 +- .../test-utils/src/test_with_reference.ts | 4 +- contracts/utils/test/lib_bytes.ts | 12 +- contracts/zero-ex/CHANGELOG.json | 13 + contracts/zero-ex/contracts/src/IZeroEx.sol | 6 +- .../src/errors/LibNativeOrdersRichErrors.sol | 17 + .../src/features/LiquidityProviderFeature.sol | 2 +- .../src/features/MetaTransactionsFeature.sol | 2 +- .../src/features/MultiplexFeature.sol | 27 +- .../src/features/OtcOrdersFeature.sol | 472 ++++ .../src/features/TransformERC20Feature.sol | 2 +- .../src/features/UniswapV3Feature.sol | 419 ++++ .../features/interfaces/IOtcOrdersFeature.sol | 122 + .../features/interfaces/IUniswapV3Feature.sol | 86 + .../src/features/libs/LibNativeOrder.sol | 77 + .../native_orders/NativeOrdersSettlement.sol | 6 +- .../src/fixins/FixinTokenSpender.sol | 56 +- .../src/storage/LibOtcOrdersStorage.sol | 45 + .../contracts/src/storage/LibStorage.sol | 3 +- .../contracts/src/vendor/IUniswapV3Pool.sol | 44 + .../contracts/test/TestFixinTokenSpender.sol | 4 +- .../contracts/test/TestNoEthRecipient.sol | 4 + .../contracts/test/TestUniswapV3Factory.sol | 46 + .../contracts/test/TestUniswapV3Feature.sol | 17 + .../contracts/test/TestUniswapV3Pool.sol | 75 + contracts/zero-ex/contracts/test/TestWeth.sol | 7 + contracts/zero-ex/package.json | 4 +- contracts/zero-ex/scripts/rollback.ts | 27 +- contracts/zero-ex/src/artifacts.ts | 4 + contracts/zero-ex/src/migration.ts | 100 +- contracts/zero-ex/src/wrappers.ts | 2 + contracts/zero-ex/test/artifacts.ts | 20 + .../features/batch_fill_native_orders_test.ts | 77 +- .../zero-ex/test/features/multiplex_test.ts | 15 +- .../zero-ex/test/features/otc_orders_test.ts | 753 +++++++ .../test/features/transform_erc20_test.ts | 14 +- .../zero-ex/test/features/uniswapv3_test.ts | 258 +++ .../zero-ex/test/fixin_token_spender_test.ts | 30 +- contracts/zero-ex/test/utils/orders.ts | 130 +- contracts/zero-ex/test/wrappers.ts | 10 + contracts/zero-ex/tsconfig.json | 12 + package.json | 6 +- packages/asset-swapper/CHANGELOG.json | 4 + packages/asset-swapper/package.json | 2 +- .../exchange_proxy_swap_quote_consumer.ts | 37 + .../src/quote_consumers/multiplex_encoders.ts | 5 +- .../quote_consumers/quote_consumer_utils.ts | 3 +- .../utils/market_operation_utils/constants.ts | 4 +- .../utils/market_operation_utils/orders.ts | 13 +- .../sampler_operations.ts | 916 ++++---- .../src/utils/market_operation_utils/types.ts | 5 + .../src/utils/quote_requestor.ts | 13 +- ...exchange_proxy_swap_quote_consumer_test.ts | 5 +- .../test/market_operation_utils_test.ts | 6 +- .../asset-swapper/test/pools_cache_test.ts | 16 +- packages/contract-artifacts/CHANGELOG.json | 13 + .../contract-artifacts/artifacts/Broker.json | 4 +- .../artifacts/Coordinator.json | 4 +- .../artifacts/CoordinatorRegistry.json | 4 +- .../artifacts/DevUtils.json | 4 +- .../artifacts/DummyERC20Token.json | 4 +- .../artifacts/DummyERC721Token.json | 4 +- .../artifacts/ERC1155Mintable.json | 4 +- .../artifacts/ERC1155Proxy.json | 4 +- .../artifacts/ERC20BridgeProxy.json | 4 +- .../artifacts/ERC20Proxy.json | 4 +- .../artifacts/ERC20Token.json | 4 +- .../artifacts/ERC721Proxy.json | 4 +- .../artifacts/ERC721Token.json | 4 +- .../artifacts/Exchange.json | 4 +- .../artifacts/Forwarder.json | 4 +- .../artifacts/GodsUnchainedValidator.json | 4 +- .../contract-artifacts/artifacts/IZeroEx.json | 500 ++++- .../artifacts/MultiAssetProxy.json | 4 +- .../artifacts/OrderValidator.json | 30 +- .../contract-artifacts/artifacts/Staking.json | 4 +- .../artifacts/StakingProxy.json | 4 +- .../artifacts/StaticCallProxy.json | 4 +- .../contract-artifacts/artifacts/WETH9.json | 4 +- .../artifacts/ZRXToken.json | 19 +- .../artifacts/ZrxVault.json | 4 +- packages/contract-artifacts/src/copy.ts | 4 +- packages/contract-wrappers/CHANGELOG.json | 13 + .../src/generated-wrappers/coordinator.ts | 2 +- .../src/generated-wrappers/dev_utils.ts | 16 +- .../src/generated-wrappers/i_zero_ex.ts | 1960 ++++++++++++++++- packages/contract-wrappers/src/index.ts | 2 + packages/migrations/package.json | 2 +- .../migrations/src/test_contract_configs.ts | 8 +- packages/order-utils/src/transformer_utils.ts | 10 +- packages/protocol-utils/CHANGELOG.json | 9 + packages/protocol-utils/src/orders.ts | 189 +- .../src/revert-errors/native_orders.ts | 15 + .../protocol-utils/src/transformer_utils.ts | 10 +- yarn.lock | 7 +- 112 files changed, 6392 insertions(+), 794 deletions(-) create mode 100644 contracts/zero-ex/contracts/src/features/OtcOrdersFeature.sol create mode 100644 contracts/zero-ex/contracts/src/features/UniswapV3Feature.sol create mode 100644 contracts/zero-ex/contracts/src/features/interfaces/IOtcOrdersFeature.sol create mode 100644 contracts/zero-ex/contracts/src/features/interfaces/IUniswapV3Feature.sol create mode 100644 contracts/zero-ex/contracts/src/storage/LibOtcOrdersStorage.sol create mode 100644 contracts/zero-ex/contracts/src/vendor/IUniswapV3Pool.sol create mode 100644 contracts/zero-ex/contracts/test/TestNoEthRecipient.sol create mode 100644 contracts/zero-ex/contracts/test/TestUniswapV3Factory.sol create mode 100644 contracts/zero-ex/contracts/test/TestUniswapV3Feature.sol create mode 100644 contracts/zero-ex/contracts/test/TestUniswapV3Pool.sol create mode 100644 contracts/zero-ex/test/features/otc_orders_test.ts create mode 100644 contracts/zero-ex/test/features/uniswapv3_test.ts diff --git a/.circleci/config.yml b/.circleci/config.yml index 120d264720..1647f09e0d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -18,8 +18,8 @@ jobs: name: yarn command: yarn --frozen-lockfile --ignore-engines install || yarn --frozen-lockfile --ignore-engines install - setup_remote_docker - - run: yarn build:ci || yarn build:ci || yarn build:ci - - run: yarn build:ts || yarn build:ts || yarn build:ts + - run: yarn build:ci || yarn build:ci || yarn build:ci || yarn build:ci || yarn build:ci || yarn build:ci + - run: yarn build:ts || yarn build:ts || yarn build:ts || yarn build:ts || yarn build:ts || yarn build:ts - save_cache: key: repo-{{ .Environment.CIRCLE_SHA1 }} paths: diff --git a/.prettierrc b/.prettierrc index 310eae0b82..d1d79da835 100644 --- a/.prettierrc +++ b/.prettierrc @@ -3,5 +3,6 @@ "tabWidth": 4, "singleQuote": true, "trailingComma": "all", - "bracketSpacing": true + "bracketSpacing": true, + "arrowParens": "avoid" } diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index 7a192add26..416878802a 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -49,7 +49,6 @@ | Package | Version | | ------: | :------ | -