Compare commits

...

53 Commits

Author SHA1 Message Date
Github Actions
fb249f02fc Publish
- @0x/contracts-asset-proxy@3.7.11
 - @0x/contracts-broker@1.1.29
 - @0x/contracts-coordinator@3.1.30
 - @0x/contracts-dev-utils@1.3.28
 - @0x/contracts-erc1155@2.1.29
 - @0x/contracts-erc20@3.3.8
 - @0x/contracts-erc721@3.1.29
 - @0x/contracts-exchange-forwarder@4.2.30
 - @0x/contracts-exchange-libs@4.3.29
 - @0x/contracts-exchange@3.2.30
 - @0x/contracts-extensions@6.2.24
 - @0x/contracts-integrations@2.7.40
 - @0x/contracts-multisig@4.1.30
 - @0x/contracts-staking@2.0.37
 - @0x/contracts-test-utils@5.4.0
 - @0x/contracts-treasury@1.1.6
 - @0x/contracts-utils@4.7.8
 - @0x/contracts-zero-ex@0.23.0
 - @0x/asset-swapper@6.10.0
 - @0x/contract-addresses@6.1.0
 - @0x/contract-artifacts@3.14.2
 - @0x/contract-wrappers-test@12.2.45
 - @0x/contract-wrappers@13.16.1
 - @0x/migrations@8.0.6
 - @0x/order-utils@10.4.21
 - @0x/protocol-utils@1.6.0
2021-05-05 11:32:51 +00:00
Github Actions
fdf04ef275 Updated CHANGELOGS & MD docs 2021-05-05 11:32:46 +00:00
Jacob Evans
b0f5f634f2 bump test-publish resource_class 2021-05-05 21:02:31 +10:00
Jacob Evans
6ee0108565 fix: async pool cache (#226) 2021-05-05 21:01:51 +10:00
Jacob Evans
c73097e688 chore: Deploy FQT with UniswapV3 support (#227) 2021-05-05 21:01:39 +10:00
Lawrence Forman
a2d42b07b5 UniswapV3 [TKR-4] (#197)
* add balancer v2

* fetch balancer v2 pools from subgraph

* feat: initial stab at a Balancer V2 Sampler WIP

* feat: add sampling for buys and fix build issues WIP [untested]

* fix: BalancerV2Sampler implementation issues, works on Kovan

* chore: BalancerV2 sampling boilerplate

* fix: update Balancer V2 mainnet address

* fix: consolidate differences between the 2 working branches

* fix: use mainnet Balancer V2 subgraph

* fix: stack too deep by minimizing and inline Balancer V2 vault interface

* fix: address review comments and clean up

* fix: sampler vault interface and pools cache assuming a pool has swaps

* address more review comments

* fix: TS type issues and add a comment about deadline argument

* fix: pools_cache_tests incorrect token addresses, prettier incompat

* fix: make ERC20BridgeSampler support BalancerV2 non view sampler fns

* fix: use a struct for passing encoded bridge data for Balancer V2

* chore: add changelog entries

* fix: improve gas accuracy of gas schedule for Balancer V2 & Maker Psm

* fix: don't exclude sources with stale caches & wait for cache refresh

* rebase

* `@0x/asset-swapper`: Fix stack too deep errors in sampler

* `@0x/asset-swapper`: Add uniswap V3 sampler.

* `@0x/contracts-zero-ex`: Add UniswapV3 support to FQT

* `@0x/protocol-utils`: Update BridgeProtocols.
`@0x/asset-swapper`: Add sell integration for UniswapV3.

* `@0x/asset-swapper`: Remove unnecessary swap quote consumer constructor arg.
`@0x/asset-swapper`: Enable UniswapV3 on ropsten.

* `@0x/asset-swapper`: UniswapV3 fixes

* `@0x/asset-swapper`: Fix stuff based on latest deployed testnet contracts

* `@0x/asset-swapper`: Remove UniV3 from mainnet sources for now

* `@0x/asset-swapper`: Tweak univ3 gas schedule

* fix CI?

* `@0x/contracts-test-utils`: Set default ganache gas limit to 100e6

Co-authored-by: xianny <xianny@gmail.com>
Co-authored-by: Kim Persson <kimpersson88@gmail.com>
Co-authored-by: Lawrence Forman <me@merklejerk.com>
Co-authored-by: Jacob Evans <jacob@dekz.net>
2021-05-05 19:44:17 +10:00
Xianny
f9a794af93 feat: Balancer V2 integration (#206)
* add balancer v2

* fetch balancer v2 pools from subgraph

* feat: initial stab at a Balancer V2 Sampler WIP

* feat: add sampling for buys and fix build issues WIP [untested]

* fix: BalancerV2Sampler implementation issues, works on Kovan

* chore: BalancerV2 sampling boilerplate

* fix: update Balancer V2 mainnet address

* fix: consolidate differences between the 2 working branches

* fix: use mainnet Balancer V2 subgraph

* fix: stack too deep by minimizing and inline Balancer V2 vault interface

* fix: address review comments and clean up

* fix: sampler vault interface and pools cache assuming a pool has swaps

* address more review comments

* fix: TS type issues and add a comment about deadline argument

* fix: pools_cache_tests incorrect token addresses, prettier incompat

* fix: make ERC20BridgeSampler support BalancerV2 non view sampler fns

* fix: use a struct for passing encoded bridge data for Balancer V2

* chore: add changelog entries

* fix: improve gas accuracy of gas schedule for Balancer V2 & Maker Psm

* fix: don't exclude sources with stale caches & wait for cache refresh

* rebase

* `@0x/asset-swapper`: Fix stack too deep errors in sampler

Co-authored-by: Kim Persson <kimpersson88@gmail.com>
Co-authored-by: Lawrence Forman <me@merklejerk.com>
2021-05-05 11:01:28 +02:00
Jacob Evans
a2643674ca Fix: PLP now generates a fallback (#223)
* fix: PLP requires a fallback

* update changelog

* Fix missed source exclusion
2021-05-05 08:22:19 +10:00
Jacob Evans
c00ce9daac feat: Support ETH based Curve pools (#220)
* feat: Support ETH based Curve pools

* Disable Curve VIP for WETH trades

* feat: Support for sETH and ankrETH (Curve)

* Disable SnowSwap ETH pools

* feat: add BUSD Curve 3pool

* fix changelog

Co-authored-by: Romain Butteaud <romain.butteaud@gmail.com>
2021-05-05 07:33:41 +10:00
mzhu25
c68b5d7844 Fix/staking epoch finalization (#221)
* Patch staking and recover state in constructor

* Add ganache mainnet fork test

* Add ganache mainnet fork test

* update changelog

* hardcode last pool ID

* Separate patch contract to unbreak tests
2021-05-04 11:29:16 -07:00
Jacob Evans
09ed106d4c feat: Deployed Balancer V2 and Curve ETH support (#225) 2021-05-04 16:52:36 +10:00
Jacob Evans
a6b92fc658 fix: Fix test forever with new sources being added 2021-05-04 16:49:16 +10:00
mzhu25
4be4a1a30b Fix exchangeProxyGasOverhead used to compute fallback orders (#215)
* Fix exchangeProxyGasOverhead used to compute fallback orders

* update changelog
2021-05-04 13:41:21 +10:00
Romain Butteaud
9bede5d331 fix: reactive PancakeSwap, BakerySwap VIP on BSC (#222) 2021-05-04 13:40:57 +10:00
Romain Butteaud
b50d4aee6d Chore: adding xSigma liquidity source [TKR-59] (#201)
* Chore: adding xSigma liquidity source

* fix: prettier
2021-05-03 19:50:26 -07:00
Jacob Evans
55bc367bd6 feat: Add LUSD Curve pool (#218) 2021-05-04 08:08:27 +10:00
Github Actions
7a59b7eafe Publish
- @0x/contracts-integrations@2.7.39
 - @0x/contracts-zero-ex@0.22.3
 - @0x/asset-swapper@6.9.1
 - @0x/contract-wrappers-test@12.2.44
 - @0x/migrations@8.0.5
2021-05-01 01:03:24 +00:00
Github Actions
9e59d41e44 Updated CHANGELOGS & MD docs 2021-05-01 01:03:19 +00:00
Jacob Evans
475e6c7bca fix: Temporarily remove PancakeV2/Bakery from VIP (#217) 2021-05-01 10:35:54 +10:00
Github Actions
dbc5a5293e Publish
- @0x/contracts-integrations@2.7.38
 - @0x/contracts-treasury@1.1.5
 - @0x/contracts-zero-ex@0.22.2
 - @0x/asset-swapper@6.9.0
 - @0x/contract-wrappers-test@12.2.43
 - @0x/migrations@8.0.4
2021-04-30 23:39:46 +00:00
Github Actions
f4bd2bd0d8 Updated CHANGELOGS & MD docs 2021-04-30 23:39:42 +00:00
Romain Butteaud
f1782a83ba chore: BSC PancakeSwap forks VIP, PancakeSwapV2, Saddle BTC pool, Curve gas schedule [TKR-41] [TKR-11] [TKR-79] [TKR-86] (#208)
* chore: popular BSC Uniswap clones, Curve gas schedule update, Saddle BTC pool

* chore: adding PancakeSwapV2 VIP

* fix: yarn prettier
2021-05-01 08:48:10 +10:00
Jacob Evans
cbade0d558 fix: Ban colliding Kyber reserve (#216) 2021-04-29 15:24:39 +10:00
mzhu25
fe0c26387c Fix treasury voting power calculation (#214)
* Fix treasury voting power calculation

* Update changelog
2021-04-28 10:22:52 -07:00
Github Actions
c03a014740 Publish
- @0x/contracts-asset-proxy@3.7.10
 - @0x/contracts-broker@1.1.28
 - @0x/contracts-coordinator@3.1.29
 - @0x/contracts-dev-utils@1.3.27
 - @0x/contracts-erc1155@2.1.28
 - @0x/contracts-erc20@3.3.7
 - @0x/contracts-erc721@3.1.28
 - @0x/contracts-exchange-forwarder@4.2.29
 - @0x/contracts-exchange-libs@4.3.28
 - @0x/contracts-exchange@3.2.29
 - @0x/contracts-extensions@6.2.23
 - @0x/contracts-integrations@2.7.37
 - @0x/contracts-multisig@4.1.29
 - @0x/contracts-staking@2.0.36
 - @0x/contracts-test-utils@5.3.25
 - @0x/contracts-treasury@1.1.4
 - @0x/contracts-utils@4.7.7
 - @0x/contracts-zero-ex@0.22.1
 - @0x/asset-swapper@6.8.0
 - @0x/contract-artifacts@3.14.1
 - @0x/contract-wrappers-test@12.2.42
 - @0x/contract-wrappers@13.16.0
 - @0x/migrations@8.0.3
 - @0x/order-utils@10.4.20
 - @0x/protocol-utils@1.5.1
2021-04-28 07:48:31 +00:00
Github Actions
84e6d788aa Updated CHANGELOGS & MD docs 2021-04-28 07:48:27 +00:00
Jacob Evans
cd296b8767 feat: Prune Paths + Fast ABI (#183)
* Cull paths which cannot improve price

* fixes and rename

* optimizations

* disable ABI optimization for sampler

* fix lint

* use fastabi

* Update to fastabi 0.0.2

* update packages

* Fix NaN case

* update to published packages

* rebased

* Update generated wrappers
2021-04-28 17:16:24 +10:00
Lawrence Forman
5946d32a7d Berlin wrappers (#212)
* `@0x/contract-wrappers`: Regenerate wrappers using updated abi-gen
Update tools deps

* update deps to hopefully fix doc gen
2021-04-27 12:16:08 -04:00
Alex Kroeger
842dd8572b bump NativeOrdersFeature version to 1.2 (#213)
* bump version to 1.2

* update changelog
2021-04-27 08:11:13 -07:00
Github Actions
33e260f9db Publish
- @0x/contracts-integrations@2.7.36
 - @0x/contracts-treasury@1.1.3
 - @0x/contracts-zero-ex@0.22.0
 - @0x/asset-swapper@6.7.0
 - @0x/contract-wrappers-test@12.2.41
 - @0x/migrations@8.0.2
 - @0x/protocol-utils@1.5.0
2021-04-26 23:59:58 +00:00
Github Actions
c44f8d0060 Updated CHANGELOGS & MD docs 2021-04-26 23:59:53 +00:00
Kim Persson
411548a33e feat: PancakeSwap 2 integration [TKR-83] (#211)
* feat: PancakeSwap 2 integration

* chore: add PancakeSwap V2 changelog entry

Co-authored-by: Romain Butteaud <romain@0xproject.com>
2021-04-26 15:51:04 -07:00
Alex Kroeger
9a17ce1383 add registerAllowedSigner to NativeOrdersFeature (#195)
* add registerAllowedSigner to NativeOrdersFeature

* fix PR reference in changelog

* prettier

* add cancel pair orders functions for signers

* refactored cancelPairOrders logic, changed naming of signerRegistry to orderSigner registry everywhere, cleaned up tests

* updated changelog for protocol-utils, made batchCancelPairOrders functions more efficient

* clean up function documentation

* added additional tests for batchCancelPairsWithSigner functions, added additional checks for events being emitted correctly

* fix typos in function documentation

* fix typo in function documentation

* update docs

* update comments on cancel functions, small tweaks to docs
2021-04-26 14:32:35 -07:00
Romain Butteaud
2b120d0669 fix: feeType=positive_slippage logic [TKR-81] (#209)
* fix: Fix feeType=positive_slippage logic to not force the EP route

* fix: yarn prettier
2021-04-26 11:26:57 -07:00
Github Actions
6d877d5242 Publish
- @0x/contracts-integrations@2.7.35
 - @0x/asset-swapper@6.6.0
2021-04-16 17:07:22 +00:00
Github Actions
e4abd690e7 Updated CHANGELOGS & MD docs 2021-04-16 17:07:17 +00:00
Jacob Evans
2a194384b6 [asset-swapper] Support Ropsten testnet (#203) 2021-04-16 13:55:35 +10:00
Jacob Evans
1e069e6f8a Remove 10 days from protocol fees docs (#202) 2021-04-16 10:51:41 +10:00
Daniel Pyrathon
a019bb913d only set Last Look parameter if it's explicitly set (#200)
* only set Last Look parameter if it's explicitly set

* remove expoectation of having isLastLook
2021-04-14 16:38:55 -07:00
Github Actions
9ce73931f7 Publish
- @0x/contracts-integrations@2.7.34
 - @0x/asset-swapper@6.5.3
2021-04-14 20:56:21 +00:00
Github Actions
97020df178 Updated CHANGELOGS & MD docs 2021-04-14 20:56:14 +00:00
Lawrence Forman
dfb7b3de8f Apply slippage to non-native orders [TKR-39] (#198)
* `@0x/asset-swapper`: Apply slippage to FQT bridge orders

* review comments

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2021-04-13 19:24:50 -04:00
Github Actions
9e152912fe Publish
- @0x/contracts-integrations@2.7.33
 - @0x/asset-swapper@6.5.2
2021-04-13 11:51:04 +00:00
Github Actions
b2c2f1e1aa Updated CHANGELOGS & MD docs 2021-04-13 11:50:57 +00:00
Jacob Evans
629c7d8e92 Fix asset-swapper test (#199) 2021-04-13 21:01:26 +10:00
Jacob Evans
62f24d4356 [asset-swapper] add Native fee token on all chains (#191) 2021-04-13 08:21:26 +10:00
Github Actions
ae281c33ca Publish
- @0x/contracts-integrations@2.7.32
 - @0x/contracts-treasury@1.1.2
 - @0x/contracts-zero-ex@0.21.1
 - @0x/asset-swapper@6.5.1
 - @0x/contract-wrappers-test@12.2.40
 - @0x/migrations@8.0.1
 - @0x/protocol-utils@1.4.1
2021-04-12 20:37:59 +00:00
Github Actions
5d034dd106 Updated CHANGELOGS & MD docs 2021-04-12 20:37:55 +00:00
Romain Butteaud
c1f8df0eca chore: Component.finance, Smoothy.finance, Saddle.finance, Curve open pools, Gas schedule [TKR-1] (#182)
* chore: Component.finance, Smoothy.finance (mainnet + BSC), Saddle.finance, Curve open pools, adjusting gas schedule, fixing Shell buys

* chore: adding a Sampler for Smoothy.finance to only use whats in the contracts reserve

* fix: Smoothy sampler, only use approx. for buys, removing y and BUSD curve pools

* add CHANGELOGs

* fix: prettier

* add: FRAX Curve open pool

* fix: prettier

* chore: adjusting gas schedule for BSC Smoothy
2021-04-08 18:07:12 -07:00
Github Actions
76dda9eeda Publish
- @0x/contracts-integrations@2.7.31
 - @0x/asset-swapper@6.5.0
2021-04-08 20:27:04 +00:00
Github Actions
a9b84a92ac Updated CHANGELOGS & MD docs 2021-04-08 20:26:57 +00:00
mzhu25
0f7e881899 Add default liquidity provider registry and allow gas costs to be a function of tokens (#196) 2021-04-08 11:09:32 -07:00
mzhu25
6045f777ab Add Kyber DMM as a liquidity source (#194)
* Add Kyber DMM as a liquidity source

* update changelog
2021-04-07 10:08:19 -07:00
188 changed files with 8289 additions and 2384 deletions

View File

@@ -1,25 +1,25 @@
version: 2
version: 2.1
jobs:
build:
resource_class: medium+
resource_class: large
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs10
- image: node:12
environment:
CONTRACTS_COMMIT_HASH: '9ed05f5'
NODE_OPTIONS: '--max-old-space-size=6442'
working_directory: ~/repo
steps:
- checkout
- run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV
- run:
name: install-yarn
command: npm install --force --global yarn@1.17.0
command: npm install --force --global yarn@1.22.0
- run:
name: yarn
command: yarn --frozen-lockfile --ignore-engines install || yarn --frozen-lockfile --ignore-engines install
- setup_remote_docker
- run: yarn build:ci
- run: yarn build:ts
- run: yarn build:ci || yarn build:ci || yarn build:ci
- run: yarn build:ts || yarn build:ts || yarn build:ts
- save_cache:
key: repo-{{ .Environment.CIRCLE_SHA1 }}
paths:
@@ -31,57 +31,59 @@ jobs:
test-exchange-ganache:
resource_class: medium+
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs10
- image: node:12
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn wsrun test:circleci @0x/contracts-exchange
- run: yarn wsrun -p @0x/contracts-exchange -m --serial -c test:circleci
test-integrations-ganache:
resource_class: medium+
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs10
- image: node:12
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn wsrun test:circleci @0x/contracts-integrations
- run: yarn wsrun -p @0x/contracts-integrations -m --serial -c test:circleci
test-contracts-staking-ganache:
resource_class: medium+
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs10
- image: node:12
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn wsrun test:circleci @0x/contracts-staking
- run: yarn wsrun -p @0x/contracts-staking -m --serial -c test:circleci
test-contracts-extra-ganache:
resource_class: medium+
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs10
- image: node:12
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn wsrun test:circleci @0x/contracts-exchange-forwarder @0x/contracts-coordinator
- run: yarn wsrun -p @0x/contracts-exchange-forwarder -p @0x/contracts-coordinator -m --serial -c test:circleci
test-contracts-rest-ganache:
resource_class: medium+
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs10
- image: node:12
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn wsrun test:circleci @0x/contracts-multisig @0x/contracts-utils @0x/contracts-exchange-libs @0x/contracts-erc20 @0x/contracts-erc721 @0x/contracts-erc1155 @0x/contracts-asset-proxy @0x/contracts-broker @0x/contracts-zero-ex
- run: yarn wsrun -p @0x/contracts-multisig -p @0x/contracts-utils -p @0x/contracts-exchange-libs -p @0x/contracts-erc20 -p @0x/contracts-erc721 -p @0x/contracts-erc1155 -p @0x/contracts-asset-proxy -p @0x/contracts-broker -p @0x/contracts-zero-ex -m --serial -c test:circleci
test-publish:
resource_class: medium+
resource_class: large
environment:
NODE_OPTIONS: '--max-old-space-size=6442'
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs10
- image: node:12
- image: 0xorg/verdaccio
working_directory: ~/repo
steps:
@@ -95,7 +97,7 @@ jobs:
path: ~/.npm/_logs
test-doc-generation:
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs10
- image: node:12
working_directory: ~/repo
steps:
- restore_cache:
@@ -106,18 +108,18 @@ jobs:
no_output_timeout: 1200
test-rest:
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs10
- image: node:12
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn wsrun test:circleci @0x/contracts-test-utils
- run: yarn wsrun test:circleci @0x/contract-artifacts
- run: yarn wsrun test:circleci @0x/contract-wrappers-test
- run: yarn wsrun test:circleci @0x/migrations
- run: yarn wsrun test:circleci @0x/order-utils
- run: yarn wsrun test:circleci @0x/asset-swapper
- run: yarn wsrun -p @0x/contracts-test-utils -m --serial -c test:circleci
- run: yarn wsrun -p @0x/contract-artifacts -m --serial -c test:circleci
- run: yarn wsrun -p @0x/contract-wrappers-test -m --serial -c test:circleci
- run: yarn wsrun -p @0x/migrations -m --serial -c test:circleci
- run: yarn wsrun -p @0x/order-utils -m --serial -c test:circleci
- run: yarn wsrun -p @0x/asset-swapper -m --serial -c test:circleci
- save_cache:
key: coverage-contract-wrappers-test-{{ .Environment.CIRCLE_SHA1 }}
paths:
@@ -134,7 +136,7 @@ jobs:
resource_class: large
working_directory: ~/repo
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs10
- image: node:12
steps:
- restore_cache:
keys:
@@ -145,7 +147,7 @@ jobs:
- run: yarn diff_md_docs:ci
submit-coverage:
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs10
- image: node:12
working_directory: ~/repo
steps:
- restore_cache:

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1620214333,
"version": "3.7.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1619596077,
"version": "3.7.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1617311315,
"version": "3.7.9",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.7.11 - _May 5, 2021_
* Dependencies updated
## v3.7.10 - _April 28, 2021_
* Dependencies updated
## v3.7.9 - _April 1, 2021_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-asset-proxy",
"version": "3.7.9",
"version": "3.7.11",
"engines": {
"node": ">=6.12"
},
@@ -51,15 +51,15 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
"devDependencies": {
"@0x/abi-gen": "^5.4.21",
"@0x/contract-wrappers": "^13.15.0",
"@0x/contracts-gen": "^2.0.32",
"@0x/contracts-test-utils": "^5.3.24",
"@0x/contracts-utils": "^4.7.6",
"@0x/dev-utils": "^4.2.1",
"@0x/sol-compiler": "^4.6.1",
"@0x/abi-gen": "^5.6.0",
"@0x/contract-wrappers": "^13.16.1",
"@0x/contracts-gen": "^2.0.38",
"@0x/contracts-test-utils": "^5.4.0",
"@0x/contracts-utils": "^4.7.8",
"@0x/dev-utils": "^4.2.7",
"@0x/sol-compiler": "^4.7.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/tslint-config": "^4.1.4",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -67,7 +67,7 @@
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"ethereumjs-util": "^5.1.1",
"ethereumjs-util": "^7.0.10",
"make-promises-safe": "^1.1.0",
"mocha": "^6.2.0",
"npm-run-all": "^4.1.2",
@@ -79,17 +79,17 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/base-contract": "^6.2.18",
"@0x/contracts-erc1155": "^2.1.27",
"@0x/contracts-erc20": "^3.3.6",
"@0x/contracts-erc721": "^3.1.27",
"@0x/contracts-exchange-libs": "^4.3.27",
"@0x/order-utils": "^10.4.19",
"@0x/types": "^3.3.1",
"@0x/typescript-typings": "^5.1.6",
"@0x/utils": "^6.2.0",
"@0x/web3-wrapper": "^7.4.1",
"ethereum-types": "^3.4.0",
"@0x/base-contract": "^6.4.0",
"@0x/contracts-erc1155": "^2.1.29",
"@0x/contracts-erc20": "^3.3.8",
"@0x/contracts-erc721": "^3.1.29",
"@0x/contracts-exchange-libs": "^4.3.29",
"@0x/order-utils": "^10.4.21",
"@0x/types": "^3.3.3",
"@0x/typescript-typings": "^5.2.0",
"@0x/utils": "^6.4.3",
"@0x/web3-wrapper": "^7.5.3",
"ethereum-types": "^3.5.0",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -168,7 +168,7 @@ describe('StaticCallProxy', () => {
it('should revert if the hash of the output is different than expected expected', async () => {
const staticCallData = staticCallTarget.isOddNumber(new BigNumber(0)).getABIEncodedTransactionData();
const trueAsBuffer = ethUtil.toBuffer('0x0000000000000000000000000000000000000000000000000000000000000001');
const expectedResultHash = ethUtil.bufferToHex(ethUtil.sha3(trueAsBuffer));
const expectedResultHash = ethUtil.bufferToHex(ethUtil.keccak256(trueAsBuffer));
const assetData = assetDataInterface
.StaticCall(staticCallTarget.address, staticCallData, expectedResultHash)
.getABIEncodedTransactionData();
@@ -199,7 +199,7 @@ describe('StaticCallProxy', () => {
it('should be successful if a function call with one static input returns the correct value', async () => {
const staticCallData = staticCallTarget.isOddNumber(new BigNumber(1)).getABIEncodedTransactionData();
const trueAsBuffer = ethUtil.toBuffer('0x0000000000000000000000000000000000000000000000000000000000000001');
const expectedResultHash = ethUtil.bufferToHex(ethUtil.sha3(trueAsBuffer));
const expectedResultHash = ethUtil.bufferToHex(ethUtil.keccak256(trueAsBuffer));
const assetData = assetDataInterface
.StaticCall(staticCallTarget.address, staticCallData, expectedResultHash)
.getABIEncodedTransactionData();
@@ -232,7 +232,7 @@ describe('StaticCallProxy', () => {
const offset = '0000000000000000000000000000000000000000000000000000000000000020';
const encodedExpectedResultWithOffset = `0x${offset}${abiEncoder.encode(expectedResults).slice(2)}`;
const expectedResultHash = ethUtil.bufferToHex(
ethUtil.sha3(ethUtil.toBuffer(encodedExpectedResultWithOffset)),
ethUtil.keccak256(ethUtil.toBuffer(encodedExpectedResultWithOffset)),
);
const assetData = assetDataInterface
.StaticCall(staticCallTarget.address, staticCallData, expectedResultHash)

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1620214333,
"version": "1.1.29",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1619596077,
"version": "1.1.28",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1617311315,
"version": "1.1.27",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.1.29 - _May 5, 2021_
* Dependencies updated
## v1.1.28 - _April 28, 2021_
* Dependencies updated
## v1.1.27 - _April 1, 2021_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-broker",
"version": "1.1.27",
"version": "1.1.29",
"engines": {
"node": ">=6.12"
},
@@ -51,20 +51,20 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.4.21",
"@0x/contracts-asset-proxy": "^3.7.9",
"@0x/contracts-erc20": "^3.3.6",
"@0x/contracts-erc721": "^3.1.27",
"@0x/contracts-exchange": "^3.2.28",
"@0x/contracts-exchange-libs": "^4.3.27",
"@0x/contracts-gen": "^2.0.32",
"@0x/contracts-test-utils": "^5.3.24",
"@0x/contracts-utils": "^4.7.6",
"@0x/sol-compiler": "^4.6.1",
"@0x/abi-gen": "^5.6.0",
"@0x/contracts-asset-proxy": "^3.7.11",
"@0x/contracts-erc20": "^3.3.8",
"@0x/contracts-erc721": "^3.1.29",
"@0x/contracts-exchange": "^3.2.30",
"@0x/contracts-exchange-libs": "^4.3.29",
"@0x/contracts-gen": "^2.0.38",
"@0x/contracts-test-utils": "^5.4.0",
"@0x/contracts-utils": "^4.7.8",
"@0x/sol-compiler": "^4.7.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.3.1",
"@0x/web3-wrapper": "^7.4.1",
"@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.3",
"@0x/web3-wrapper": "^7.5.3",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -84,11 +84,11 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/base-contract": "^6.2.18",
"@0x/order-utils": "^10.4.19",
"@0x/typescript-typings": "^5.1.6",
"@0x/utils": "^6.2.0",
"ethereum-types": "^3.4.0"
"@0x/base-contract": "^6.4.0",
"@0x/order-utils": "^10.4.21",
"@0x/typescript-typings": "^5.2.0",
"@0x/utils": "^6.4.3",
"ethereum-types": "^3.5.0"
},
"publishConfig": {
"access": "public"

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1620214333,
"version": "3.1.30",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1619596077,
"version": "3.1.29",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1617311315,
"version": "3.1.28",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.1.30 - _May 5, 2021_
* Dependencies updated
## v3.1.29 - _April 28, 2021_
* Dependencies updated
## v3.1.28 - _April 1, 2021_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-coordinator",
"version": "3.1.28",
"version": "3.1.30",
"engines": {
"node": ">=6.12"
},
@@ -52,17 +52,17 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.4.21",
"@0x/contracts-asset-proxy": "^3.7.9",
"@0x/contracts-dev-utils": "^1.3.26",
"@0x/contracts-erc20": "^3.3.6",
"@0x/contracts-gen": "^2.0.32",
"@0x/dev-utils": "^4.2.1",
"@0x/order-utils": "^10.4.19",
"@0x/sol-compiler": "^4.6.1",
"@0x/abi-gen": "^5.6.0",
"@0x/contracts-asset-proxy": "^3.7.11",
"@0x/contracts-dev-utils": "^1.3.28",
"@0x/contracts-erc20": "^3.3.8",
"@0x/contracts-gen": "^2.0.38",
"@0x/dev-utils": "^4.2.7",
"@0x/order-utils": "^10.4.21",
"@0x/sol-compiler": "^4.7.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/web3-wrapper": "^7.4.1",
"@0x/tslint-config": "^4.1.4",
"@0x/web3-wrapper": "^7.5.3",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -82,17 +82,17 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/assert": "^3.0.21",
"@0x/base-contract": "^6.2.18",
"@0x/contract-addresses": "^6.0.0",
"@0x/contracts-exchange": "^3.2.28",
"@0x/contracts-test-utils": "^5.3.24",
"@0x/contracts-utils": "^4.7.6",
"@0x/json-schemas": "^5.4.1",
"@0x/types": "^3.3.1",
"@0x/typescript-typings": "^5.1.6",
"@0x/utils": "^6.2.0",
"ethereum-types": "^3.4.0",
"@0x/assert": "^3.0.27",
"@0x/base-contract": "^6.4.0",
"@0x/contract-addresses": "^6.1.0",
"@0x/contracts-exchange": "^3.2.30",
"@0x/contracts-test-utils": "^5.4.0",
"@0x/contracts-utils": "^4.7.8",
"@0x/json-schemas": "^6.1.3",
"@0x/types": "^3.3.3",
"@0x/typescript-typings": "^5.2.0",
"@0x/utils": "^6.4.3",
"ethereum-types": "^3.5.0",
"http-status-codes": "^1.3.2"
},
"publishConfig": {

View File

@@ -1,8 +1,4 @@
import { assert as sharedAssert } from '@0x/assert';
// HACK: We need those two unused imports because they're actually used by sharedAssert which gets injected here
import { Schema } from '@0x/json-schemas'; // tslint:disable-line:no-unused-variable
import { Order } from '@0x/types'; // tslint:disable-line:no-unused-variable
import { BigNumber } from '@0x/utils'; // tslint:disable-line:no-unused-variable
import { Web3Wrapper } from '@0x/web3-wrapper';
export const assert = {

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1620214333,
"version": "1.3.28",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1619596077,
"version": "1.3.27",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1617311315,
"version": "1.3.26",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.3.28 - _May 5, 2021_
* Dependencies updated
## v1.3.27 - _April 28, 2021_
* Dependencies updated
## v1.3.26 - _April 1, 2021_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-dev-utils",
"version": "1.3.26",
"version": "1.3.28",
"engines": {
"node": ">=6.12"
},
@@ -41,18 +41,18 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/dev-utils",
"devDependencies": {
"@0x/abi-gen": "^5.4.21",
"@0x/assert": "^3.0.21",
"@0x/contracts-asset-proxy": "^3.7.9",
"@0x/contracts-erc20": "^3.3.6",
"@0x/contracts-gen": "^2.0.32",
"@0x/contracts-test-utils": "^5.3.24",
"@0x/sol-compiler": "^4.6.1",
"@0x/abi-gen": "^5.6.0",
"@0x/assert": "^3.0.27",
"@0x/contracts-asset-proxy": "^3.7.11",
"@0x/contracts-erc20": "^3.3.8",
"@0x/contracts-gen": "^2.0.38",
"@0x/contracts-test-utils": "^5.4.0",
"@0x/sol-compiler": "^4.7.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.3.1",
"@0x/utils": "^6.2.0",
"ethereum-types": "^3.4.0",
"@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.3",
"@0x/utils": "^6.4.3",
"ethereum-types": "^3.5.0",
"ethers": "~4.0.4",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
@@ -63,7 +63,7 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/base-contract": "^6.2.18",
"@0x/base-contract": "^6.4.0",
"@types/node": "12.12.54"
},
"publishConfig": {

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1620214333,
"version": "2.1.29",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1619596077,
"version": "2.1.28",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1617311315,
"version": "2.1.27",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.29 - _May 5, 2021_
* Dependencies updated
## v2.1.28 - _April 28, 2021_
* Dependencies updated
## v2.1.27 - _April 1, 2021_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc1155",
"version": "2.1.27",
"version": "2.1.29",
"engines": {
"node": ">=6.12"
},
@@ -52,15 +52,15 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
"devDependencies": {
"@0x/abi-gen": "^5.4.21",
"@0x/contracts-gen": "^2.0.32",
"@0x/contracts-utils": "^4.7.6",
"@0x/dev-utils": "^4.2.1",
"@0x/sol-compiler": "^4.6.1",
"@0x/abi-gen": "^5.6.0",
"@0x/contracts-gen": "^2.0.38",
"@0x/contracts-utils": "^4.7.8",
"@0x/dev-utils": "^4.2.7",
"@0x/sol-compiler": "^4.7.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.3.1",
"@0x/typescript-typings": "^5.1.6",
"@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.3",
"@0x/typescript-typings": "^5.2.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -68,7 +68,7 @@
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"ethereum-types": "^3.4.0",
"ethereum-types": "^3.5.0",
"make-promises-safe": "^1.1.0",
"mocha": "^6.2.0",
"npm-run-all": "^4.1.2",
@@ -80,10 +80,10 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/base-contract": "^6.2.18",
"@0x/contracts-test-utils": "^5.3.24",
"@0x/utils": "^6.2.0",
"@0x/web3-wrapper": "^7.4.1",
"@0x/base-contract": "^6.4.0",
"@0x/contracts-test-utils": "^5.4.0",
"@0x/utils": "^6.4.3",
"@0x/web3-wrapper": "^7.5.3",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1620214333,
"version": "3.3.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1619596077,
"version": "3.3.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1617311315,
"version": "3.3.6",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.3.8 - _May 5, 2021_
* Dependencies updated
## v3.3.7 - _April 28, 2021_
* Dependencies updated
## v3.3.6 - _April 1, 2021_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc20",
"version": "3.3.6",
"version": "3.3.8",
"engines": {
"node": ">=6.12"
},
@@ -51,18 +51,18 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
"devDependencies": {
"@0x/abi-gen": "^5.4.21",
"@0x/contracts-gen": "^2.0.32",
"@0x/contracts-test-utils": "^5.3.24",
"@0x/contracts-utils": "^4.7.6",
"@0x/dev-utils": "^4.2.1",
"@0x/sol-compiler": "^4.6.1",
"@0x/abi-gen": "^5.6.0",
"@0x/contracts-gen": "^2.0.38",
"@0x/contracts-test-utils": "^5.4.0",
"@0x/contracts-utils": "^4.7.8",
"@0x/dev-utils": "^4.2.7",
"@0x/sol-compiler": "^4.7.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.3.1",
"@0x/typescript-typings": "^5.1.6",
"@0x/utils": "^6.2.0",
"@0x/web3-wrapper": "^7.4.1",
"@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.3",
"@0x/typescript-typings": "^5.2.0",
"@0x/utils": "^6.4.3",
"@0x/web3-wrapper": "^7.5.3",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -70,7 +70,7 @@
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"ethereum-types": "^3.4.0",
"ethereum-types": "^3.5.0",
"lodash": "^4.17.11",
"make-promises-safe": "^1.1.0",
"mocha": "^6.2.0",
@@ -82,7 +82,7 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/base-contract": "^6.2.18"
"@0x/base-contract": "^6.4.0"
},
"publishConfig": {
"access": "public"

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1620214333,
"version": "3.1.29",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1619596077,
"version": "3.1.28",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1617311315,
"version": "3.1.27",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.1.29 - _May 5, 2021_
* Dependencies updated
## v3.1.28 - _April 28, 2021_
* Dependencies updated
## v3.1.27 - _April 1, 2021_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc721",
"version": "3.1.27",
"version": "3.1.29",
"engines": {
"node": ">=6.12"
},
@@ -52,18 +52,18 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
"devDependencies": {
"@0x/abi-gen": "^5.4.21",
"@0x/contracts-gen": "^2.0.32",
"@0x/contracts-test-utils": "^5.3.24",
"@0x/contracts-utils": "^4.7.6",
"@0x/dev-utils": "^4.2.1",
"@0x/sol-compiler": "^4.6.1",
"@0x/abi-gen": "^5.6.0",
"@0x/contracts-gen": "^2.0.38",
"@0x/contracts-test-utils": "^5.4.0",
"@0x/contracts-utils": "^4.7.8",
"@0x/dev-utils": "^4.2.7",
"@0x/sol-compiler": "^4.7.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.3.1",
"@0x/typescript-typings": "^5.1.6",
"@0x/utils": "^6.2.0",
"@0x/web3-wrapper": "^7.4.1",
"@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.3",
"@0x/typescript-typings": "^5.2.0",
"@0x/utils": "^6.4.3",
"@0x/web3-wrapper": "^7.5.3",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -71,7 +71,7 @@
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"ethereum-types": "^3.4.0",
"ethereum-types": "^3.5.0",
"lodash": "^4.17.11",
"make-promises-safe": "^1.1.0",
"mocha": "^6.2.0",
@@ -84,7 +84,7 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/base-contract": "^6.2.18"
"@0x/base-contract": "^6.4.0"
},
"publishConfig": {
"access": "public"

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1620214333,
"version": "4.2.30",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1619596077,
"version": "4.2.29",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1617311315,
"version": "4.2.28",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.2.30 - _May 5, 2021_
* Dependencies updated
## v4.2.29 - _April 28, 2021_
* Dependencies updated
## v4.2.28 - _April 1, 2021_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange-forwarder",
"version": "4.2.28",
"version": "4.2.30",
"engines": {
"node": ">=6.12"
},
@@ -52,25 +52,25 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.4.21",
"@0x/contracts-asset-proxy": "^3.7.9",
"@0x/contracts-dev-utils": "^1.3.26",
"@0x/contracts-erc1155": "^2.1.27",
"@0x/contracts-erc20": "^3.3.6",
"@0x/contracts-erc721": "^3.1.27",
"@0x/contracts-exchange": "^3.2.28",
"@0x/contracts-exchange-libs": "^4.3.27",
"@0x/contracts-gen": "^2.0.32",
"@0x/contracts-test-utils": "^5.3.24",
"@0x/contracts-utils": "^4.7.6",
"@0x/dev-utils": "^4.2.1",
"@0x/order-utils": "^10.4.19",
"@0x/sol-compiler": "^4.6.1",
"@0x/abi-gen": "^5.6.0",
"@0x/contracts-asset-proxy": "^3.7.11",
"@0x/contracts-dev-utils": "^1.3.28",
"@0x/contracts-erc1155": "^2.1.29",
"@0x/contracts-erc20": "^3.3.8",
"@0x/contracts-erc721": "^3.1.29",
"@0x/contracts-exchange": "^3.2.30",
"@0x/contracts-exchange-libs": "^4.3.29",
"@0x/contracts-gen": "^2.0.38",
"@0x/contracts-test-utils": "^5.4.0",
"@0x/contracts-utils": "^4.7.8",
"@0x/dev-utils": "^4.2.7",
"@0x/order-utils": "^10.4.21",
"@0x/sol-compiler": "^4.7.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.3.1",
"@0x/utils": "^6.2.0",
"@0x/web3-wrapper": "^7.4.1",
"@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.3",
"@0x/utils": "^6.4.3",
"@0x/web3-wrapper": "^7.5.3",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -90,9 +90,9 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/base-contract": "^6.2.18",
"@0x/typescript-typings": "^5.1.6",
"ethereum-types": "^3.4.0"
"@0x/base-contract": "^6.4.0",
"@0x/typescript-typings": "^5.2.0",
"ethereum-types": "^3.5.0"
},
"publishConfig": {
"access": "public"

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1620214333,
"version": "4.3.29",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1619596077,
"version": "4.3.28",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1617311315,
"version": "4.3.27",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.3.29 - _May 5, 2021_
* Dependencies updated
## v4.3.28 - _April 28, 2021_
* Dependencies updated
## v4.3.27 - _April 1, 2021_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange-libs",
"version": "4.3.27",
"version": "4.3.29",
"engines": {
"node": ">=6.12"
},
@@ -52,14 +52,14 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/libs",
"devDependencies": {
"@0x/abi-gen": "^5.4.21",
"@0x/contracts-gen": "^2.0.32",
"@0x/dev-utils": "^4.2.1",
"@0x/sol-compiler": "^4.6.1",
"@0x/subproviders": "^6.4.1",
"@0x/abi-gen": "^5.6.0",
"@0x/contracts-gen": "^2.0.38",
"@0x/dev-utils": "^4.2.7",
"@0x/sol-compiler": "^4.7.3",
"@0x/subproviders": "^6.5.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/web3-wrapper": "^7.4.1",
"@0x/tslint-config": "^4.1.4",
"@0x/web3-wrapper": "^7.5.3",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -67,7 +67,7 @@
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"ethereumjs-util": "^5.1.1",
"ethereumjs-util": "^7.0.10",
"lodash": "^4.17.11",
"make-promises-safe": "^1.1.0",
"mocha": "^6.2.0",
@@ -80,14 +80,14 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/base-contract": "^6.2.18",
"@0x/contracts-test-utils": "^5.3.24",
"@0x/contracts-utils": "^4.7.6",
"@0x/order-utils": "^10.4.19",
"@0x/types": "^3.3.1",
"@0x/typescript-typings": "^5.1.6",
"@0x/utils": "^6.2.0",
"ethereum-types": "^3.4.0"
"@0x/base-contract": "^6.4.0",
"@0x/contracts-test-utils": "^5.4.0",
"@0x/contracts-utils": "^4.7.8",
"@0x/order-utils": "^10.4.21",
"@0x/types": "^3.3.3",
"@0x/typescript-typings": "^5.2.0",
"@0x/utils": "^6.4.3",
"ethereum-types": "^3.5.0"
},
"publishConfig": {
"access": "public"

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1620214333,
"version": "3.2.30",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1619596077,
"version": "3.2.29",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1617311315,
"version": "3.2.28",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.2.30 - _May 5, 2021_
* Dependencies updated
## v3.2.29 - _April 28, 2021_
* Dependencies updated
## v3.2.28 - _April 1, 2021_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange",
"version": "3.2.28",
"version": "3.2.30",
"engines": {
"node": ">=6.12"
},
@@ -52,21 +52,21 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
"devDependencies": {
"@0x/abi-gen": "^5.4.21",
"@0x/contracts-asset-proxy": "^3.7.9",
"@0x/contracts-exchange-libs": "^4.3.27",
"@0x/contracts-gen": "^2.0.32",
"@0x/contracts-multisig": "^4.1.28",
"@0x/contracts-staking": "^2.0.35",
"@0x/contracts-test-utils": "^5.3.24",
"@0x/contracts-utils": "^4.7.6",
"@0x/dev-utils": "^4.2.1",
"@0x/sol-compiler": "^4.6.1",
"@0x/abi-gen": "^5.6.0",
"@0x/contracts-asset-proxy": "^3.7.11",
"@0x/contracts-exchange-libs": "^4.3.29",
"@0x/contracts-gen": "^2.0.38",
"@0x/contracts-multisig": "^4.1.30",
"@0x/contracts-staking": "^2.0.37",
"@0x/contracts-test-utils": "^5.4.0",
"@0x/contracts-utils": "^4.7.8",
"@0x/dev-utils": "^4.2.7",
"@0x/sol-compiler": "^4.7.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.3.1",
"@0x/typescript-typings": "^5.1.6",
"@0x/web3-wrapper": "^7.4.1",
"@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.3",
"@0x/typescript-typings": "^5.2.0",
"@0x/web3-wrapper": "^7.5.3",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -74,8 +74,8 @@
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"ethereum-types": "^3.4.0",
"ethereumjs-util": "^5.1.1",
"ethereum-types": "^3.5.0",
"ethereumjs-util": "^7.0.10",
"js-combinatorics": "^0.5.3",
"make-promises-safe": "^1.1.0",
"mocha": "^6.2.0",
@@ -88,13 +88,13 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/base-contract": "^6.2.18",
"@0x/contracts-dev-utils": "^1.3.26",
"@0x/contracts-erc1155": "^2.1.27",
"@0x/contracts-erc20": "^3.3.6",
"@0x/contracts-erc721": "^3.1.27",
"@0x/order-utils": "^10.4.19",
"@0x/utils": "^6.2.0",
"@0x/base-contract": "^6.4.0",
"@0x/contracts-dev-utils": "^1.3.28",
"@0x/contracts-erc1155": "^2.1.29",
"@0x/contracts-erc20": "^3.3.8",
"@0x/contracts-erc721": "^3.1.29",
"@0x/order-utils": "^10.4.21",
"@0x/utils": "^6.4.3",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -86,7 +86,7 @@ blockchainTests.resets('MixinSignatureValidator', env => {
const SIGNATURE_LENGTH = 65;
const generateRandomSignature = (): string => hexUtils.random(SIGNATURE_LENGTH);
const hashBytes = (bytesHex: string): string => ethUtil.bufferToHex(ethUtil.sha3(ethUtil.toBuffer(bytesHex)));
const hashBytes = (bytesHex: string): string => hexUtils.hash(bytesHex);
const signDataHex = (dataHex: string, privateKey: Buffer): string => {
const ecSignature = ethUtil.ecsign(ethUtil.toBuffer(dataHex), privateKey);
return hexUtils.concat(ecSignature.v, ecSignature.r, ecSignature.s);

View File

@@ -12,7 +12,6 @@ import { ReferenceFunctions as UtilReferenceFunctions, SafeMathRevertErrors } fr
import { FillResults, Order } from '@0x/types';
import { AnyRevertError, BigNumber, ExchangeRevertErrors, hexUtils, StringRevertError } from '@0x/utils';
import { LogEntry, LogWithDecodedArgs } from 'ethereum-types';
import * as ethjs from 'ethereumjs-util';
import * as _ from 'lodash';
import { artifacts } from './artifacts';
@@ -104,7 +103,7 @@ blockchainTests('Exchange wrapper functions unit tests.', env => {
// Creates a deterministic order signature, even though no signature validation
// actually occurs in the test contract.
function createOrderSignature(order: Order): string {
return ethjs.bufferToHex(ethjs.sha3(ethjs.toBuffer(orderHashUtils.getOrderHashHex(order))));
return hexUtils.hash(orderHashUtils.getOrderHashHex(order));
}
// Asserts that `_fillOrder()` was called in the same order and with the same

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1620214333,
"version": "6.2.24",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1619596077,
"version": "6.2.23",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1617311315,
"version": "6.2.22",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v6.2.24 - _May 5, 2021_
* Dependencies updated
## v6.2.23 - _April 28, 2021_
* Dependencies updated
## v6.2.22 - _April 1, 2021_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-extensions",
"version": "6.2.22",
"version": "6.2.24",
"engines": {
"node": ">=6.12"
},
@@ -52,23 +52,23 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.4.21",
"@0x/contracts-asset-proxy": "^3.7.9",
"@0x/contracts-dev-utils": "^1.3.26",
"@0x/contracts-erc20": "^3.3.6",
"@0x/contracts-erc721": "^3.1.27",
"@0x/contracts-exchange": "^3.2.28",
"@0x/contracts-exchange-libs": "^4.3.27",
"@0x/contracts-gen": "^2.0.32",
"@0x/contracts-utils": "^4.7.6",
"@0x/dev-utils": "^4.2.1",
"@0x/order-utils": "^10.4.19",
"@0x/sol-compiler": "^4.6.1",
"@0x/abi-gen": "^5.6.0",
"@0x/contracts-asset-proxy": "^3.7.11",
"@0x/contracts-dev-utils": "^1.3.28",
"@0x/contracts-erc20": "^3.3.8",
"@0x/contracts-erc721": "^3.1.29",
"@0x/contracts-exchange": "^3.2.30",
"@0x/contracts-exchange-libs": "^4.3.29",
"@0x/contracts-gen": "^2.0.38",
"@0x/contracts-utils": "^4.7.8",
"@0x/dev-utils": "^4.2.7",
"@0x/order-utils": "^10.4.21",
"@0x/sol-compiler": "^4.7.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.3.1",
"@0x/utils": "^6.2.0",
"@0x/web3-wrapper": "^7.4.1",
"@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.3",
"@0x/utils": "^6.4.3",
"@0x/web3-wrapper": "^7.5.3",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -77,7 +77,7 @@
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"ethereumjs-abi": "0.6.5",
"ethereumjs-util": "^5.1.1",
"ethereumjs-util": "^7.0.10",
"lodash": "^4.17.11",
"make-promises-safe": "^1.1.0",
"mocha": "^6.2.0",
@@ -90,10 +90,10 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/base-contract": "^6.2.18",
"@0x/contracts-test-utils": "^5.3.24",
"@0x/typescript-typings": "^5.1.6",
"ethereum-types": "^3.4.0"
"@0x/base-contract": "^6.4.0",
"@0x/contracts-test-utils": "^5.4.0",
"@0x/typescript-typings": "^5.2.0",
"ethereum-types": "^3.5.0"
},
"publishConfig": {
"access": "public"

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-integrations",
"version": "2.7.30",
"version": "2.7.40",
"private": true,
"engines": {
"node": ">=6.12"
@@ -52,25 +52,25 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.4.21",
"@0x/contract-addresses": "^6.0.0",
"@0x/contract-wrappers": "^13.15.0",
"@0x/contracts-broker": "^1.1.27",
"@0x/contracts-coordinator": "^3.1.28",
"@0x/contracts-dev-utils": "^1.3.26",
"@0x/contracts-exchange-forwarder": "^4.2.28",
"@0x/contracts-exchange-libs": "^4.3.27",
"@0x/contracts-extensions": "^6.2.22",
"@0x/contracts-gen": "^2.0.32",
"@0x/contracts-utils": "^4.7.6",
"@0x/abi-gen": "^5.6.0",
"@0x/contract-addresses": "^6.1.0",
"@0x/contract-wrappers": "^13.16.1",
"@0x/contracts-broker": "^1.1.29",
"@0x/contracts-coordinator": "^3.1.30",
"@0x/contracts-dev-utils": "^1.3.28",
"@0x/contracts-exchange-forwarder": "^4.2.30",
"@0x/contracts-exchange-libs": "^4.3.29",
"@0x/contracts-extensions": "^6.2.24",
"@0x/contracts-gen": "^2.0.38",
"@0x/contracts-utils": "^4.7.8",
"@0x/coordinator-server": "^1.0.5",
"@0x/dev-utils": "^4.2.1",
"@0x/migrations": "^8.0.0",
"@0x/order-utils": "^10.4.19",
"@0x/protocol-utils": "^1.4.0",
"@0x/sol-compiler": "^4.6.1",
"@0x/tslint-config": "^4.1.3",
"@0x/web3-wrapper": "^7.4.1",
"@0x/dev-utils": "^4.2.7",
"@0x/migrations": "^8.0.6",
"@0x/order-utils": "^10.4.21",
"@0x/protocol-utils": "^1.6.0",
"@0x/sol-compiler": "^4.7.3",
"@0x/tslint-config": "^4.1.4",
"@0x/web3-wrapper": "^7.5.3",
"@azure/core-asynciterator-polyfill": "^1.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -93,23 +93,23 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/asset-swapper": "^6.4.0",
"@0x/base-contract": "^6.2.18",
"@0x/contracts-asset-proxy": "^3.7.9",
"@0x/contracts-erc1155": "^2.1.27",
"@0x/contracts-erc20": "^3.3.6",
"@0x/contracts-erc721": "^3.1.27",
"@0x/contracts-exchange": "^3.2.28",
"@0x/contracts-multisig": "^4.1.28",
"@0x/contracts-staking": "^2.0.35",
"@0x/contracts-test-utils": "^5.3.24",
"@0x/contracts-zero-ex": "^0.21.0",
"@0x/subproviders": "^6.4.1",
"@0x/types": "^3.3.1",
"@0x/typescript-typings": "^5.1.6",
"@0x/utils": "^6.2.0",
"ethereum-types": "^3.4.0",
"ethereumjs-util": "^6.2.0",
"@0x/asset-swapper": "^6.10.0",
"@0x/base-contract": "^6.4.0",
"@0x/contracts-asset-proxy": "^3.7.11",
"@0x/contracts-erc1155": "^2.1.29",
"@0x/contracts-erc20": "^3.3.8",
"@0x/contracts-erc721": "^3.1.29",
"@0x/contracts-exchange": "^3.2.30",
"@0x/contracts-multisig": "^4.1.30",
"@0x/contracts-staking": "^2.0.37",
"@0x/contracts-test-utils": "^5.4.0",
"@0x/contracts-zero-ex": "^0.23.0",
"@0x/subproviders": "^6.5.3",
"@0x/types": "^3.3.3",
"@0x/typescript-typings": "^5.2.0",
"@0x/utils": "^6.4.3",
"ethereum-types": "^3.5.0",
"ethereumjs-util": "^7.0.10",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1620214333,
"version": "4.1.30",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1619596077,
"version": "4.1.29",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1617311315,
"version": "4.1.28",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.1.30 - _May 5, 2021_
* Dependencies updated
## v4.1.29 - _April 28, 2021_
* Dependencies updated
## v4.1.28 - _April 1, 2021_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-multisig",
"version": "4.1.28",
"version": "4.1.30",
"engines": {
"node": ">=6.12"
},
@@ -49,18 +49,18 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/multisig",
"devDependencies": {
"@0x/abi-gen": "^5.4.21",
"@0x/contracts-asset-proxy": "^3.7.9",
"@0x/contracts-erc20": "^3.3.6",
"@0x/contracts-gen": "^2.0.32",
"@0x/contracts-test-utils": "^5.3.24",
"@0x/contracts-utils": "^4.7.6",
"@0x/dev-utils": "^4.2.1",
"@0x/sol-compiler": "^4.6.1",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.3.1",
"@0x/utils": "^6.2.0",
"@0x/web3-wrapper": "^7.4.1",
"@0x/abi-gen": "^5.6.0",
"@0x/contracts-asset-proxy": "^3.7.11",
"@0x/contracts-erc20": "^3.3.8",
"@0x/contracts-gen": "^2.0.38",
"@0x/contracts-test-utils": "^5.4.0",
"@0x/contracts-utils": "^4.7.8",
"@0x/dev-utils": "^4.2.7",
"@0x/sol-compiler": "^4.7.3",
"@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.3",
"@0x/utils": "^6.4.3",
"@0x/web3-wrapper": "^7.5.3",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -78,9 +78,9 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/base-contract": "^6.2.18",
"@0x/typescript-typings": "^5.1.6",
"ethereum-types": "^3.4.0"
"@0x/base-contract": "^6.4.0",
"@0x/typescript-typings": "^5.2.0",
"ethereum-types": "^3.5.0"
},
"publishConfig": {
"access": "public"

View File

@@ -1,4 +1,23 @@
[
{
"version": "2.0.37",
"changes": [
{
"note": "Patch epoch finalization issue",
"pr": 221
}
],
"timestamp": 1620214333
},
{
"timestamp": 1619596077,
"version": "2.0.36",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1617311315,
"version": "2.0.35",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.0.37 - _May 5, 2021_
* Patch epoch finalization issue (#221)
## v2.0.36 - _April 28, 2021_
* Dependencies updated
## v2.0.35 - _April 1, 2021_
* Dependencies updated

View File

@@ -0,0 +1,55 @@
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
import "./interfaces/IStaking.sol";
import "./sys/MixinParams.sol";
import "./stake/MixinStake.sol";
import "./fees/MixinExchangeFees.sol";
contract StakingPatch is
IStaking,
MixinParams,
MixinStake,
MixinExchangeFees
{
/// @dev Initialize storage owned by this contract.
/// This function should not be called directly.
/// The StakingProxy contract will call it in `attachStakingContract()`.
function init()
public
onlyAuthorized
{
uint256 currentEpoch_ = currentEpoch;
uint256 prevEpoch = currentEpoch_.safeSub(1);
// Patch corrupted state
aggregatedStatsByEpoch[prevEpoch].numPoolsToFinalize = 0;
this.endEpoch();
uint256 lastPoolId_ = 57;
for (uint256 i = 1; i <= lastPoolId_; i++) {
this.finalizePool(bytes32(i));
}
// Ensure that current epoch's state is not corrupted
aggregatedStatsByEpoch[currentEpoch_].numPoolsToFinalize = 0;
}
}

View File

@@ -53,6 +53,10 @@ contract MixinExchangeFees is
{
_assertValidProtocolFee(protocolFee);
if (protocolFee == 0) {
return;
}
// Transfer the protocol fee to this address if it should be paid in
// WETH.
if (msg.value == 0) {

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-staking",
"version": "2.0.35",
"version": "2.0.37",
"engines": {
"node": ">=6.12"
},
@@ -41,7 +41,7 @@
"config": {
"publicInterfaceContracts": "IStaking,IStakingEvents,IStakingProxy,IZrxVault,LibStakingRichErrors,Staking,StakingProxy,ZrxVault,TestStaking",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
"abis": "./test/generated-artifacts/@(IStaking|IStakingEvents|IStakingProxy|IStorage|IStorageInit|IStructs|IZrxVault|LibCobbDouglas|LibFixedMath|LibFixedMathRichErrors|LibSafeDowncast|LibStakingRichErrors|MixinAbstract|MixinConstants|MixinCumulativeRewards|MixinDeploymentConstants|MixinExchangeFees|MixinExchangeManager|MixinFinalizer|MixinParams|MixinScheduler|MixinStake|MixinStakeBalances|MixinStakeStorage|MixinStakingPool|MixinStakingPoolRewards|MixinStorage|Staking|StakingProxy|TestAssertStorageParams|TestCobbDouglas|TestCumulativeRewardTracking|TestDelegatorRewards|TestExchangeManager|TestFinalizer|TestInitTarget|TestLibFixedMath|TestLibSafeDowncast|TestMixinCumulativeRewards|TestMixinParams|TestMixinScheduler|TestMixinStake|TestMixinStakeBalances|TestMixinStakeStorage|TestMixinStakingPool|TestMixinStakingPoolRewards|TestProtocolFees|TestProxyDestination|TestStaking|TestStakingNoWETH|TestStakingProxy|TestStakingProxyUnit|TestStorageLayoutAndConstants|ZrxVault).json"
"abis": "./test/generated-artifacts/@(IStaking|IStakingEvents|IStakingProxy|IStorage|IStorageInit|IStructs|IZrxVault|LibCobbDouglas|LibFixedMath|LibFixedMathRichErrors|LibSafeDowncast|LibStakingRichErrors|MixinAbstract|MixinConstants|MixinCumulativeRewards|MixinDeploymentConstants|MixinExchangeFees|MixinExchangeManager|MixinFinalizer|MixinParams|MixinScheduler|MixinStake|MixinStakeBalances|MixinStakeStorage|MixinStakingPool|MixinStakingPoolRewards|MixinStorage|Staking|StakingPatch|StakingProxy|TestAssertStorageParams|TestCobbDouglas|TestCumulativeRewardTracking|TestDelegatorRewards|TestExchangeManager|TestFinalizer|TestInitTarget|TestLibFixedMath|TestLibSafeDowncast|TestMixinCumulativeRewards|TestMixinParams|TestMixinScheduler|TestMixinStake|TestMixinStakeBalances|TestMixinStakeStorage|TestMixinStakingPool|TestMixinStakingPoolRewards|TestProtocolFees|TestProxyDestination|TestStaking|TestStakingNoWETH|TestStakingProxy|TestStakingProxyUnit|TestStorageLayoutAndConstants|ZrxVault).json"
},
"repository": {
"type": "git",
@@ -53,20 +53,20 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
"devDependencies": {
"@0x/abi-gen": "^5.4.21",
"@0x/contracts-asset-proxy": "^3.7.9",
"@0x/contracts-dev-utils": "^1.3.26",
"@0x/contracts-erc20": "^3.3.6",
"@0x/contracts-exchange-libs": "^4.3.27",
"@0x/contracts-gen": "^2.0.32",
"@0x/contracts-utils": "^4.7.6",
"@0x/dev-utils": "^4.2.1",
"@0x/order-utils": "^10.4.19",
"@0x/sol-compiler": "^4.6.1",
"@0x/abi-gen": "^5.6.0",
"@0x/contracts-asset-proxy": "^3.7.11",
"@0x/contracts-dev-utils": "^1.3.28",
"@0x/contracts-erc20": "^3.3.8",
"@0x/contracts-exchange-libs": "^4.3.29",
"@0x/contracts-gen": "^2.0.38",
"@0x/contracts-utils": "^4.7.8",
"@0x/dev-utils": "^4.2.7",
"@0x/order-utils": "^10.4.21",
"@0x/sol-compiler": "^4.7.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.3.1",
"@0x/web3-wrapper": "^7.4.1",
"@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.3",
"@0x/web3-wrapper": "^7.5.3",
"@types/lodash": "4.14.104",
"@types/node": "12.12.54",
"chai": "^4.0.1",
@@ -87,12 +87,12 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/base-contract": "^6.2.18",
"@0x/contracts-test-utils": "^5.3.24",
"@0x/typescript-typings": "^5.1.6",
"@0x/utils": "^6.2.0",
"ethereum-types": "^3.4.0",
"ethereumjs-util": "^5.1.1"
"@0x/base-contract": "^6.4.0",
"@0x/contracts-test-utils": "^5.4.0",
"@0x/typescript-typings": "^5.2.0",
"@0x/utils": "^6.4.3",
"ethereum-types": "^3.5.0",
"ethereumjs-util": "^7.0.10"
},
"publishConfig": {
"access": "public"

View File

@@ -33,6 +33,7 @@ import * as MixinStakingPool from '../test/generated-artifacts/MixinStakingPool.
import * as MixinStakingPoolRewards from '../test/generated-artifacts/MixinStakingPoolRewards.json';
import * as MixinStorage from '../test/generated-artifacts/MixinStorage.json';
import * as Staking from '../test/generated-artifacts/Staking.json';
import * as StakingPatch from '../test/generated-artifacts/StakingPatch.json';
import * as StakingProxy from '../test/generated-artifacts/StakingProxy.json';
import * as TestAssertStorageParams from '../test/generated-artifacts/TestAssertStorageParams.json';
import * as TestCobbDouglas from '../test/generated-artifacts/TestCobbDouglas.json';
@@ -61,6 +62,7 @@ import * as TestStorageLayoutAndConstants from '../test/generated-artifacts/Test
import * as ZrxVault from '../test/generated-artifacts/ZrxVault.json';
export const artifacts = {
Staking: Staking as ContractArtifact,
StakingPatch: StakingPatch as ContractArtifact,
StakingProxy: StakingProxy as ContractArtifact,
ZrxVault: ZrxVault as ContractArtifact,
MixinExchangeFees: MixinExchangeFees as ContractArtifact,

View File

@@ -0,0 +1,66 @@
import { blockchainTests, constants, expect, filterLogsToArguments } from '@0x/contracts-test-utils';
import { BigNumber, logUtils } from '@0x/utils';
import * as _ from 'lodash';
import { artifacts } from './artifacts';
import { StakingEvents, StakingPatchContract, StakingProxyContract, StakingProxyEvents } from './wrappers';
const abis = _.mapValues(artifacts, v => v.compilerOutput.abi);
const STAKING_PROXY = '0xa26e80e7dea86279c6d778d702cc413e6cffa777';
const STAKING_OWNER = '0x7d3455421bbc5ed534a83c88fd80387dc8271392';
const EXCHANGE_PROXY = '0xdef1c0ded9bec7f1a1670819833240f027b25eff';
blockchainTests.configure({
fork: {
unlockedAccounts: [STAKING_OWNER, EXCHANGE_PROXY],
},
});
blockchainTests.fork('Staking patch mainnet fork tests', env => {
let stakingProxyContract: StakingProxyContract;
let patchedStakingPatchContract: StakingPatchContract;
before(async () => {
stakingProxyContract = new StakingProxyContract(STAKING_PROXY, env.provider, undefined, abis);
patchedStakingPatchContract = await StakingPatchContract.deployFrom0xArtifactAsync(
artifacts.Staking,
env.provider,
env.txDefaults,
artifacts,
);
});
it('Staking proxy successfully attaches to patched logic', async () => {
const tx = await stakingProxyContract
.attachStakingContract(patchedStakingPatchContract.address)
.awaitTransactionSuccessAsync({ from: STAKING_OWNER, gasPrice: 0 }, { shouldValidate: false });
expect(filterLogsToArguments(tx.logs, StakingProxyEvents.StakingContractAttachedToProxy)).to.deep.equal([
{
newStakingPatchContractAddress: patchedStakingPatchContract.address,
},
]);
expect(filterLogsToArguments(tx.logs, StakingEvents.EpochEnded).length).to.equal(1);
expect(filterLogsToArguments(tx.logs, StakingEvents.EpochFinalized).length).to.equal(1);
logUtils.log(`${tx.gasUsed} gas used`);
});
it('Patched staking handles 0 gas protocol fees', async () => {
const staking = new StakingPatchContract(STAKING_PROXY, env.provider, undefined, abis);
const maker = '0x7b1886e49ab5433bb46f7258548092dc8cdca28b';
const zeroFeeTx = await staking
.payProtocolFee(maker, constants.NULL_ADDRESS, constants.ZERO_AMOUNT)
.awaitTransactionSuccessAsync({ from: EXCHANGE_PROXY, gasPrice: 0 }, { shouldValidate: false });
// StakingPoolEarnedRewardsInEpoch should _not_ be emitted for a zero protocol fee.
// tslint:disable-next-line:no-unused-expression
expect(filterLogsToArguments(zeroFeeTx.logs, StakingEvents.StakingPoolEarnedRewardsInEpoch)).to.be.empty;
// Coincidentally there's some ETH in the ExchangeProxy
const nonZeroFeeTx = await staking
.payProtocolFee(maker, constants.NULL_ADDRESS, new BigNumber(1))
.awaitTransactionSuccessAsync({ from: EXCHANGE_PROXY, gasPrice: 0, value: 1 }, { shouldValidate: false });
// StakingPoolEarnedRewardsInEpoch _should_ be emitted for a non-zero protocol fee.
expect(
filterLogsToArguments(nonZeroFeeTx.logs, StakingEvents.StakingPoolEarnedRewardsInEpoch),
).to.have.lengthOf(1);
});
});
// tslint:enable:no-unnecessary-type-assertion

View File

@@ -31,6 +31,7 @@ export * from '../test/generated-wrappers/mixin_staking_pool';
export * from '../test/generated-wrappers/mixin_staking_pool_rewards';
export * from '../test/generated-wrappers/mixin_storage';
export * from '../test/generated-wrappers/staking';
export * from '../test/generated-wrappers/staking_patch';
export * from '../test/generated-wrappers/staking_proxy';
export * from '../test/generated-wrappers/test_assert_storage_params';
export * from '../test/generated-wrappers/test_cobb_douglas';

View File

@@ -40,6 +40,7 @@
"test/generated-artifacts/MixinStakingPoolRewards.json",
"test/generated-artifacts/MixinStorage.json",
"test/generated-artifacts/Staking.json",
"test/generated-artifacts/StakingPatch.json",
"test/generated-artifacts/StakingProxy.json",
"test/generated-artifacts/TestAssertStorageParams.json",
"test/generated-artifacts/TestCobbDouglas.json",

View File

@@ -1,4 +1,23 @@
[
{
"version": "5.4.0",
"changes": [
{
"note": "Set default ganache gas limit to 100e6",
"pr": 197
}
],
"timestamp": 1620214333
},
{
"timestamp": 1619596077,
"version": "5.3.25",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1617311315,
"version": "5.3.24",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v5.4.0 - _May 5, 2021_
* Set default ganache gas limit to 100e6 (#197)
## v5.3.25 - _April 28, 2021_
* Dependencies updated
## v5.3.24 - _April 1, 2021_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-test-utils",
"version": "5.3.24",
"version": "5.4.0",
"engines": {
"node": ">=6.12"
},
@@ -34,28 +34,28 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/test-utils",
"devDependencies": {
"@0x/sol-compiler": "^4.6.1",
"@0x/tslint-config": "^4.1.3",
"@0x/sol-compiler": "^4.7.3",
"@0x/tslint-config": "^4.1.4",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"tslint": "5.11.0",
"typescript": "4.2.2"
},
"dependencies": {
"@0x/assert": "^3.0.21",
"@0x/base-contract": "^6.2.18",
"@0x/contract-addresses": "^6.0.0",
"@0x/dev-utils": "^4.2.1",
"@0x/json-schemas": "^5.4.1",
"@0x/order-utils": "^10.4.19",
"@0x/sol-coverage": "^4.0.31",
"@0x/sol-profiler": "^4.1.21",
"@0x/sol-trace": "^3.0.31",
"@0x/subproviders": "^6.4.1",
"@0x/types": "^3.3.1",
"@0x/typescript-typings": "^5.1.6",
"@0x/utils": "^6.2.0",
"@0x/web3-wrapper": "^7.4.1",
"@0x/assert": "^3.0.27",
"@0x/base-contract": "^6.4.0",
"@0x/contract-addresses": "^6.1.0",
"@0x/dev-utils": "^4.2.7",
"@0x/json-schemas": "^6.1.3",
"@0x/order-utils": "^10.4.21",
"@0x/sol-coverage": "^4.0.37",
"@0x/sol-profiler": "^4.1.27",
"@0x/sol-trace": "^3.0.37",
"@0x/subproviders": "^6.5.3",
"@0x/types": "^3.3.3",
"@0x/typescript-typings": "^5.2.0",
"@0x/utils": "^6.4.3",
"@0x/web3-wrapper": "^7.5.3",
"@types/bn.js": "^4.11.0",
"@types/js-combinatorics": "^0.5.29",
"@types/lodash": "4.14.104",
@@ -67,8 +67,8 @@
"chai-bignumber": "^3.0.0",
"decimal.js": "^10.2.0",
"dirty-chai": "^2.0.1",
"ethereum-types": "^3.4.0",
"ethereumjs-util": "^5.1.1",
"ethereum-types": "^3.5.0",
"ethereumjs-util": "^7.0.10",
"ethers": "~4.0.4",
"js-combinatorics": "^0.5.3",
"lodash": "^4.17.11",

View File

@@ -77,7 +77,7 @@ export const constants = {
ZERO_AMOUNT: new BigNumber(0),
PERCENTAGE_DENOMINATOR: new BigNumber(10).pow(18),
TIME_BUFFER: new BigNumber(1000),
KECCAK256_NULL: ethUtil.addHexPrefix(ethUtil.bufferToHex(ethUtil.SHA3_NULL)),
KECCAK256_NULL: ethUtil.bufferToHex(ethUtil.keccak256(Buffer.alloc(0))),
MAX_UINT256_ROOT: new BigNumber('340282366920938463463374607431768211456'),
ONE_ETHER: new BigNumber(1e18),
EIP712_DOMAIN_NAME: '0x Protocol',

View File

@@ -20,6 +20,7 @@ export let providerConfigs: Web3Config = {
shouldUseInProcessGanache: true,
shouldAllowUnlimitedContractSize: true,
hardfork: 'istanbul',
gasLimit: 100e6,
unlocked_accounts: [
'0x6cc5f688a315f3dc28a7781717a9a798a59fda7b',
'0x55dc8f21d20d4c6ed3c82916a438a413ca68e335',

View File

@@ -57,9 +57,7 @@ describe('Order hashing', () => {
...order,
takerAddress: (null as any) as string,
};
const expectedErrorMessage = `Order taker must be of type string. If you want anyone to be able to fill an order - pass ${
constants.NULL_ADDRESS
}`;
const expectedErrorMessage = `Expected order to conform to schema`;
expect(() => orderHashUtils.getOrderHashHex(orderWithInvalidtakerFormat)).to.throw(expectedErrorMessage);
});
});

View File

@@ -1,4 +1,50 @@
[
{
"timestamp": 1620214333,
"version": "1.1.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.1.5",
"changes": [
{
"note": "Patched votingPower logic",
"pr": 214
}
],
"timestamp": 1619825976
},
{
"timestamp": 1619596077,
"version": "1.1.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1619481586,
"version": "1.1.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1618259868,
"version": "1.1.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1617311315,
"version": "1.1.1",

View File

@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.1.6 - _May 5, 2021_
* Dependencies updated
## v1.1.5 - _April 30, 2021_
* Patched votingPower logic (#214)
## v1.1.4 - _April 28, 2021_
* Dependencies updated
## v1.1.3 - _April 26, 2021_
* Dependencies updated
## v1.1.2 - _April 12, 2021_
* Dependencies updated
## v1.1.1 - _April 1, 2021_
* Dependencies updated

View File

@@ -30,6 +30,7 @@ interface IZrxTreasury {
uint256 votingPeriod;
uint256 proposalThreshold;
uint256 quorumThreshold;
bytes32 defaultPoolId;
}
struct ProposedAction {

View File

@@ -20,8 +20,6 @@
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
import "@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol";
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
@@ -32,7 +30,6 @@ import "./IZrxTreasury.sol";
contract ZrxTreasury is
IZrxTreasury
{
using LibERC20TokenV06 for IERC20TokenV06;
using LibSafeMathV06 for uint256;
using LibRichErrorsV06 for bytes;
using LibBytesV06 for bytes;
@@ -52,11 +49,9 @@ contract ZrxTreasury is
/// @dev Initializes the ZRX treasury and creates the default
/// staking pool.
/// @param stakingProxy_ The 0x staking proxy contract.
/// @param weth_ The WETH token contract.
/// @param params Immutable treasury parameters.
constructor(
IStaking stakingProxy_,
IERC20TokenV06 weth_,
TreasuryParameters memory params
)
public
@@ -66,15 +61,12 @@ contract ZrxTreasury is
"VOTING_PERIOD_TOO_LONG"
);
stakingProxy = stakingProxy_;
DefaultPoolOperator defaultPoolOperator_ = new DefaultPoolOperator(
stakingProxy_,
weth_
);
defaultPoolOperator = defaultPoolOperator_;
defaultPoolId = defaultPoolOperator_.poolId();
votingPeriod = params.votingPeriod;
proposalThreshold = params.proposalThreshold;
quorumThreshold = params.quorumThreshold;
defaultPoolId = params.defaultPoolId;
IStaking.Pool memory defaultPool = stakingProxy_.getStakingPool(params.defaultPoolId);
defaultPoolOperator = DefaultPoolOperator(defaultPool.operator);
}
// solhint-disable
@@ -286,6 +278,12 @@ contract ZrxTreasury is
// Add voting power for operated staking pools.
for (uint256 i = 0; i != operatedPoolIds.length; i++) {
for (uint256 j = 0; j != i; j++) {
require(
operatedPoolIds[i] != operatedPoolIds[j],
"getVotingPower/DUPLICATE_POOL_ID"
);
}
IStaking.Pool memory pool = stakingProxy.getStakingPool(operatedPoolIds[i]);
require(
pool.operator == account,

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-treasury",
"version": "1.1.1",
"version": "1.1.6",
"engines": {
"node": ">=6.12"
},
@@ -46,16 +46,16 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
"devDependencies": {
"@0x/abi-gen": "^5.4.21",
"@0x/contract-addresses": "^6.0.0",
"@0x/contracts-asset-proxy": "^3.7.9",
"@0x/contracts-erc20": "^3.3.6",
"@0x/contracts-gen": "^2.0.32",
"@0x/contracts-staking": "^2.0.35",
"@0x/contracts-test-utils": "^5.3.24",
"@0x/sol-compiler": "^4.6.1",
"@0x/abi-gen": "^5.6.0",
"@0x/contract-addresses": "^6.1.0",
"@0x/contracts-asset-proxy": "^3.7.11",
"@0x/contracts-erc20": "^3.3.8",
"@0x/contracts-gen": "^2.0.38",
"@0x/contracts-staking": "^2.0.37",
"@0x/contracts-test-utils": "^5.4.0",
"@0x/sol-compiler": "^4.7.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/tslint-config": "^4.1.4",
"@types/isomorphic-fetch": "^0.0.35",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -72,15 +72,15 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/base-contract": "^6.2.18",
"@0x/protocol-utils": "^1.4.0",
"@0x/subproviders": "^6.4.1",
"@0x/types": "^3.3.1",
"@0x/typescript-typings": "^5.1.6",
"@0x/utils": "^6.2.0",
"@0x/web3-wrapper": "^7.4.1",
"ethereum-types": "^3.4.0",
"ethereumjs-util": "^5.1.1"
"@0x/base-contract": "^6.4.0",
"@0x/protocol-utils": "^1.6.0",
"@0x/subproviders": "^6.5.3",
"@0x/types": "^3.3.3",
"@0x/typescript-typings": "^5.2.0",
"@0x/utils": "^6.4.3",
"@0x/web3-wrapper": "^7.5.3",
"ethereum-types": "^3.5.0",
"ethereumjs-util": "^7.0.10"
},
"publishConfig": {
"access": "public"

View File

@@ -28,6 +28,7 @@ blockchainTests.resets('Treasury governance', env => {
votingPeriod: new BigNumber(3).times(stakingConstants.ONE_DAY_IN_SECONDS),
proposalThreshold: new BigNumber(100),
quorumThreshold: new BigNumber(1000),
defaultPoolId: stakingConstants.INITIAL_POOL_ID,
};
const PROPOSAL_DESCRIPTION = 'A very compelling proposal!';
const TREASURY_BALANCE = constants.INITIAL_ERC20_BALANCE;
@@ -135,6 +136,16 @@ blockchainTests.resets('Treasury governance', env => {
.approve(erc20ProxyContract.address, constants.INITIAL_ERC20_ALLOWANCE)
.awaitTransactionSuccessAsync({ from: delegator });
defaultPoolOperator = await DefaultPoolOperatorContract.deployFrom0xArtifactAsync(
artifacts.DefaultPoolOperator,
env.provider,
env.txDefaults,
{ ...artifacts, ...erc20Artifacts },
staking.address,
weth.address,
);
defaultPoolId = stakingConstants.INITIAL_POOL_ID;
const createStakingPoolTx = staking.createStakingPool(stakingConstants.PPM, false);
nonDefaultPoolId = await createStakingPoolTx.callAsync({ from: poolOperator });
await createStakingPoolTx.awaitTransactionSuccessAsync({ from: poolOperator });
@@ -145,9 +156,9 @@ blockchainTests.resets('Treasury governance', env => {
env.txDefaults,
{ ...artifacts, ...erc20Artifacts },
staking.address,
weth.address,
TREASURY_PARAMS,
);
await zrx.mint(TREASURY_BALANCE).awaitTransactionSuccessAsync();
await zrx.transfer(treasury.address, TREASURY_BALANCE).awaitTransactionSuccessAsync();
actions = [
@@ -166,10 +177,6 @@ blockchainTests.resets('Treasury governance', env => {
value: constants.ZERO_AMOUNT,
},
];
defaultPoolId = await treasury.defaultPoolId().callAsync();
const defaultPoolOperatorAddress = await treasury.defaultPoolOperator().callAsync();
defaultPoolOperator = new DefaultPoolOperatorContract(defaultPoolOperatorAddress, env.provider, env.txDefaults);
});
describe('getVotingPower()', () => {
it('Unstaked ZRX has no voting power', async () => {
@@ -222,6 +229,19 @@ blockchainTests.resets('Treasury governance', env => {
const operatorVotingPower = await treasury.getVotingPower(poolOperator, [nonDefaultPoolId]).callAsync();
expect(operatorVotingPower).to.bignumber.equal(TREASURY_PARAMS.proposalThreshold.dividedBy(2));
});
it('Reverts if given duplicate pool IDs', async () => {
await staking.stake(TREASURY_PARAMS.proposalThreshold).awaitTransactionSuccessAsync({ from: delegator });
await staking
.moveStake(
new StakeInfo(StakeStatus.Undelegated),
new StakeInfo(StakeStatus.Delegated, nonDefaultPoolId),
TREASURY_PARAMS.proposalThreshold,
)
.awaitTransactionSuccessAsync({ from: delegator });
await fastForwardToNextEpochAsync();
const tx = treasury.getVotingPower(poolOperator, [nonDefaultPoolId, nonDefaultPoolId]).callAsync();
return expect(tx).to.revertWith('getVotingPower/DUPLICATE_POOL_ID');
});
it('Correctly sums voting power delegated to multiple pools', async () => {
await staking
.stake(TREASURY_PARAMS.proposalThreshold.times(2))

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1620214333,
"version": "4.7.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1619596077,
"version": "4.7.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1617311315,
"version": "4.7.6",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.7.8 - _May 5, 2021_
* Dependencies updated
## v4.7.7 - _April 28, 2021_
* Dependencies updated
## v4.7.6 - _April 1, 2021_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-utils",
"version": "4.7.6",
"version": "4.7.8",
"engines": {
"node": ">=6.12"
},
@@ -50,15 +50,15 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/utils",
"devDependencies": {
"@0x/abi-gen": "^5.4.21",
"@0x/contracts-gen": "^2.0.32",
"@0x/contracts-test-utils": "^5.3.24",
"@0x/dev-utils": "^4.2.1",
"@0x/order-utils": "^10.4.19",
"@0x/sol-compiler": "^4.6.1",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.3.1",
"@0x/web3-wrapper": "^7.4.1",
"@0x/abi-gen": "^5.6.0",
"@0x/contracts-gen": "^2.0.38",
"@0x/contracts-test-utils": "^5.4.0",
"@0x/dev-utils": "^4.2.7",
"@0x/order-utils": "^10.4.21",
"@0x/sol-compiler": "^4.7.3",
"@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.3",
"@0x/web3-wrapper": "^7.5.3",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -67,7 +67,7 @@
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"ethereumjs-util": "^5.1.1",
"ethereumjs-util": "^7.0.10",
"lodash": "^4.17.11",
"make-promises-safe": "^1.1.0",
"mocha": "^6.2.0",
@@ -79,11 +79,11 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/base-contract": "^6.2.18",
"@0x/typescript-typings": "^5.1.6",
"@0x/utils": "^6.2.0",
"@0x/base-contract": "^6.4.0",
"@0x/typescript-typings": "^5.2.0",
"@0x/utils": "^6.4.3",
"bn.js": "^4.11.8",
"ethereum-types": "^3.4.0"
"ethereum-types": "^3.5.0"
},
"publishConfig": {
"access": "public"

View File

@@ -2,7 +2,6 @@ import { chaiSetup, constants, provider, txDefaults, web3Wrapper } from '@0x/con
import { BlockchainLifecycle } from '@0x/dev-utils';
import { BigNumber, hexUtils, signTypedDataUtils } from '@0x/utils';
import * as chai from 'chai';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
import { artifacts } from './artifacts';
@@ -78,7 +77,7 @@ describe('LibEIP712', () => {
// Hash the provided input to get the expected hash
const input = '0x1901'.concat(unprefixedDomainHash.concat(unprefixedHashStruct));
const expectedHash = '0x'.concat(ethUtil.sha3(input).toString('hex'));
const expectedHash = hexUtils.hash(input);
// Get the actual hash by calling the smart contract
const actualHash = await lib.externalHashEIP712Message(domainHash, hashStruct).callAsync();

View File

@@ -1,4 +1,69 @@
[
{
"version": "0.23.0",
"changes": [
{
"note": "Added ETH support to `MixinCurve`",
"pr": 220
},
{
"note": "Add Balancer V2 integration",
"pr": 206
}
],
"timestamp": 1620214333
},
{
"timestamp": 1619830995,
"version": "0.22.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1619825976,
"version": "0.22.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.22.1",
"changes": [
{
"note": "bump feature version to 1.2",
"pr": 213
}
],
"timestamp": 1619596077
},
{
"version": "0.22.0",
"changes": [
{
"note": "Add order signer registry to NativeOrdersFeature",
"pr": 195
}
],
"timestamp": 1619481586
},
{
"timestamp": 1618259868,
"version": "0.21.1",
"changes": [
{
"note": "Dependencies updated"
},
{
"note": "BSC Uniswap clones (ApeSwap, CafeSwap, CheeseSwap, JulSwap)",
"pr": 208
}
]
},
{
"version": "0.21.0",
"changes": [

View File

@@ -5,6 +5,32 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v0.23.0 - _May 5, 2021_
* Added ETH support to `MixinCurve` (#220)
* Add Balancer V2 integration (#206)
## v0.22.3 - _May 1, 2021_
* Dependencies updated
## v0.22.2 - _April 30, 2021_
* Dependencies updated
## v0.22.1 - _April 28, 2021_
* bump feature version to 1.2 (#213)
## v0.22.0 - _April 26, 2021_
* Add order signer registry to NativeOrdersFeature (#195)
## v0.21.1 - _April 12, 2021_
* Dependencies updated
* BSC Uniswap clones (ApeSwap, CafeSwap, CheeseSwap, JulSwap) (#208)
## v0.21.0 - _April 1, 2021_
* Encoding protocol ID and source name in bridge source ID (#162)

View File

@@ -88,6 +88,21 @@ library LibNativeOrdersRichErrors {
);
}
function InvalidSignerError(
address maker,
address signer
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
bytes4(keccak256("InvalidSignerError(address,address)")),
maker,
signer
);
}
function OrderNotFillableBySenderError(
bytes32 orderHash,
address sender,

View File

@@ -34,7 +34,7 @@ contract NativeOrdersFeature is
/// @dev Name of this feature.
string public constant override FEATURE_NAME = "LimitOrders";
/// @dev Version of this feature.
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 1, 0);
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 2, 0);
constructor(
address zeroExAddress,
@@ -74,9 +74,13 @@ contract NativeOrdersFeature is
_registerFeatureFunction(this.batchCancelLimitOrders.selector);
_registerFeatureFunction(this.batchCancelRfqOrders.selector);
_registerFeatureFunction(this.cancelPairLimitOrders.selector);
_registerFeatureFunction(this.cancelPairLimitOrdersWithSigner.selector);
_registerFeatureFunction(this.batchCancelPairLimitOrders.selector);
_registerFeatureFunction(this.batchCancelPairLimitOrdersWithSigner.selector);
_registerFeatureFunction(this.cancelPairRfqOrders.selector);
_registerFeatureFunction(this.cancelPairRfqOrdersWithSigner.selector);
_registerFeatureFunction(this.batchCancelPairRfqOrders.selector);
_registerFeatureFunction(this.batchCancelPairRfqOrdersWithSigner.selector);
_registerFeatureFunction(this.getLimitOrderInfo.selector);
_registerFeatureFunction(this.getRfqOrderInfo.selector);
_registerFeatureFunction(this.getLimitOrderHash.selector);
@@ -87,6 +91,8 @@ contract NativeOrdersFeature is
_registerFeatureFunction(this.getRfqOrderRelevantState.selector);
_registerFeatureFunction(this.batchGetLimitOrderRelevantStates.selector);
_registerFeatureFunction(this.batchGetRfqOrderRelevantStates.selector);
_registerFeatureFunction(this.registerAllowedOrderSigner.selector);
_registerFeatureFunction(this.isValidOrderSigner.selector);
return LibMigrate.MIGRATE_SUCCESS;
}
}

View File

@@ -37,22 +37,44 @@ contract PancakeSwapFeature is
/// @dev Name of this feature.
string public constant override FEATURE_NAME = "PancakeSwapFeature";
/// @dev Version of this feature.
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 1);
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 2);
/// @dev WBNB contract.
IEtherTokenV06 private immutable WBNB;
// 0xFF + address of the PancakeSwap factory contract.
uint256 constant private FF_PANCAKESWAP_FACTORY = 0xffbcfccbde45ce874adcb698cc183debcf179528120000000000000000000000;
// 0xFF + address of the PancakeSwapV2 factory contract.
uint256 constant private FF_PANCAKESWAPV2_FACTORY = 0xffca143ce32fe78f1f7019d7d551a6402fc5350c730000000000000000000000;
// 0xFF + address of the BakerySwap factory contract.
uint256 constant private FF_BAKERYSWAP_FACTORY = 0xff01bf7c66c6bd861915cdaae475042d3c4bae16a70000000000000000000000;
// 0xFF + address of the SushiSwap factory contract.
uint256 constant private FF_SUSHISWAP_FACTORY = 0xffc35DADB65012eC5796536bD9864eD8773aBc74C40000000000000000000000;
// 0xFF + address of the ApeSwap factory contract.
uint256 constant private FF_APESWAP_FACTORY = 0xff0841bd0b734e4f5853f0dd8d7ea041c241fb0da60000000000000000000000;
// 0xFF + address of the CafeSwap factory contract.
uint256 constant private FF_CAFESWAP_FACTORY = 0xff3e708fdbe3ada63fc94f8f61811196f1302137ad0000000000000000000000;
// 0xFF + address of the CheeseSwap factory contract.
uint256 constant private FF_CHEESESWAP_FACTORY = 0xffdd538e4fd1b69b7863e1f741213276a6cf1efb3b0000000000000000000000;
// 0xFF + address of the JulSwap factory contract.
uint256 constant private FF_JULSWAP_FACTORY = 0xff553990f2cba90272390f62c5bdb1681ffc8996750000000000000000000000;
// Init code hash of the PancakeSwap pair contract.
uint256 constant private PANCAKESWAP_PAIR_INIT_CODE_HASH = 0xd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66;
// Init code hash of the PancakeSwapV2 pair contract.
uint256 constant private PANCAKESWAPV2_PAIR_INIT_CODE_HASH = 0x00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5;
// Init code hash of the BakerySwap pair contract.
uint256 constant private BAKERYSWAP_PAIR_INIT_CODE_HASH = 0xe2e87433120e32c4738a7d8f3271f3d872cbe16241d67537139158d90bac61d3;
// Init code hash of the SushiSwap pair contract.
uint256 constant private SUSHISWAP_PAIR_INIT_CODE_HASH = 0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303;
// Init code hash of the ApeSwap pair contract.
uint256 constant private APESWAP_PAIR_INIT_CODE_HASH = 0xf4ccce374816856d11f00e4069e7cada164065686fbef53c6167a63ec2fd8c5b;
// Init code hash of the CafeSwap pair contract.
uint256 constant private CAFESWAP_PAIR_INIT_CODE_HASH = 0x90bcdb5d0bf0e8db3852b0b7d7e05cc8f7c6eb6d511213c5ba02d1d1dbeda8d3;
// Init code hash of the CheeseSwap pair contract.
uint256 constant private CHEESESWAP_PAIR_INIT_CODE_HASH = 0xf52c5189a89e7ca2ef4f19f2798e3900fba7a316de7cef6c5a9446621ba86286;
// Init code hash of the JulSwap pair contract.
uint256 constant private JULSWAP_PAIR_INIT_CODE_HASH = 0xb1e98e21a5335633815a8cfb3b580071c2e4561c50afd57a8746def9ed890b18;
// Mask of the lower 20 bytes of a bytes32.
uint256 constant private ADDRESS_MASK = 0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff;
// BNB pseudo-token address.
@@ -258,7 +280,7 @@ contract PancakeSwapFeature is
// Call pair.swap()
switch mload(0xA20) // fork
case 1 {
case 2 {
mstore(0xB00, BAKERYSWAP_PAIR_SWAP_CALL_SELECTOR_32)
}
default {
@@ -352,15 +374,40 @@ contract PancakeSwapFeature is
mstore(0xB35, PANCAKESWAP_PAIR_INIT_CODE_HASH)
}
case 1 {
mstore(0xB00, FF_PANCAKESWAPV2_FACTORY)
mstore(0xB15, salt)
mstore(0xB35, PANCAKESWAPV2_PAIR_INIT_CODE_HASH)
}
case 2 {
mstore(0xB00, FF_BAKERYSWAP_FACTORY)
mstore(0xB15, salt)
mstore(0xB35, BAKERYSWAP_PAIR_INIT_CODE_HASH)
}
default {
case 3 {
mstore(0xB00, FF_SUSHISWAP_FACTORY)
mstore(0xB15, salt)
mstore(0xB35, SUSHISWAP_PAIR_INIT_CODE_HASH)
}
case 4 {
mstore(0xB00, FF_APESWAP_FACTORY)
mstore(0xB15, salt)
mstore(0xB35, APESWAP_PAIR_INIT_CODE_HASH)
}
case 5 {
mstore(0xB00, FF_CAFESWAP_FACTORY)
mstore(0xB15, salt)
mstore(0xB35, CAFESWAP_PAIR_INIT_CODE_HASH)
}
case 6 {
mstore(0xB00, FF_CHEESESWAP_FACTORY)
mstore(0xB15, salt)
mstore(0xB35, CHEESESWAP_PAIR_INIT_CODE_HASH)
}
default {
mstore(0xB00, FF_JULSWAP_FACTORY)
mstore(0xB15, salt)
mstore(0xB35, JULSWAP_PAIR_INIT_CODE_HASH)
}
pair := and(ADDRESS_MASK, keccak256(0xB00, 0x55))
}

View File

@@ -113,4 +113,14 @@ interface INativeOrdersEvents {
address[] addrs,
bool allowed
);
/// @dev Emitted when new order signers are registered
/// @param maker The maker address that is registering a designated signer.
/// @param signer The address that will sign on behalf of maker.
/// @param allowed Indicates whether the address should be allowed.
event OrderSignerRegistered(
address maker,
address signer,
bool allowed
);
}

View File

@@ -137,13 +137,13 @@ interface INativeOrdersFeature is
external
returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount);
/// @dev Cancel a single limit order. The caller must be the maker.
/// @dev Cancel a single limit order. The caller must be the maker or a valid order signer.
/// Silently succeeds if the order has already been cancelled.
/// @param order The limit order.
function cancelLimitOrder(LibNativeOrder.LimitOrder calldata order)
external;
/// @dev Cancel a single RFQ order. The caller must be the maker.
/// @dev Cancel a single RFQ order. The caller must be the maker or a valid order signer.
/// Silently succeeds if the order has already been cancelled.
/// @param order The RFQ order.
function cancelRfqOrder(LibNativeOrder.RfqOrder calldata order)
@@ -156,13 +156,13 @@ interface INativeOrdersFeature is
function registerAllowedRfqOrigins(address[] memory origins, bool allowed)
external;
/// @dev Cancel multiple limit orders. The caller must be the maker.
/// @dev Cancel multiple limit orders. The caller must be the maker or a valid order signer.
/// Silently succeeds if the order has already been cancelled.
/// @param orders The limit orders.
function batchCancelLimitOrders(LibNativeOrder.LimitOrder[] calldata orders)
external;
/// @dev Cancel multiple RFQ orders. The caller must be the maker.
/// @dev Cancel multiple RFQ orders. The caller must be the maker or a valid order signer.
/// Silently succeeds if the order has already been cancelled.
/// @param orders The RFQ orders.
function batchCancelRfqOrders(LibNativeOrder.RfqOrder[] calldata orders)
@@ -183,7 +183,23 @@ interface INativeOrdersFeature is
external;
/// @dev Cancel all limit orders for a given maker and pair with a salt less
/// than the value provided. The caller must be the maker. Subsequent
/// than the value provided. The caller must be a signer registered to the maker.
/// Subsequent calls to this function with the same maker and pair require the
/// new salt to be >= the old salt.
/// @param maker The maker for which to cancel.
/// @param makerToken The maker token.
/// @param takerToken The taker token.
/// @param minValidSalt The new minimum valid salt.
function cancelPairLimitOrdersWithSigner(
address maker,
IERC20TokenV06 makerToken,
IERC20TokenV06 takerToken,
uint256 minValidSalt
)
external;
/// @dev Cancel all limit orders for a given maker and pairs with salts less
/// than the values provided. The caller must be the maker. Subsequent
/// calls to this function with the same caller and pair require the
/// new salt to be >= the old salt.
/// @param makerTokens The maker tokens.
@@ -196,6 +212,22 @@ interface INativeOrdersFeature is
)
external;
/// @dev Cancel all limit orders for a given maker and pairs with salts less
/// than the values provided. The caller must be a signer registered to the maker.
/// Subsequent calls to this function with the same maker and pair require the
/// new salt to be >= the old salt.
/// @param maker The maker for which to cancel.
/// @param makerTokens The maker tokens.
/// @param takerTokens The taker tokens.
/// @param minValidSalts The new minimum valid salts.
function batchCancelPairLimitOrdersWithSigner(
address maker,
IERC20TokenV06[] memory makerTokens,
IERC20TokenV06[] memory takerTokens,
uint256[] memory minValidSalts
)
external;
/// @dev Cancel all RFQ orders for a given maker and pair with a salt less
/// than the value provided. The caller must be the maker. Subsequent
/// calls to this function with the same caller and pair require the
@@ -211,7 +243,23 @@ interface INativeOrdersFeature is
external;
/// @dev Cancel all RFQ orders for a given maker and pair with a salt less
/// than the value provided. The caller must be the maker. Subsequent
/// than the value provided. The caller must be a signer registered to the maker.
/// Subsequent calls to this function with the same maker and pair require the
/// new salt to be >= the old salt.
/// @param maker The maker for which to cancel.
/// @param makerToken The maker token.
/// @param takerToken The taker token.
/// @param minValidSalt The new minimum valid salt.
function cancelPairRfqOrdersWithSigner(
address maker,
IERC20TokenV06 makerToken,
IERC20TokenV06 takerToken,
uint256 minValidSalt
)
external;
/// @dev Cancel all RFQ orders for a given maker and pairs with salts less
/// than the values provided. The caller must be the maker. Subsequent
/// calls to this function with the same caller and pair require the
/// new salt to be >= the old salt.
/// @param makerTokens The maker tokens.
@@ -224,6 +272,22 @@ interface INativeOrdersFeature is
)
external;
/// @dev Cancel all RFQ orders for a given maker and pairs with salts less
/// than the values provided. The caller must be a signer registered to the maker.
/// Subsequent calls to this function with the same maker and pair require the
/// new salt to be >= the old salt.
/// @param maker The maker for which to cancel.
/// @param makerTokens The maker tokens.
/// @param takerTokens The taker tokens.
/// @param minValidSalts The new minimum valid salts.
function batchCancelPairRfqOrdersWithSigner(
address maker,
IERC20TokenV06[] memory makerTokens,
IERC20TokenV06[] memory takerTokens,
uint256[] memory minValidSalts
)
external;
/// @dev Get the order info for a limit order.
/// @param order The limit order.
/// @return orderInfo Info about the order.
@@ -345,4 +409,25 @@ interface INativeOrdersFeature is
uint128[] memory actualFillableTakerTokenAmounts,
bool[] memory isSignatureValids
);
/// @dev Register a signer who can sign on behalf of msg.sender
/// This allows one to sign on behalf of a contract that calls this function
/// @param signer The address from which you plan to generate signatures
/// @param allowed True to register, false to unregister.
function registerAllowedOrderSigner(
address signer,
bool allowed
)
external;
/// @dev checks if a given address is registered to sign on behalf of a maker address
/// @param maker The maker address encoded in an order (can be a contract)
/// @param signer The address that is providing a signature
function isValidOrderSigner(
address maker,
address signer
)
external
view
returns (bool isAllowed);
}

View File

@@ -23,16 +23,21 @@ pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
/// @dev VIP PancakeSwap/BakerySwap/SushiSwap fill functions.
/// @dev VIP PancakeSwap (and forks) fill functions.
interface IPancakeSwapFeature {
enum ProtocolFork {
PancakeSwap,
PancakeSwapV2,
BakerySwap,
SushiSwap
SushiSwap,
ApeSwap,
CafeSwap,
CheeseSwap,
JulSwap
}
/// @dev Efficiently sell directly to PancakeSwap/BakerySwap/Sushiswap.
/// @dev Efficiently sell directly to PancakeSwap (and forks).
/// @param tokens Sell path.
/// @param sellAmount of `tokens[0]` Amount to sell.
/// @param minBuyAmount Minimum amount of `tokens[-1]` to buy.

View File

@@ -48,14 +48,14 @@ abstract contract NativeOrdersCancellation is
// solhint-disable no-empty-blocks
}
/// @dev Cancel a single limit order. The caller must be the maker.
/// @dev Cancel a single limit order. The caller must be the maker or a valid order signer.
/// Silently succeeds if the order has already been cancelled.
/// @param order The limit order.
function cancelLimitOrder(LibNativeOrder.LimitOrder memory order)
public
{
bytes32 orderHash = getLimitOrderHash(order);
if (msg.sender != order.maker) {
if (msg.sender != order.maker && !isValidOrderSigner(order.maker, msg.sender)) {
LibNativeOrdersRichErrors.OnlyOrderMakerAllowed(
orderHash,
msg.sender,
@@ -65,14 +65,14 @@ abstract contract NativeOrdersCancellation is
_cancelOrderHash(orderHash, order.maker);
}
/// @dev Cancel a single RFQ order. The caller must be the maker.
/// @dev Cancel a single RFQ order. The caller must be the maker or a valid order signer.
/// Silently succeeds if the order has already been cancelled.
/// @param order The RFQ order.
function cancelRfqOrder(LibNativeOrder.RfqOrder memory order)
public
{
bytes32 orderHash = getRfqOrderHash(order);
if (msg.sender != order.maker) {
if (msg.sender != order.maker && !isValidOrderSigner(order.maker, msg.sender)) {
LibNativeOrdersRichErrors.OnlyOrderMakerAllowed(
orderHash,
msg.sender,
@@ -82,7 +82,7 @@ abstract contract NativeOrdersCancellation is
_cancelOrderHash(orderHash, order.maker);
}
/// @dev Cancel multiple limit orders. The caller must be the maker.
/// @dev Cancel multiple limit orders. The caller must be the maker or a valid order signer.
/// Silently succeeds if the order has already been cancelled.
/// @param orders The limit orders.
function batchCancelLimitOrders(LibNativeOrder.LimitOrder[] memory orders)
@@ -93,7 +93,7 @@ abstract contract NativeOrdersCancellation is
}
}
/// @dev Cancel multiple RFQ orders. The caller must be the maker.
/// @dev Cancel multiple RFQ orders. The caller must be the maker or a valid order signer.
/// Silently succeeds if the order has already been cancelled.
/// @param orders The RFQ orders.
function batchCancelRfqOrders(LibNativeOrder.RfqOrder[] memory orders)
@@ -118,33 +118,34 @@ abstract contract NativeOrdersCancellation is
)
public
{
LibNativeOrdersStorage.Storage storage stor =
LibNativeOrdersStorage.getStorage();
_cancelPairLimitOrders(msg.sender, makerToken, takerToken, minValidSalt);
}
uint256 oldMinValidSalt =
stor.limitOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt
[msg.sender]
[address(makerToken)]
[address(takerToken)];
// New min salt must >= the old one.
if (oldMinValidSalt > minValidSalt) {
LibNativeOrdersRichErrors.
CancelSaltTooLowError(minValidSalt, oldMinValidSalt)
.rrevert();
/// @dev Cancel all limit orders for a given maker and pair with a salt less
/// than the value provided. The caller must be a signer registered to the maker.
/// Subsequent calls to this function with the same caller and pair require the
/// new salt to be >= the old salt.
/// @param maker the maker for whom the msg.sender is the signer.
/// @param makerToken The maker token.
/// @param takerToken The taker token.
/// @param minValidSalt The new minimum valid salt.
function cancelPairLimitOrdersWithSigner(
address maker,
IERC20TokenV06 makerToken,
IERC20TokenV06 takerToken,
uint256 minValidSalt
)
public
{
// verify that the signer is authorized for the maker
if (!isValidOrderSigner(maker, msg.sender)) {
LibNativeOrdersRichErrors.InvalidSignerError(
maker,
msg.sender
).rrevert();
}
stor.limitOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt
[msg.sender]
[address(makerToken)]
[address(takerToken)] = minValidSalt;
emit PairCancelledLimitOrders(
msg.sender,
address(makerToken),
address(takerToken),
minValidSalt
);
_cancelPairLimitOrders(maker, makerToken, takerToken, minValidSalt);
}
/// @dev Cancel all limit orders for a given maker and pair with a salt less
@@ -168,7 +169,47 @@ abstract contract NativeOrdersCancellation is
);
for (uint256 i = 0; i < makerTokens.length; ++i) {
cancelPairLimitOrders(
_cancelPairLimitOrders(
msg.sender,
makerTokens[i],
takerTokens[i],
minValidSalts[i]
);
}
}
/// @dev Cancel all limit orders for a given maker and pair with a salt less
/// than the value provided. The caller must be a signer registered to the maker.
/// Subsequent calls to this function with the same caller and pair require the
/// new salt to be >= the old salt.
/// @param maker the maker for whom the msg.sender is the signer.
/// @param makerTokens The maker tokens.
/// @param takerTokens The taker tokens.
/// @param minValidSalts The new minimum valid salts.
function batchCancelPairLimitOrdersWithSigner(
address maker,
IERC20TokenV06[] memory makerTokens,
IERC20TokenV06[] memory takerTokens,
uint256[] memory minValidSalts
)
public
{
require(
makerTokens.length == takerTokens.length &&
makerTokens.length == minValidSalts.length,
"NativeOrdersFeature/MISMATCHED_PAIR_ORDERS_ARRAY_LENGTHS"
);
if (!isValidOrderSigner(maker, msg.sender)) {
LibNativeOrdersRichErrors.InvalidSignerError(
maker,
msg.sender
).rrevert();
}
for (uint256 i = 0; i < makerTokens.length; ++i) {
_cancelPairLimitOrders(
maker,
makerTokens[i],
takerTokens[i],
minValidSalts[i]
@@ -190,33 +231,33 @@ abstract contract NativeOrdersCancellation is
)
public
{
LibNativeOrdersStorage.Storage storage stor =
LibNativeOrdersStorage.getStorage();
_cancelPairRfqOrders(msg.sender, makerToken, takerToken, minValidSalt);
}
uint256 oldMinValidSalt =
stor.rfqOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt
[msg.sender]
[address(makerToken)]
[address(takerToken)];
// New min salt must >= the old one.
if (oldMinValidSalt > minValidSalt) {
LibNativeOrdersRichErrors.
CancelSaltTooLowError(minValidSalt, oldMinValidSalt)
.rrevert();
/// @dev Cancel all RFQ orders for a given maker and pair with a salt less
/// than the value provided. The caller must be a signer registered to the maker.
/// Subsequent calls to this function with the same caller and pair require the
/// new salt to be >= the old salt.
/// @param maker the maker for whom the msg.sender is the signer.
/// @param makerToken The maker token.
/// @param takerToken The taker token.
/// @param minValidSalt The new minimum valid salt.
function cancelPairRfqOrdersWithSigner(
address maker,
IERC20TokenV06 makerToken,
IERC20TokenV06 takerToken,
uint256 minValidSalt
)
public
{
if (!isValidOrderSigner(maker, msg.sender)) {
LibNativeOrdersRichErrors.InvalidSignerError(
maker,
msg.sender
).rrevert();
}
stor.rfqOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt
[msg.sender]
[address(makerToken)]
[address(takerToken)] = minValidSalt;
emit PairCancelledRfqOrders(
msg.sender,
address(makerToken),
address(takerToken),
minValidSalt
);
_cancelPairRfqOrders(maker, makerToken, takerToken, minValidSalt);
}
/// @dev Cancel all RFQ orders for a given maker and pair with a salt less
@@ -240,7 +281,47 @@ abstract contract NativeOrdersCancellation is
);
for (uint256 i = 0; i < makerTokens.length; ++i) {
cancelPairRfqOrders(
_cancelPairRfqOrders(
msg.sender,
makerTokens[i],
takerTokens[i],
minValidSalts[i]
);
}
}
/// @dev Cancel all RFQ orders for a given maker and pairs with salts less
/// than the values provided. The caller must be a signer registered to the maker.
/// Subsequent calls to this function with the same caller and pair require the
/// new salt to be >= the old salt.
/// @param maker the maker for whom the msg.sender is the signer.
/// @param makerTokens The maker tokens.
/// @param takerTokens The taker tokens.
/// @param minValidSalts The new minimum valid salts.
function batchCancelPairRfqOrdersWithSigner(
address maker,
IERC20TokenV06[] memory makerTokens,
IERC20TokenV06[] memory takerTokens,
uint256[] memory minValidSalts
)
public
{
require(
makerTokens.length == takerTokens.length &&
makerTokens.length == minValidSalts.length,
"NativeOrdersFeature/MISMATCHED_PAIR_ORDERS_ARRAY_LENGTHS"
);
if (!isValidOrderSigner(maker, msg.sender)) {
LibNativeOrdersRichErrors.InvalidSignerError(
maker,
msg.sender
).rrevert();
}
for (uint256 i = 0; i < makerTokens.length; ++i) {
_cancelPairRfqOrders(
maker,
makerTokens[i],
takerTokens[i],
minValidSalts[i]
@@ -262,4 +343,90 @@ abstract contract NativeOrdersCancellation is
emit OrderCancelled(orderHash, maker);
}
/// @dev Cancel all RFQ orders for a given maker and pair with a salt less
/// than the value provided.
/// @param maker The target maker address
/// @param makerToken The maker token.
/// @param takerToken The taker token.
/// @param minValidSalt The new minimum valid salt.
function _cancelPairRfqOrders(
address maker,
IERC20TokenV06 makerToken,
IERC20TokenV06 takerToken,
uint256 minValidSalt
)
private
{
LibNativeOrdersStorage.Storage storage stor =
LibNativeOrdersStorage.getStorage();
uint256 oldMinValidSalt =
stor.rfqOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt
[maker]
[address(makerToken)]
[address(takerToken)];
// New min salt must >= the old one.
if (oldMinValidSalt > minValidSalt) {
LibNativeOrdersRichErrors.
CancelSaltTooLowError(minValidSalt, oldMinValidSalt)
.rrevert();
}
stor.rfqOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt
[maker]
[address(makerToken)]
[address(takerToken)] = minValidSalt;
emit PairCancelledRfqOrders(
maker,
address(makerToken),
address(takerToken),
minValidSalt
);
}
/// @dev Cancel all limit orders for a given maker and pair with a salt less
/// than the value provided.
/// @param maker The target maker address
/// @param makerToken The maker token.
/// @param takerToken The taker token.
/// @param minValidSalt The new minimum valid salt.
function _cancelPairLimitOrders(
address maker,
IERC20TokenV06 makerToken,
IERC20TokenV06 takerToken,
uint256 minValidSalt
)
private
{
LibNativeOrdersStorage.Storage storage stor =
LibNativeOrdersStorage.getStorage();
uint256 oldMinValidSalt =
stor.limitOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt
[maker]
[address(makerToken)]
[address(takerToken)];
// New min salt must >= the old one.
if (oldMinValidSalt > minValidSalt) {
LibNativeOrdersRichErrors.
CancelSaltTooLowError(minValidSalt, oldMinValidSalt)
.rrevert();
}
stor.limitOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt
[maker]
[address(makerToken)]
[address(takerToken)] = minValidSalt;
emit PairCancelledLimitOrders(
maker,
address(makerToken),
address(takerToken),
minValidSalt
);
}
}

View File

@@ -168,8 +168,10 @@ abstract contract NativeOrdersInfo is
orderInfo: orderInfo
})
);
isSignatureValid = order.maker ==
LibSignature.getSignerOfHash(orderInfo.orderHash, signature);
address signerOfHash = LibSignature.getSignerOfHash(orderInfo.orderHash, signature);
isSignatureValid =
(order.maker == signerOfHash) ||
isValidOrderSigner(order.maker, signerOfHash);
}
/// @dev Get order info, fillable amount, and signature validity for an RFQ order.
@@ -202,8 +204,10 @@ abstract contract NativeOrdersInfo is
orderInfo: orderInfo
})
);
isSignatureValid = order.maker ==
LibSignature.getSignerOfHash(orderInfo.orderHash, signature);
address signerOfHash = LibSignature.getSignerOfHash(orderInfo.orderHash, signature);
isSignatureValid =
(order.maker == signerOfHash) ||
isValidOrderSigner(order.maker, signerOfHash);
}
/// @dev Batch version of `getLimitOrderRelevantState()`, without reverting.
@@ -389,4 +393,22 @@ abstract contract NativeOrdersInfo is
uint256(params.orderTakerAmount)
).safeDowncastToUint128();
}
/// @dev checks if a given address is registered to sign on behalf of a maker address
/// @param maker The maker address encoded in an order (can be a contract)
/// @param signer The address that is providing a signature
function isValidOrderSigner(
address maker,
address signer
)
public
view
returns (bool isValid)
{
// returns false if it the mapping doesn't exist
return LibNativeOrdersStorage.getStorage()
.orderSignerRegistry
[maker]
[signer];
}
}

View File

@@ -370,7 +370,7 @@ abstract contract NativeOrdersSettlement is
orderInfo.orderHash,
params.signature
);
if (signer != params.order.maker) {
if (signer != params.order.maker && !isValidOrderSigner(params.order.maker, signer)) {
LibNativeOrdersRichErrors.OrderNotSignedByMakerError(
orderInfo.orderHash,
signer,
@@ -478,7 +478,7 @@ abstract contract NativeOrdersSettlement is
// Signature must be valid for the order.
{
address signer = LibSignature.getSignerOfHash(orderInfo.orderHash, signature);
if (signer != order.maker) {
if (signer != order.maker && !isValidOrderSigner(order.maker, signer)) {
LibNativeOrdersRichErrors.OrderNotSignedByMakerError(
orderInfo.orderHash,
signer,
@@ -565,4 +565,21 @@ abstract contract NativeOrdersSettlement is
makerTokenFilledAmount
);
}
/// @dev register a signer who can sign on behalf of msg.sender
/// @param signer The address from which you plan to generate signatures
/// @param allowed True to register, false to unregister.
function registerAllowedOrderSigner(
address signer,
bool allowed
)
external
{
LibNativeOrdersStorage.Storage storage stor =
LibNativeOrdersStorage.getStorage();
stor.orderSignerRegistry[msg.sender][signer] = allowed;
emit OrderSignerRegistered(msg.sender, signer, allowed);
}
}

View File

@@ -43,6 +43,9 @@ library LibNativeOrdersStorage {
// For a given order origin, which tx.origin addresses are allowed to
// fill the order.
mapping(address => mapping(address => bool)) originRegistry;
// For a given maker address, which addresses are allowed to
// sign on its behalf.
mapping(address => mapping(address => bool)) orderSignerRegistry;
}
/// @dev Get the storage bucket for this contract.

View File

@@ -23,6 +23,7 @@ pragma experimental ABIEncoderV2;
import "./IBridgeAdapter.sol";
import "./BridgeProtocols.sol";
import "./mixins/MixinBalancer.sol";
import "./mixins/MixinBalancerV2.sol";
import "./mixins/MixinBancor.sol";
import "./mixins/MixinCoFiX.sol";
import "./mixins/MixinCurve.sol";
@@ -38,11 +39,13 @@ import "./mixins/MixinOasis.sol";
import "./mixins/MixinShell.sol";
import "./mixins/MixinUniswap.sol";
import "./mixins/MixinUniswapV2.sol";
import "./mixins/MixinUniswapV3.sol";
import "./mixins/MixinZeroExBridge.sol";
contract BridgeAdapter is
IBridgeAdapter,
MixinBalancer,
MixinBalancerV2,
MixinBancor,
MixinCoFiX,
MixinCurve,
@@ -58,14 +61,16 @@ contract BridgeAdapter is
MixinShell,
MixinUniswap,
MixinUniswapV2,
MixinUniswapV3,
MixinZeroExBridge
{
constructor(IEtherTokenV06 weth)
public
MixinBalancer()
MixinBalancerV2()
MixinBancor(weth)
MixinCoFiX()
MixinCurve()
MixinCurve(weth)
MixinCryptoCom()
MixinDodo()
MixinDodoV2()
@@ -78,6 +83,7 @@ contract BridgeAdapter is
MixinShell()
MixinUniswap(weth)
MixinUniswapV2()
MixinUniswapV3()
MixinZeroExBridge()
{}
@@ -99,6 +105,12 @@ contract BridgeAdapter is
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.UNISWAPV3) {
boughtAmount = _tradeUniswapV3(
sellToken,
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.UNISWAPV2) {
boughtAmount = _tradeUniswapV2(
buyToken,
@@ -119,6 +131,13 @@ contract BridgeAdapter is
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.BALANCERV2) {
boughtAmount = _tradeBalancerV2(
sellToken,
buyToken,
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.KYBER) {
boughtAmount = _tradeKyber(
sellToken,

View File

@@ -44,4 +44,6 @@ library BridgeProtocols {
uint128 internal constant COFIX = 14;
uint128 internal constant NERVE = 15;
uint128 internal constant MAKERPSM = 16;
uint128 internal constant BALANCERV2 = 17;
uint128 internal constant UNISWAPV3 = 18;
}

View File

@@ -0,0 +1,117 @@
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
interface IBalancerV2Vault {
enum SwapKind { GIVEN_IN, GIVEN_OUT }
/**
* @dev Performs a swap with a single Pool.
*
* If the swap is given in (the number of tokens to send to the Pool is known), returns the amount of tokens
* taken from the Pool, which must be greater than or equal to `limit`.
*
* If the swap is given out (the number of tokens to take from the Pool is known), returns the amount of
* tokens sent to the Pool, which must be less than or equal to `limit`.
*
* Internal Balance usage and the recipient are determined by the `funds` struct.
*
* Emits a `Swap` event.
* For full documentation see https://github.com/balancer-labs/balancer-core-v2/blob/master/contracts/vault/interfaces/IVault.sol
*/
function swap(
SingleSwap calldata request,
FundManagement calldata funds,
uint256 limit,
uint256 deadline
) external payable returns (uint256);
struct SingleSwap {
bytes32 poolId;
SwapKind kind;
IERC20TokenV06 assetIn;
IERC20TokenV06 assetOut;
uint256 amount;
bytes userData;
}
struct FundManagement {
address sender;
bool fromInternalBalance;
address payable recipient;
bool toInternalBalance;
}
}
contract MixinBalancerV2 {
using LibERC20TokenV06 for IERC20TokenV06;
struct BalancerV2BridgeData {
IBalancerV2Vault vault;
bytes32 poolId;
}
function _tradeBalancerV2(
IERC20TokenV06 sellToken,
IERC20TokenV06 buyToken,
uint256 sellAmount,
bytes memory bridgeData
)
internal
returns (uint256 boughtAmount)
{
// Decode the bridge data.
BalancerV2BridgeData memory data = abi.decode(bridgeData, (BalancerV2BridgeData));
// Grant an allowance to the exchange to spend `fromTokenAddress` token.
sellToken.approveIfBelow(address(data.vault), sellAmount);
// Sell the entire sellAmount
IBalancerV2Vault.SingleSwap memory request = IBalancerV2Vault.SingleSwap({
poolId: data.poolId,
kind: IBalancerV2Vault.SwapKind.GIVEN_IN,
assetIn: sellToken,
assetOut: buyToken,
amount: sellAmount, // amount in
userData: ""
});
IBalancerV2Vault.FundManagement memory funds = IBalancerV2Vault.FundManagement({
sender: address(this),
fromInternalBalance: false,
recipient: payable(address(this)),
toInternalBalance: false
});
boughtAmount = data.vault.swap(
request,
funds,
1, // min amount out
block.timestamp // expires after this block
);
return boughtAmount;
}
}

View File

@@ -21,6 +21,7 @@ pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
import "@0x/contracts-erc20/contracts/src/v06/IEtherTokenV06.sol";
import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
@@ -31,6 +32,15 @@ contract MixinCurve {
using LibSafeMathV06 for uint256;
using LibRichErrorsV06 for bytes;
/// @dev Mainnet address of the WETH contract.
IEtherTokenV06 private immutable WETH;
constructor(IEtherTokenV06 weth)
public
{
WETH = weth;
}
struct CurveBridgeData {
address curveAddress;
@@ -50,10 +60,17 @@ contract MixinCurve {
{
// Decode the bridge data to get the Curve metadata.
CurveBridgeData memory data = abi.decode(bridgeData, (CurveBridgeData));
sellToken.approveIfBelow(data.curveAddress, sellAmount);
uint256 payableAmount;
if (sellToken == WETH) {
payableAmount = sellAmount;
WETH.withdraw(sellAmount);
} else {
sellToken.approveIfBelow(data.curveAddress, sellAmount);
}
uint256 beforeBalance = buyToken.balanceOf(address(this));
(bool success, bytes memory resultData) =
data.curveAddress.call(abi.encodeWithSelector(
data.curveAddress.call{value: payableAmount}(abi.encodeWithSelector(
data.exchangeFunctionSelector,
data.fromCoinIdx,
data.toCoinIdx,
@@ -65,6 +82,12 @@ contract MixinCurve {
if (!success) {
resultData.rrevert();
}
if (buyToken == WETH) {
boughtAmount = address(this).balance;
WETH.deposit{ value: boughtAmount }();
}
return buyToken.balanceOf(address(this)).safeSub(beforeBalance);
}
}

View File

@@ -0,0 +1,70 @@
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2021 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
import "../IBridgeAdapter.sol";
interface IUniswapV3Router {
struct ExactInputParams {
bytes path;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
}
function exactInput(ExactInputParams memory params)
external
payable
returns (uint256 amountOut);
}
contract MixinUniswapV3 {
using LibERC20TokenV06 for IERC20TokenV06;
function _tradeUniswapV3(
IERC20TokenV06 sellToken,
uint256 sellAmount,
bytes memory bridgeData
)
internal
returns (uint256 boughtAmount)
{
(IUniswapV3Router router, bytes memory path) =
abi.decode(bridgeData, (IUniswapV3Router, bytes));
// Grant the Uniswap router an allowance to sell the sell token.
sellToken.approveIfBelow(address(router), sellAmount);
boughtAmount = router.exactInput(IUniswapV3Router.ExactInputParams({
path: path,
recipient: address(this),
deadline: block.timestamp,
amountIn: sellAmount,
amountOutMinimum: 1
}));
}
}

View File

@@ -0,0 +1,55 @@
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2021 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "@0x/contracts-utils/contracts/src/v06/OwnableV06.sol";
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
import "../src/IZeroEx.sol";
contract TestOrderSignerRegistryWithContractWallet is OwnableV06 {
IZeroEx immutable zeroex;
constructor(IZeroEx _zeroex) public {
zeroex = _zeroex;
}
function registerAllowedOrderSigner(
address signer,
bool allowed
)
external
onlyOwner
{
zeroex.registerAllowedOrderSigner(signer, allowed);
}
function approveERC20(
IERC20TokenV06 token,
address spender,
uint256 value
)
external
onlyOwner
{
token.approve(spender, value);
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-zero-ex",
"version": "0.21.0",
"version": "0.23.0",
"engines": {
"node": ">=6.12"
},
@@ -43,7 +43,7 @@
"config": {
"publicInterfaceContracts": "IZeroEx,ZeroEx,FullMigration,InitialMigration,IFlashWallet,IERC20Transformer,IOwnableFeature,ISimpleFunctionRegistryFeature,ITransformERC20Feature,FillQuoteTransformer,PayTakerTransformer,PositiveSlippageFeeTransformer,WethTransformer,OwnableFeature,SimpleFunctionRegistryFeature,TransformERC20Feature,AffiliateFeeTransformer,MetaTransactionsFeature,LogMetadataTransformer,BridgeAdapter,LiquidityProviderFeature,ILiquidityProviderFeature,NativeOrdersFeature,INativeOrdersFeature,FeeCollectorController,FeeCollector,CurveLiquidityProvider,BatchFillNativeOrdersFeature,IBatchFillNativeOrdersFeature,MultiplexFeature,IMultiplexFeature",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
"abis": "./test/generated-artifacts/@(AffiliateFeeTransformer|BatchFillNativeOrdersFeature|BootstrapFeature|BridgeAdapter|BridgeProtocols|CurveLiquidityProvider|FeeCollector|FeeCollectorController|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinProtocolFees|FixinReentrancyGuard|FixinTokenSpender|FlashWallet|FullMigration|IBatchFillNativeOrdersFeature|IBootstrapFeature|IBridgeAdapter|IERC20Bridge|IERC20Transformer|IFeature|IFlashWallet|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IMooniswapPool|IMultiplexFeature|INativeOrdersEvents|INativeOrdersFeature|IOwnableFeature|IPancakeSwapFeature|ISimpleFunctionRegistryFeature|IStaking|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IUniswapV2Pair|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC20Transformer|LibFeeCollector|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibNativeOrder|LibNativeOrdersRichErrors|LibNativeOrdersStorage|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinBalancer|MixinBancor|MixinCoFiX|MixinCryptoCom|MixinCurve|MixinDodo|MixinDodoV2|MixinKyber|MixinMStable|MixinMakerPSM|MixinMooniswap|MixinNerve|MixinOasis|MixinShell|MixinUniswap|MixinUniswapV2|MixinZeroExBridge|MooniswapLiquidityProvider|MultiplexFeature|NativeOrdersCancellation|NativeOrdersFeature|NativeOrdersInfo|NativeOrdersProtocolFees|NativeOrdersSettlement|OwnableFeature|PancakeSwapFeature|PayTakerTransformer|PermissionlessTransformerDeployer|PositiveSlippageFeeTransformer|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestCurve|TestDelegateCaller|TestFeeCollectorController|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFixinProtocolFees|TestFixinTokenSpender|TestFullMigration|TestInitialMigration|TestLibNativeOrder|TestLibSignature|TestLiquidityProvider|TestMetaTransactionsNativeOrdersFeature|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC20Token|TestMooniswap|TestNativeOrdersFeature|TestPermissionlessTransformerDeployerSuicidal|TestPermissionlessTransformerDeployerTransformer|TestRfqOriginRegistration|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestStaking|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestWeth|TestWethTransformerHost|TestZeroExFeature|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|WethTransformer|ZeroEx|ZeroExOptimized).json"
"abis": "./test/generated-artifacts/@(AffiliateFeeTransformer|BatchFillNativeOrdersFeature|BootstrapFeature|BridgeAdapter|BridgeProtocols|CurveLiquidityProvider|FeeCollector|FeeCollectorController|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinProtocolFees|FixinReentrancyGuard|FixinTokenSpender|FlashWallet|FullMigration|IBatchFillNativeOrdersFeature|IBootstrapFeature|IBridgeAdapter|IERC20Bridge|IERC20Transformer|IFeature|IFlashWallet|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IMooniswapPool|IMultiplexFeature|INativeOrdersEvents|INativeOrdersFeature|IOwnableFeature|IPancakeSwapFeature|ISimpleFunctionRegistryFeature|IStaking|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IUniswapV2Pair|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC20Transformer|LibFeeCollector|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibNativeOrder|LibNativeOrdersRichErrors|LibNativeOrdersStorage|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinBalancer|MixinBalancerV2|MixinBancor|MixinCoFiX|MixinCryptoCom|MixinCurve|MixinDodo|MixinDodoV2|MixinKyber|MixinMStable|MixinMakerPSM|MixinMooniswap|MixinNerve|MixinOasis|MixinShell|MixinUniswap|MixinUniswapV2|MixinUniswapV3|MixinZeroExBridge|MooniswapLiquidityProvider|MultiplexFeature|NativeOrdersCancellation|NativeOrdersFeature|NativeOrdersInfo|NativeOrdersProtocolFees|NativeOrdersSettlement|OwnableFeature|PancakeSwapFeature|PayTakerTransformer|PermissionlessTransformerDeployer|PositiveSlippageFeeTransformer|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestCurve|TestDelegateCaller|TestFeeCollectorController|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFixinProtocolFees|TestFixinTokenSpender|TestFullMigration|TestInitialMigration|TestLibNativeOrder|TestLibSignature|TestLiquidityProvider|TestMetaTransactionsNativeOrdersFeature|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC20Token|TestMooniswap|TestNativeOrdersFeature|TestOrderSignerRegistryWithContractWallet|TestPermissionlessTransformerDeployerSuicidal|TestPermissionlessTransformerDeployerTransformer|TestRfqOriginRegistration|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestStaking|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestWeth|TestWethTransformerHost|TestZeroExFeature|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|WethTransformer|ZeroEx|ZeroExOptimized).json"
},
"repository": {
"type": "git",
@@ -55,16 +55,16 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
"devDependencies": {
"@0x/abi-gen": "^5.4.21",
"@0x/contract-addresses": "^6.0.0",
"@0x/contracts-erc20": "^3.3.6",
"@0x/contracts-gen": "^2.0.32",
"@0x/contracts-test-utils": "^5.3.24",
"@0x/dev-utils": "^4.2.1",
"@0x/order-utils": "^10.4.19",
"@0x/sol-compiler": "^4.6.1",
"@0x/abi-gen": "^5.6.0",
"@0x/contract-addresses": "^6.1.0",
"@0x/contracts-erc20": "^3.3.8",
"@0x/contracts-gen": "^2.0.38",
"@0x/contracts-test-utils": "^5.4.0",
"@0x/dev-utils": "^4.2.7",
"@0x/order-utils": "^10.4.21",
"@0x/sol-compiler": "^4.7.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/tslint-config": "^4.1.4",
"@types/isomorphic-fetch": "^0.0.35",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -82,15 +82,15 @@
"typescript": "4.2.2"
},
"dependencies": {
"@0x/base-contract": "^6.2.18",
"@0x/protocol-utils": "^1.4.0",
"@0x/subproviders": "^6.4.1",
"@0x/types": "^3.3.1",
"@0x/typescript-typings": "^5.1.6",
"@0x/utils": "^6.2.0",
"@0x/web3-wrapper": "^7.4.1",
"ethereum-types": "^3.4.0",
"ethereumjs-util": "^5.1.1"
"@0x/base-contract": "^6.4.0",
"@0x/protocol-utils": "^1.6.0",
"@0x/subproviders": "^6.5.3",
"@0x/types": "^3.3.3",
"@0x/typescript-typings": "^5.2.0",
"@0x/utils": "^6.4.3",
"@0x/web3-wrapper": "^7.5.3",
"ethereum-types": "^3.5.0",
"ethereumjs-util": "^7.0.10"
},
"publishConfig": {
"access": "public"

View File

@@ -20,6 +20,7 @@ export function rlpEncodeNonce(nonce: number): string {
return ethjs.bufferToHex(ethjs.toBuffer(nonce));
} else {
const rlpNonce = ethjs.toBuffer(nonce);
// tslint:disable-next-line: restrict-plus-operands
return hexUtils.concat(rlpNonce.length + 0x80, ethjs.bufferToHex(rlpNonce));
}
}

View File

@@ -76,6 +76,7 @@ import * as LiquidityProviderSandbox from '../test/generated-artifacts/Liquidity
import * as LogMetadataTransformer from '../test/generated-artifacts/LogMetadataTransformer.json';
import * as MetaTransactionsFeature from '../test/generated-artifacts/MetaTransactionsFeature.json';
import * as MixinBalancer from '../test/generated-artifacts/MixinBalancer.json';
import * as MixinBalancerV2 from '../test/generated-artifacts/MixinBalancerV2.json';
import * as MixinBancor from '../test/generated-artifacts/MixinBancor.json';
import * as MixinCoFiX from '../test/generated-artifacts/MixinCoFiX.json';
import * as MixinCryptoCom from '../test/generated-artifacts/MixinCryptoCom.json';
@@ -91,6 +92,7 @@ import * as MixinOasis from '../test/generated-artifacts/MixinOasis.json';
import * as MixinShell from '../test/generated-artifacts/MixinShell.json';
import * as MixinUniswap from '../test/generated-artifacts/MixinUniswap.json';
import * as MixinUniswapV2 from '../test/generated-artifacts/MixinUniswapV2.json';
import * as MixinUniswapV3 from '../test/generated-artifacts/MixinUniswapV3.json';
import * as MixinZeroExBridge from '../test/generated-artifacts/MixinZeroExBridge.json';
import * as MooniswapLiquidityProvider from '../test/generated-artifacts/MooniswapLiquidityProvider.json';
import * as MultiplexFeature from '../test/generated-artifacts/MultiplexFeature.json';
@@ -127,6 +129,7 @@ import * as TestMintableERC20Token from '../test/generated-artifacts/TestMintabl
import * as TestMintTokenERC20Transformer from '../test/generated-artifacts/TestMintTokenERC20Transformer.json';
import * as TestMooniswap from '../test/generated-artifacts/TestMooniswap.json';
import * as TestNativeOrdersFeature from '../test/generated-artifacts/TestNativeOrdersFeature.json';
import * as TestOrderSignerRegistryWithContractWallet from '../test/generated-artifacts/TestOrderSignerRegistryWithContractWallet.json';
import * as TestPermissionlessTransformerDeployerSuicidal from '../test/generated-artifacts/TestPermissionlessTransformerDeployerSuicidal.json';
import * as TestPermissionlessTransformerDeployerTransformer from '../test/generated-artifacts/TestPermissionlessTransformerDeployerTransformer.json';
import * as TestRfqOriginRegistration from '../test/generated-artifacts/TestRfqOriginRegistration.json';
@@ -234,6 +237,7 @@ export const artifacts = {
BridgeProtocols: BridgeProtocols as ContractArtifact,
IBridgeAdapter: IBridgeAdapter as ContractArtifact,
MixinBalancer: MixinBalancer as ContractArtifact,
MixinBalancerV2: MixinBalancerV2 as ContractArtifact,
MixinBancor: MixinBancor as ContractArtifact,
MixinCoFiX: MixinCoFiX as ContractArtifact,
MixinCryptoCom: MixinCryptoCom as ContractArtifact,
@@ -249,6 +253,7 @@ export const artifacts = {
MixinShell: MixinShell as ContractArtifact,
MixinUniswap: MixinUniswap as ContractArtifact,
MixinUniswapV2: MixinUniswapV2 as ContractArtifact,
MixinUniswapV3: MixinUniswapV3 as ContractArtifact,
MixinZeroExBridge: MixinZeroExBridge as ContractArtifact,
ILiquidityProvider: ILiquidityProvider as ContractArtifact,
IMooniswapPool: IMooniswapPool as ContractArtifact,
@@ -278,6 +283,7 @@ export const artifacts = {
TestMintableERC20Token: TestMintableERC20Token as ContractArtifact,
TestMooniswap: TestMooniswap as ContractArtifact,
TestNativeOrdersFeature: TestNativeOrdersFeature as ContractArtifact,
TestOrderSignerRegistryWithContractWallet: TestOrderSignerRegistryWithContractWallet as ContractArtifact,
TestPermissionlessTransformerDeployerSuicidal: TestPermissionlessTransformerDeployerSuicidal as ContractArtifact,
TestPermissionlessTransformerDeployerTransformer: TestPermissionlessTransformerDeployerTransformer as ContractArtifact,
TestRfqOriginRegistration: TestRfqOriginRegistration as ContractArtifact,

View File

@@ -7,7 +7,15 @@ import {
randomAddress,
verifyEventsFromLogs,
} from '@0x/contracts-test-utils';
import { LimitOrder, LimitOrderFields, OrderStatus, RevertErrors, RfqOrder, RfqOrderFields } from '@0x/protocol-utils';
import {
LimitOrder,
LimitOrderFields,
OrderStatus,
RevertErrors,
RfqOrder,
RfqOrderFields,
SignatureType,
} from '@0x/protocol-utils';
import { AnyRevertError, BigNumber } from '@0x/utils';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
@@ -25,7 +33,11 @@ import {
getRandomRfqOrder,
NativeOrdersTestEnvironment,
} from '../utils/orders';
import { TestMintableERC20TokenContract, TestRfqOriginRegistrationContract } from '../wrappers';
import {
TestMintableERC20TokenContract,
TestOrderSignerRegistryWithContractWalletContract,
TestRfqOriginRegistrationContract,
} from '../wrappers';
blockchainTests.resets('NativeOrdersFeature', env => {
const { NULL_ADDRESS, MAX_UINT256, NULL_BYTES32, ZERO_AMOUNT } = constants;
@@ -36,17 +48,28 @@ blockchainTests.resets('NativeOrdersFeature', env => {
let taker: string;
let notMaker: string;
let notTaker: string;
let contractWalletOwner: string;
let contractWalletSigner: string;
let zeroEx: IZeroExContract;
let verifyingContract: string;
let makerToken: TestMintableERC20TokenContract;
let takerToken: TestMintableERC20TokenContract;
let wethToken: TestMintableERC20TokenContract;
let testRfqOriginRegistration: TestRfqOriginRegistrationContract;
let contractWallet: TestOrderSignerRegistryWithContractWalletContract;
let testUtils: NativeOrdersTestEnvironment;
before(async () => {
let owner;
[owner, maker, taker, notMaker, notTaker] = await env.getAccountAddressesAsync();
[
owner,
maker,
taker,
notMaker,
notTaker,
contractWalletOwner,
contractWalletSigner,
] = await env.getAccountAddressesAsync();
[makerToken, takerToken, wethToken] = await Promise.all(
[...new Array(3)].map(async () =>
TestMintableERC20TokenContract.deployFrom0xArtifactAsync(
@@ -82,6 +105,21 @@ blockchainTests.resets('NativeOrdersFeature', env => {
env.txDefaults,
artifacts,
);
// contract wallet for signer delegation
contractWallet = await TestOrderSignerRegistryWithContractWalletContract.deployFrom0xArtifactAsync(
artifacts.TestOrderSignerRegistryWithContractWallet,
env.provider,
{
from: contractWalletOwner,
},
artifacts,
zeroEx.address,
);
await contractWallet
.approveERC20(makerToken.address, zeroEx.address, MAX_UINT256)
.awaitTransactionSuccessAsync({ from: contractWalletOwner });
testUtils = new NativeOrdersTestEnvironment(
maker,
taker,
@@ -1569,4 +1607,432 @@ blockchainTests.resets('NativeOrdersFeature', env => {
}
});
});
describe('registerAllowedSigner()', () => {
it('fires appropriate events', async () => {
const receiptAllow = await contractWallet
.registerAllowedOrderSigner(contractWalletSigner, true)
.awaitTransactionSuccessAsync({ from: contractWalletOwner });
verifyEventsFromLogs(
receiptAllow.logs,
[
{
maker: contractWallet.address,
signer: contractWalletSigner,
allowed: true,
},
],
IZeroExEvents.OrderSignerRegistered,
);
// then disallow signer
const receiptDisallow = await contractWallet
.registerAllowedOrderSigner(contractWalletSigner, false)
.awaitTransactionSuccessAsync({ from: contractWalletOwner });
verifyEventsFromLogs(
receiptDisallow.logs,
[
{
maker: contractWallet.address,
signer: contractWalletSigner,
allowed: false,
},
],
IZeroExEvents.OrderSignerRegistered,
);
});
it('allows for fills on orders signed by a approved signer', async () => {
const order = getTestRfqOrder({ maker: contractWallet.address });
const sig = await order.getSignatureWithProviderAsync(
env.provider,
SignatureType.EthSign,
contractWalletSigner,
);
// covers taker
await testUtils.prepareBalancesForOrdersAsync([order]);
// need to provide contract wallet with a balance
await makerToken.mint(contractWallet.address, order.makerAmount).awaitTransactionSuccessAsync();
await contractWallet
.registerAllowedOrderSigner(contractWalletSigner, true)
.awaitTransactionSuccessAsync({ from: contractWalletOwner });
await zeroEx.fillRfqOrder(order, sig, order.takerAmount).awaitTransactionSuccessAsync({ from: taker });
const info = await zeroEx.getRfqOrderInfo(order).callAsync();
assertOrderInfoEquals(info, {
status: OrderStatus.Filled,
orderHash: order.getHash(),
takerTokenFilledAmount: order.takerAmount,
});
});
it('disallows fills if the signer is revoked', async () => {
const order = getTestRfqOrder({ maker: contractWallet.address });
const sig = await order.getSignatureWithProviderAsync(
env.provider,
SignatureType.EthSign,
contractWalletSigner,
);
// covers taker
await testUtils.prepareBalancesForOrdersAsync([order]);
// need to provide contract wallet with a balance
await makerToken.mint(contractWallet.address, order.makerAmount).awaitTransactionSuccessAsync();
// first allow signer
await contractWallet
.registerAllowedOrderSigner(contractWalletSigner, true)
.awaitTransactionSuccessAsync({ from: contractWalletOwner });
// then disallow signer
await contractWallet
.registerAllowedOrderSigner(contractWalletSigner, false)
.awaitTransactionSuccessAsync({ from: contractWalletOwner });
const tx = zeroEx.fillRfqOrder(order, sig, order.takerAmount).awaitTransactionSuccessAsync({ from: taker });
return expect(tx).to.revertWith(
new RevertErrors.NativeOrders.OrderNotSignedByMakerError(
order.getHash(),
contractWalletSigner,
order.maker,
),
);
});
it(`doesn't allow fills with an unapproved signer`, async () => {
const order = getTestRfqOrder({ maker: contractWallet.address });
const sig = await order.getSignatureWithProviderAsync(env.provider, SignatureType.EthSign, maker);
// covers taker
await testUtils.prepareBalancesForOrdersAsync([order]);
// need to provide contract wallet with a balance
await makerToken.mint(contractWallet.address, order.makerAmount).awaitTransactionSuccessAsync();
const tx = zeroEx.fillRfqOrder(order, sig, order.takerAmount).awaitTransactionSuccessAsync({ from: taker });
return expect(tx).to.revertWith(
new RevertErrors.NativeOrders.OrderNotSignedByMakerError(order.getHash(), maker, order.maker),
);
});
it(`allows an approved signer to cancel an RFQ order`, async () => {
const order = getTestRfqOrder({ maker: contractWallet.address });
await contractWallet
.registerAllowedOrderSigner(contractWalletSigner, true)
.awaitTransactionSuccessAsync({ from: contractWalletOwner });
const receipt = await zeroEx
.cancelRfqOrder(order)
.awaitTransactionSuccessAsync({ from: contractWalletSigner });
verifyEventsFromLogs(
receipt.logs,
[{ maker: contractWallet.address, orderHash: order.getHash() }],
IZeroExEvents.OrderCancelled,
);
const info = await zeroEx.getRfqOrderInfo(order).callAsync();
assertOrderInfoEquals(info, {
status: OrderStatus.Cancelled,
orderHash: order.getHash(),
takerTokenFilledAmount: new BigNumber(0),
});
});
it(`allows an approved signer to cancel a limit order`, async () => {
const order = getTestLimitOrder({ maker: contractWallet.address });
await contractWallet
.registerAllowedOrderSigner(contractWalletSigner, true)
.awaitTransactionSuccessAsync({ from: contractWalletOwner });
const receipt = await zeroEx
.cancelLimitOrder(order)
.awaitTransactionSuccessAsync({ from: contractWalletSigner });
verifyEventsFromLogs(
receipt.logs,
[{ maker: contractWallet.address, orderHash: order.getHash() }],
IZeroExEvents.OrderCancelled,
);
const info = await zeroEx.getLimitOrderInfo(order).callAsync();
assertOrderInfoEquals(info, {
status: OrderStatus.Cancelled,
orderHash: order.getHash(),
takerTokenFilledAmount: new BigNumber(0),
});
});
it(`doesn't allow an unapproved signer to cancel an RFQ order`, async () => {
const order = getTestRfqOrder({ maker: contractWallet.address });
const tx = zeroEx.cancelRfqOrder(order).awaitTransactionSuccessAsync({ from: maker });
return expect(tx).to.revertWith(
new RevertErrors.NativeOrders.OnlyOrderMakerAllowed(order.getHash(), maker, order.maker),
);
});
it(`doesn't allow an unapproved signer to cancel a limit order`, async () => {
const order = getTestLimitOrder({ maker: contractWallet.address });
const tx = zeroEx.cancelLimitOrder(order).awaitTransactionSuccessAsync({ from: maker });
return expect(tx).to.revertWith(
new RevertErrors.NativeOrders.OnlyOrderMakerAllowed(order.getHash(), maker, order.maker),
);
});
it(`allows a signer to cancel pair RFQ orders`, async () => {
const order = getTestRfqOrder({ maker: contractWallet.address, salt: new BigNumber(1) });
await contractWallet
.registerAllowedOrderSigner(contractWalletSigner, true)
.awaitTransactionSuccessAsync({ from: contractWalletOwner });
// Cancel salts <= the order's
const minValidSalt = order.salt.plus(1);
const receipt = await zeroEx
.cancelPairRfqOrdersWithSigner(
contractWallet.address,
makerToken.address,
takerToken.address,
minValidSalt,
)
.awaitTransactionSuccessAsync({ from: contractWalletSigner });
verifyEventsFromLogs(
receipt.logs,
[
{
maker: contractWallet.address,
makerToken: makerToken.address,
takerToken: takerToken.address,
minValidSalt,
},
],
IZeroExEvents.PairCancelledRfqOrders,
);
const info = await zeroEx.getRfqOrderInfo(order).callAsync();
assertOrderInfoEquals(info, {
status: OrderStatus.Cancelled,
orderHash: order.getHash(),
takerTokenFilledAmount: new BigNumber(0),
});
});
it(`doesn't allow an unapproved signer to cancel pair RFQ orders`, async () => {
const minValidSalt = new BigNumber(2);
const tx = zeroEx
.cancelPairRfqOrdersWithSigner(
contractWallet.address,
makerToken.address,
takerToken.address,
minValidSalt,
)
.awaitTransactionSuccessAsync({ from: maker });
return expect(tx).to.revertWith(
new RevertErrors.NativeOrders.InvalidSignerError(contractWallet.address, maker),
);
});
it(`allows a signer to cancel pair limit orders`, async () => {
const order = getTestLimitOrder({ maker: contractWallet.address, salt: new BigNumber(1) });
await contractWallet
.registerAllowedOrderSigner(contractWalletSigner, true)
.awaitTransactionSuccessAsync({ from: contractWalletOwner });
// Cancel salts <= the order's
const minValidSalt = order.salt.plus(1);
const receipt = await zeroEx
.cancelPairLimitOrdersWithSigner(
contractWallet.address,
makerToken.address,
takerToken.address,
minValidSalt,
)
.awaitTransactionSuccessAsync({ from: contractWalletSigner });
verifyEventsFromLogs(
receipt.logs,
[
{
maker: contractWallet.address,
makerToken: makerToken.address,
takerToken: takerToken.address,
minValidSalt,
},
],
IZeroExEvents.PairCancelledLimitOrders,
);
const info = await zeroEx.getLimitOrderInfo(order).callAsync();
assertOrderInfoEquals(info, {
status: OrderStatus.Cancelled,
orderHash: order.getHash(),
takerTokenFilledAmount: new BigNumber(0),
});
});
it(`doesn't allow an unapproved signer to cancel pair limit orders`, async () => {
const minValidSalt = new BigNumber(2);
const tx = zeroEx
.cancelPairLimitOrdersWithSigner(
contractWallet.address,
makerToken.address,
takerToken.address,
minValidSalt,
)
.awaitTransactionSuccessAsync({ from: maker });
return expect(tx).to.revertWith(
new RevertErrors.NativeOrders.InvalidSignerError(contractWallet.address, maker),
);
});
it(`allows a signer to cancel multiple RFQ order pairs`, async () => {
const orders = [
getTestRfqOrder({ maker: contractWallet.address, salt: new BigNumber(1) }),
// Flip the tokens for the other order.
getTestRfqOrder({
makerToken: takerToken.address,
takerToken: makerToken.address,
maker: contractWallet.address,
salt: new BigNumber(1),
}),
];
await contractWallet
.registerAllowedOrderSigner(contractWalletSigner, true)
.awaitTransactionSuccessAsync({ from: contractWalletOwner });
const minValidSalt = new BigNumber(2);
const receipt = await zeroEx
.batchCancelPairRfqOrdersWithSigner(
contractWallet.address,
[makerToken.address, takerToken.address],
[takerToken.address, makerToken.address],
[minValidSalt, minValidSalt],
)
.awaitTransactionSuccessAsync({ from: contractWalletSigner });
verifyEventsFromLogs(
receipt.logs,
[
{
maker: contractWallet.address,
makerToken: makerToken.address,
takerToken: takerToken.address,
minValidSalt,
},
{
maker: contractWallet.address,
makerToken: takerToken.address,
takerToken: makerToken.address,
minValidSalt,
},
],
IZeroExEvents.PairCancelledRfqOrders,
);
const statuses = (await Promise.all(orders.map(o => zeroEx.getRfqOrderInfo(o).callAsync()))).map(
oi => oi.status,
);
expect(statuses).to.deep.eq([OrderStatus.Cancelled, OrderStatus.Cancelled]);
});
it(`doesn't allow an unapproved signer to batch cancel pair rfq orders`, async () => {
const minValidSalt = new BigNumber(2);
const tx = zeroEx
.batchCancelPairRfqOrdersWithSigner(
contractWallet.address,
[makerToken.address, takerToken.address],
[takerToken.address, makerToken.address],
[minValidSalt, minValidSalt],
)
.awaitTransactionSuccessAsync({ from: maker });
return expect(tx).to.revertWith(
new RevertErrors.NativeOrders.InvalidSignerError(contractWallet.address, maker),
);
});
it(`allows a signer to cancel multiple limit order pairs`, async () => {
const orders = [
getTestLimitOrder({ maker: contractWallet.address, salt: new BigNumber(1) }),
// Flip the tokens for the other order.
getTestLimitOrder({
makerToken: takerToken.address,
takerToken: makerToken.address,
maker: contractWallet.address,
salt: new BigNumber(1),
}),
];
await contractWallet
.registerAllowedOrderSigner(contractWalletSigner, true)
.awaitTransactionSuccessAsync({ from: contractWalletOwner });
const minValidSalt = new BigNumber(2);
const receipt = await zeroEx
.batchCancelPairLimitOrdersWithSigner(
contractWallet.address,
[makerToken.address, takerToken.address],
[takerToken.address, makerToken.address],
[minValidSalt, minValidSalt],
)
.awaitTransactionSuccessAsync({ from: contractWalletSigner });
verifyEventsFromLogs(
receipt.logs,
[
{
maker: contractWallet.address,
makerToken: makerToken.address,
takerToken: takerToken.address,
minValidSalt,
},
{
maker: contractWallet.address,
makerToken: takerToken.address,
takerToken: makerToken.address,
minValidSalt,
},
],
IZeroExEvents.PairCancelledLimitOrders,
);
const statuses = (await Promise.all(orders.map(o => zeroEx.getLimitOrderInfo(o).callAsync()))).map(
oi => oi.status,
);
expect(statuses).to.deep.eq([OrderStatus.Cancelled, OrderStatus.Cancelled]);
});
it(`doesn't allow an unapproved signer to batch cancel pair limit orders`, async () => {
const minValidSalt = new BigNumber(2);
const tx = zeroEx
.batchCancelPairLimitOrdersWithSigner(
contractWallet.address,
[makerToken.address, takerToken.address],
[takerToken.address, makerToken.address],
[minValidSalt, minValidSalt],
)
.awaitTransactionSuccessAsync({ from: maker });
return expect(tx).to.revertWith(
new RevertErrors.NativeOrders.InvalidSignerError(contractWallet.address, maker),
);
});
});
});

View File

@@ -1,6 +1,5 @@
import { blockchainTests, expect, verifyEventsFromLogs } from '@0x/contracts-test-utils';
import { BigNumber, hexUtils } from '@0x/utils';
import * as ethjs from 'ethereumjs-util';
import { artifacts } from './artifacts';
import {
@@ -41,9 +40,9 @@ blockchainTests.resets('PermissionlessTransformerDeployer', env => {
it('deploys at predictable address', async () => {
const salt = hexUtils.random();
const targetAddress = await deployer.deploy(deployBytes, salt).callAsync();
const initCodeHash = hexUtils.toHex(ethjs.sha3(deployBytes));
const initCodeHash = hexUtils.hash(deployBytes);
const expectedAddress = hexUtils.slice(
hexUtils.toHex(ethjs.sha3(hexUtils.concat('0xFF', deployer.address, salt, initCodeHash))),
hexUtils.hash(hexUtils.concat('0xFF', deployer.address, salt, initCodeHash)),
12,
);
@@ -94,7 +93,7 @@ blockchainTests.resets('PermissionlessTransformerDeployer', env => {
const targetAddress = await deployer.deploy(deployBytes, salt).callAsync({ from: sender });
await deployer.deploy(deployBytes, salt).awaitTransactionSuccessAsync({ from: sender });
expect(hexUtils.toHex(await deployer.toInitCodeHash(targetAddress).callAsync())).to.eq(
hexUtils.toHex(ethjs.sha3(deployBytes)),
hexUtils.hash(deployBytes),
);
});
});

View File

@@ -74,6 +74,7 @@ export * from '../test/generated-wrappers/liquidity_provider_sandbox';
export * from '../test/generated-wrappers/log_metadata_transformer';
export * from '../test/generated-wrappers/meta_transactions_feature';
export * from '../test/generated-wrappers/mixin_balancer';
export * from '../test/generated-wrappers/mixin_balancer_v2';
export * from '../test/generated-wrappers/mixin_bancor';
export * from '../test/generated-wrappers/mixin_co_fi_x';
export * from '../test/generated-wrappers/mixin_crypto_com';
@@ -89,6 +90,7 @@ export * from '../test/generated-wrappers/mixin_oasis';
export * from '../test/generated-wrappers/mixin_shell';
export * from '../test/generated-wrappers/mixin_uniswap';
export * from '../test/generated-wrappers/mixin_uniswap_v2';
export * from '../test/generated-wrappers/mixin_uniswap_v3';
export * from '../test/generated-wrappers/mixin_zero_ex_bridge';
export * from '../test/generated-wrappers/mooniswap_liquidity_provider';
export * from '../test/generated-wrappers/multiplex_feature';
@@ -125,6 +127,7 @@ export * from '../test/generated-wrappers/test_mint_token_erc20_transformer';
export * from '../test/generated-wrappers/test_mintable_erc20_token';
export * from '../test/generated-wrappers/test_mooniswap';
export * from '../test/generated-wrappers/test_native_orders_feature';
export * from '../test/generated-wrappers/test_order_signer_registry_with_contract_wallet';
export * from '../test/generated-wrappers/test_permissionless_transformer_deployer_suicidal';
export * from '../test/generated-wrappers/test_permissionless_transformer_deployer_transformer';
export * from '../test/generated-wrappers/test_rfq_origin_registration';

View File

@@ -105,6 +105,7 @@
"test/generated-artifacts/LogMetadataTransformer.json",
"test/generated-artifacts/MetaTransactionsFeature.json",
"test/generated-artifacts/MixinBalancer.json",
"test/generated-artifacts/MixinBalancerV2.json",
"test/generated-artifacts/MixinBancor.json",
"test/generated-artifacts/MixinCoFiX.json",
"test/generated-artifacts/MixinCryptoCom.json",
@@ -120,6 +121,7 @@
"test/generated-artifacts/MixinShell.json",
"test/generated-artifacts/MixinUniswap.json",
"test/generated-artifacts/MixinUniswapV2.json",
"test/generated-artifacts/MixinUniswapV3.json",
"test/generated-artifacts/MixinZeroExBridge.json",
"test/generated-artifacts/MooniswapLiquidityProvider.json",
"test/generated-artifacts/MultiplexFeature.json",
@@ -156,6 +158,7 @@
"test/generated-artifacts/TestMintableERC20Token.json",
"test/generated-artifacts/TestMooniswap.json",
"test/generated-artifacts/TestNativeOrdersFeature.json",
"test/generated-artifacts/TestOrderSignerRegistryWithContractWallet.json",
"test/generated-artifacts/TestPermissionlessTransformerDeployerSuicidal.json",
"test/generated-artifacts/TestPermissionlessTransformerDeployerTransformer.json",
"test/generated-artifacts/TestRfqOriginRegistration.json",

View File

@@ -53,6 +53,8 @@ illustrates how events are emitted when trading through the Exchange Proxy.
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+
| `RfqOrderOriginsAllowed`_ | Emitted when a tx.origin is added/removed for RFQ, via `registerAllowedRfqOrigins <./functions.html#registerallowedrfqorigins>`_ | ExchangeProxy |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+
| `OrderSignerRegistered`_ | Emitted when an order signer is added/removed for a maker, via `registerAllowedOrderSigner <./functions.html#registerallowedordersigner>`_ | ExchangeProxy |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+
| `TransformedERC20`_ | Emitted when an `ERC20 Transformation <../advanced/erc20_transformations.html>`_ completes. | ExchangeProxy |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+
| `TransformerDeployerUpdated`_ | Emitted when the Transformer Deployer is upgraded. | ExchangeProxy |
@@ -227,7 +229,7 @@ PairCancelledLimitOrders
);
PairCancelledRfqOrders
------------------------
----------------------
.. code-block:: solidity
@@ -311,6 +313,21 @@ RfqOrderOriginsAllowed
bool allowed
);
OrderSignerRegistered
-------------------------
.. code-block:: solidity
/// @dev Emitted when new order signers are registered
/// @param maker The maker address that is registering a designated signer.
/// @param signer The address that will sign on behalf of maker.
/// @param allowed Indicates whether the address should be allowed.
event OrderSignerRegistered(
address maker,
address signer,
bool allowed
);
TransformedERC20
----------------

View File

@@ -4,54 +4,69 @@ Basic Functionality
Below is a catalog of basic Exchange functionality. For more advanced usage, like meta-transactions and dex aggregation, see the Advanced section.
+---------------------------------+--------------------------------------------------------------------------+
| **Limit Orders** | **Overview** |
+---------------------------------+--------------------------------------------------------------------------+
| `fillLimitOrder`_ | Fills a Limit Order up to the amount requested. |
+---------------------------------+--------------------------------------------------------------------------+
| `fillOrKillLimitOrder`_ | Fills exactly the amount requested or reverts. |
+---------------------------------+--------------------------------------------------------------------------+
| `cancelLimitOrder`_ | Cancels an order so that it can no longer be filled. |
+---------------------------------+--------------------------------------------------------------------------+
| `batchCancelLimitOrders`_ | A batch call to `cancelLimitOrder`. |
+---------------------------------+--------------------------------------------------------------------------+
| `cancelPairLimitOrders`_ | Cancels Limit orders in a specific market pair. |
| | Ex: Cancel all Limit Orders selling WETH for USDC. |
+---------------------------------+--------------------------------------------------------------------------+
| `batchCancelPairLimitOrders`_ | A batch call to `cancelPairLimitOrders`. |
+---------------------------------+--------------------------------------------------------------------------+
| `getLimitOrderInfo`_ | Returns the state of a given order. |
+---------------------------------+--------------------------------------------------------------------------+
| `getLimitOrderHash`_ | Returns the EIP-712 hash for an order. |
+---------------------------------+--------------------------------------------------------------------------+
| **RFQ Orders** | **Overview** |
+---------------------------------+--------------------------------------------------------------------------+
| `fillRfqOrder`_ | These are analogous to the above LimitOrder functions. |
+---------------------------------+ |
| `fillOrKillRfqOrder`_ | |
+---------------------------------+ |
| `cancelRfqOrder`_ | |
+---------------------------------+ |
| `batchCancelRfqOrders`_ | |
+---------------------------------+ |
| `cancelPairRfqOrders`_ | |
+---------------------------------+ |
| `batchCancelPairRfqOrders`_ | |
+---------------------------------+ |
| `getRfqOrderInfo`_ | |
+---------------------------------+ |
| `getRfqOrderHash`_ | |
+---------------------------------+--------------------------------------------------------------------------+
| `registerAllowedRfqOrigins`_ | Register tx.origin addresses that are allowed to fill an RFQ order. |
+---------------------------------+--------------------------------------------------------------------------+
| **Protocol Fees** | **Overview** |
+---------------------------------+--------------------------------------------------------------------------+
| `getProtocolFeeMultiplier`_ | Takers of limit orders pay a protocol fee of `Multiplier * tx.gasprice`. |
| | This returns the `Multiplier`. |
+---------------------------------+--------------------------------------------------------------------------+
| `transferProtocolFeesForPools`_ | Transfers protocol fees from escrow to the 0x Staking System. |
| | This should be called near the end of each epoch. |
+---------------------------------+--------------------------------------------------------------------------+
+-----------------------------------------+--------------------------------------------------------------------------+
| **Limit Orders** | **Overview** |
+-----------------------------------------+--------------------------------------------------------------------------+
| `fillLimitOrder`_ | Fills a Limit Order up to the amount requested. |
+-----------------------------------------+--------------------------------------------------------------------------+
| `fillOrKillLimitOrder`_ | Fills exactly the amount requested or reverts. |
+-----------------------------------------+--------------------------------------------------------------------------+
| `cancelLimitOrder`_ | Cancels an order so that it can no longer be filled. |
+-----------------------------------------+--------------------------------------------------------------------------+
| `batchCancelLimitOrders`_ | A batch call to `cancelLimitOrder`. |
+-----------------------------------------+--------------------------------------------------------------------------+
| `cancelPairLimitOrders`_ | Cancels Limit orders in a specific market pair. |
| | Ex: Cancel all Limit Orders selling WETH for USDC. |
+-----------------------------------------+--------------------------------------------------------------------------+
| `cancelPairLimitOrdersWithSigner`_ | Same functionality to ``cancelPairLimitOrders`` but called by a |
| | registered order signer instead of the maker itself. |
+-----------------------------------------+--------------------------------------------------------------------------+
| `batchCancelPairLimitOrders`_ | A batch call to `cancelPairLimitOrders`. |
+-----------------------------------------+--------------------------------------------------------------------------+
| `batchCancelPairLimitOrdersWithSigner`_ | Same functionality to ``cancelPairLimitOrders`` but called by a |
| | registered order signer instead of the maker itself. |
+-----------------------------------------+--------------------------------------------------------------------------+
| `getLimitOrderInfo`_ | Returns the state of a given order. |
+-----------------------------------------+--------------------------------------------------------------------------+
| `getLimitOrderHash`_ | Returns the EIP-712 hash for an order. |
+-----------------------------------------+--------------------------------------------------------------------------+
| **RFQ Orders** | **Overview** |
+-----------------------------------------+--------------------------------------------------------------------------+
| `fillRfqOrder`_ | These are analogous to the above LimitOrder functions. |
+-----------------------------------------+ |
| `fillOrKillRfqOrder`_ | |
+-----------------------------------------+ |
| `cancelRfqOrder`_ | |
+-----------------------------------------+ |
| `batchCancelRfqOrders`_ | |
+-----------------------------------------+ |
| `cancelPairRfqOrders`_ | |
+-----------------------------------------+ |
| `cancelPairRfqOrdersWithSigner`_ | |
+-----------------------------------------+ |
| `batchCancelPairRfqOrders`_ | |
+-----------------------------------------+ |
| `batchCancelPairRfqOrdersWithSigner`_ | |
+-----------------------------------------+ |
| `getRfqOrderInfo`_ | |
+-----------------------------------------+ |
| `getRfqOrderHash`_ | |
+-----------------------------------------+--------------------------------------------------------------------------+
| `registerAllowedRfqOrigins`_ | Register tx.origin addresses that are allowed to fill an RFQ order. |
+-----------------------------------------+--------------------------------------------------------------------------+
| `registerAllowedOrderSigner`_ | Register addresses that can sign orders on behalf of ``msg.sender``. |
+-----------------------------------------+--------------------------------------------------------------------------+
| `isValidOrderSigner`_ | Returns whether a given address is allowed to sign orders for a given |
| | maker address. |
+-----------------------------------------+--------------------------------------------------------------------------+
| **Protocol Fees** | **Overview** |
+-----------------------------------------+--------------------------------------------------------------------------+
| `getProtocolFeeMultiplier`_ | Takers of limit orders pay a protocol fee of `Multiplier * tx.gasprice`. |
| | This returns the `Multiplier`. |
+-----------------------------------------+--------------------------------------------------------------------------+
| `transferProtocolFeesForPools`_ | Transfers protocol fees from escrow to the 0x Staking System. |
| | This should be called near the end of each epoch. |
+-----------------------------------------+--------------------------------------------------------------------------+
Limit Orders
@@ -131,7 +146,7 @@ This function cancels a single limit order created by the caller:
)
external;
This function emits an `OrderCancelled <../basics/events.html#ordercancelled>`_ event if the cancellation is successful. The call will revert if ``msg.sender != order.maker``.
This function emits an `OrderCancelled <../basics/events.html#ordercancelled>`_ event if the cancellation is successful. The call will revert if ``msg.sender != order.maker`` or ``!isValidOrderSigner(maker, msg.sender)``.
batchCancelLimitOrders
----------------------
@@ -146,7 +161,7 @@ This function cancels multiple limit orders created by the caller:
)
external;
This function emits an `OrderCancelled <../basics/events.html#ordercancelled>`_ event for each order it cancels. The call will revert if ``msg.sender != order.maker`` for any of the orders.
This function emits an `OrderCancelled <../basics/events.html#ordercancelled>`_ event for each order it cancels. The call will revert if ``msg.sender != order.maker`` or ``!isValidOrderSigner(maker, msg.sender)`` for any of the orders.
cancelPairLimitOrders
---------------------
@@ -162,10 +177,32 @@ This function cancels all limit orders created by the caller with with a maker a
)
external;
This function emits a `PairCancelledLimitOrders <../basics/events.html#paircancelledlimitorders>`_ event, or reverts in one of the following scenarios:
This function emits a `PairCancelledLimitOrders <../basics/events.html#paircancelledlimitorders>`_ event, or reverts if the ``salt`` parameter is ≤ to a previous ``salt``.
- ``msg.sender != order.maker``
- The ``salt`` parameter is ≤ to a previous ``salt``.
cancelPairLimitOrdersWithSigner
-------------------------------
Same functionality as ``cancelPairLimitOrders`` but ``msg.sender`` is a registered order signer instead of the maker itself.
.. code-block:: solidity
/// @dev Cancel all limit orders for a given maker and pair with a salt less
/// than the value provided. The caller must be a signer registered to the maker.
/// Subsequent calls to this function with the same maker and pair require the
/// new salt to be >= the old salt.
/// @param maker The maker for which to cancel.
/// @param makerToken The maker token.
/// @param takerToken The taker token.
/// @param minValidSalt The new minimum valid salt.
function cancelPairLimitOrdersWithSigner(
address maker,
IERC20TokenV06 makerToken,
IERC20TokenV06 takerToken,
uint256 minValidSalt
)
external;
Reverts if ``!isValidOrderSigner(maker, msg.sender)``.
batchCancelPairLimitOrders
--------------------------
@@ -183,6 +220,31 @@ This function performs multiple ``cancelPairLimitOrders()`` at once. Each respec
This function emits a `PairCancelledLimitOrders <../basics/events.html#paircancelledlimitorders>`_ event for each market pair it cancels. It reverts if any of the individual cancellations revert.
batchCancelPairLimitOrdersWithSigner
------------------------------------
Same functionality as ``batchCancelPairLimitOrders`` but ``msg.sender`` is a registered order signer instead of the maker itself.
.. code-block:: solidity
/// @dev Cancel all limit orders for a given maker and pairs with salts less
/// than the values provided. The caller must be a signer registered to the maker.
/// Subsequent calls to this function with the same maker and pair require the
/// new salt to be >= the old salt.
/// @param maker The maker for which to cancel.
/// @param makerTokens The maker tokens.
/// @param takerTokens The taker tokens.
/// @param minValidSalts The new minimum valid salts.
function batchCancelPairLimitOrdersWithSigner(
address maker,
IERC20TokenV06[] memory makerTokens,
IERC20TokenV06[] memory takerTokens,
uint256[] memory minValidSalts
)
external;
Reverts if ``!isValidOrderSigner(maker, msg.sender)``.
getLimitOrderInfo
-----------------
@@ -369,7 +431,7 @@ Similar to limit orders, RFQ orders can be cancelled on-chain through a variety
)
external;
This function emits an `OrderCancelled <../basics/events.html#ordercancelled>`_ event if the cancellation is successful. The call will revert if ``msg.sender != order.maker``.
This function emits an `OrderCancelled <../basics/events.html#ordercancelled>`_ event if the cancellation is successful. The call will revert if ``msg.sender != order.maker`` or ``!isValidOrderSigner(maker, msg.sender)``.
batchCancelRfqOrders
--------------------
@@ -384,7 +446,7 @@ This function cancels multiple RFQ orders created by the caller:
)
external;
This function emits an `OrderCancelled <../basics/events.html#ordercancelled>`_ event for each order it cancels. The call will revert if ``msg.sender != order.maker`` for any of the orders.
This function emits an `OrderCancelled <../basics/events.html#ordercancelled>`_ event for each order it cancels. The call will revert if ``msg.sender != order.maker`` or ``!isValidOrderSigner(maker, msg.sender)`` for any orders for any of the orders.
cancelPairRfqOrders
-------------------
@@ -400,10 +462,32 @@ This function cancels all RFQ orders created by the caller with with a maker and
)
external;
This function emits a `PairCancelledRfqOrders <../basics/events.html#paircancelledrfqorders>`_ event, or reverts in one of the following scenarios:
This function emits a `PairCancelledRfqOrders <../basics/events.html#paircancelledrfqorders>`_ event, or reverts if the ``salt`` parameter is ≤ to a previous ``salt``.
- ``msg.sender != order.maker``
- The ``salt`` parameter is ≤ to a previous ``salt``.
cancelPairRfqOrdersWithSigner
-----------------------------
Same functionality as ``cancelPairRfqOrders`` but ``msg.sender`` is a registered order signer instead of the maker itself.
.. code-block:: solidity
/// @dev Cancel all RFQ orders for a given maker and pair with a salt less
/// than the value provided. The caller must be a signer registered to the maker.
/// Subsequent calls to this function with the same maker and pair require the
/// new salt to be >= the old salt.
/// @param maker The maker for which to cancel.
/// @param makerToken The maker token.
/// @param takerToken The taker token.
/// @param minValidSalt The new minimum valid salt.
function cancelPairRfqOrdersWithSigner(
address maker,
IERC20TokenV06 makerToken,
IERC20TokenV06 takerToken,
uint256 minValidSalt
)
external;
Reverts if ``!isValidOrderSigner(maker, msg.sender)``.
batchCancelPairRfqOrders
------------------------
@@ -421,6 +505,31 @@ batchCancelPairRfqOrders
This function emits a `PairCancelledRfqOrders <../basics/events.html#paircancelledrfqorders>`_ event for each market pair it cancels. It reverts if any of the individual cancellations revert.
batchCancelPairRfqOrdersWithSigner
----------------------------------
Same functionality as ``batchCancelPairRfqOrders`` but ``msg.sender`` is a registered order signer instead of the maker itself.
.. code-block:: solidity
/// @dev Cancel all RFQ orders for a given maker and pairs with salts less
/// than the values provided. The caller must be a signer registered to the maker.
/// Subsequent calls to this function with the same maker and pair require the
/// new salt to be >= the old salt.
/// @param maker The maker for which to cancel.
/// @param makerTokens The maker tokens.
/// @param takerTokens The taker tokens.
/// @param minValidSalts The new minimum valid salts.
function batchCancelPairRfqOrdersWithSigner(
address maker,
IERC20TokenV06[] memory makerTokens,
IERC20TokenV06[] memory takerTokens,
uint256[] memory minValidSalts
)
external;
Reverts if ``!isValidOrderSigner(maker, msg.sender)``.
getRfqOrderInfo
---------------
@@ -549,6 +658,47 @@ Looking at the 2nd use case, a maker can register valid tx origins using this fu
This function emits a `RfqOrderOriginsAllowed <../basics/events.html#rfqorderoriginsallowed>`_ event.
registerAllowedOrderSigner
--------------------------
Calls to fill functions require a signature provided by the maker. In cases where the signer can't be the maker itself (e.g. a contract wallet), the maker can delegate signing to another address.
To register a new delegated order signer, the maker can call ``registerAllowedOrderSigner`` with ``allowed == true``.
To revoke permission to a signer, the maker can call ``registerAllowedOrderSigner`` with ``allowed == false``.
.. code-block:: solidity
/// @dev Register a signer who can sign on behalf of msg.sender
/// This allows one to sign on behalf of a contract that calls this function
/// @param signer The address from which you plan to generate signatures
/// @param allowed True to register, false to unregister.
function registerAllowedOrderSigner(
address signer,
bool allowed
)
external;
This function emits an `OrderSignerRegistered <../basics/events.html#ordersignerregistered>`_ event.
isValidOrderSigner
------------------
Returns whether the ``signer`` is allowed to sign orders on behalf of the ``maker``.
.. code-block:: solidity
/// @dev checks if a given address is registered to sign on behalf of a maker address
/// @param maker The maker address encoded in an order (can be a contract)
/// @param signer The address that is providing a signature
function isValidOrderSigner(
address maker,
address signer
)
external
view
returns (bool isAllowed);
Protocol Fees
=============

View File

@@ -92,7 +92,7 @@ The ``RFQOrder`` struct has the following fields:
How To Sign
==============
Both Limit & RFQ orders must be signed by the `maker`. This signature is needed to fill an order, see `Basic Functionality <./functions.html>`_.
Both Limit & RFQ orders must be signed by the `maker` or a registered order signer (`registerAllowedOrderSigner <./functions.html#registerallowedrfqorigins>`_). This signature is needed to fill an order, see `Basic Functionality <./functions.html>`_.
The protocol accepts signatures defined by the following struct:

View File

@@ -4,7 +4,7 @@ Protocol Fees
An ETH protocol fee is paid by the Taker each time a `Limit Order <./orders.html#limit-orders>`_ is `filled <./functions.html>`_.
The fee is proportional to the gas cost of filling an order and scales linearly with gas price. The cost is currently ``70k * tx.gasprice``.
Every 10 days, these fees are aggregated and distributed to the makers as a liquidity reward: the reward is proportional to the maker's collected fees and staked ZRX relative to other makers.
At the end of every Staking Epoch, these fees are aggregated and distributed to the makers as a liquidity reward: the reward is proportional to the maker's collected fees and staked ZRX relative to other makers.
To learn more about protocol fees and liquidity incentives, see the `Official Spec <https://github.com/0xProject/0x-protocol-specification/blob/master/staking/staking-specification.md>`_.
.. note::

View File

@@ -10,7 +10,7 @@
],
"scripts": {
"deps_versions:ci": "node ./node_modules/@0x/monorepo-scripts/lib/deps_versions.js",
"fix": "wsrun fix $PKG --fast-exit --parallel --exclude-missing",
"fix": "wsrun --fast-exit --parallel --exclude-missing -c fix $PKG",
"ganache": "ganache-cli -p 8545 --gasLimit 10000000 --networkId 50 -m \"${npm_package_config_mnemonic}\"",
"prettier": "prettier --write '**/*.{ts,tsx,json,md}' --config .prettierrc",
"prettier:ci": "prettier --list-different '**/*.{ts,tsx,json,md}' --config .prettierrc",
@@ -27,31 +27,25 @@
"install:all": "yarn install",
"wsrun": "wsrun",
"lerna": "lerna",
"build": "lerna link && wsrun build $PKG -r --stages --fast-exit --exclude-missing",
"build:ci": "lerna link && wsrun build:ci $PKG --fast-exit -r --stages --exclude-missing",
"build:contracts": "lerna link && wsrun build -p ${npm_package_config_contractsPackages} -c --fast-exit -r --stages --exclude-missing",
"build": "lerna link && wsrun -r --stages --fast-exit --exclude-missing -c build $PKG",
"build:ci": "lerna link && wsrun --fast-exit -r --stages --exclude-missing -c build:ci $PKG",
"build:contracts": "lerna link && wsrun -p ${npm_package_config_contractsPackages} --fast-exit -r --stages --exclude-missing -c build",
"build:ts": "tsc -b",
"watch:ts": "tsc -b -w",
"clean": "wsrun clean $PKG --fast-exit -r --parallel --exclude-missing",
"clean:contracts": "wsrun clean -p ${npm_package_config_contractsPackages} -c --fast-exit -r --parallel --exclude-missing",
"contracts:gen": "wsrun contracts:gen $PKG --fast-exit -r --parallel --exclude-missing",
"contracts:compile": "wsrun compile -p ${npm_package_config_contractsPackages} --fast-exit -r --stages --exclude-missing",
"contracts:compile:truffle": "wsrun compile:truffle -p ${npm_package_config_contractsPackages} --fast-exit -r --stages --exclude-missing",
"contracts:watch": "wsrun watch $PKG --parallel --exclude-missing",
"clean": "wsrun --fast-exit -r --parallel --exclude-missing clean -c $PKG",
"contracts:watch": "wsrun --parallel --exclude-missing watch -c $PKG",
"remove_node_modules": "lerna clean --yes; rm -rf node_modules",
"rebuild": "run-s clean build",
"test": "wsrun test $(echo $(echo ${npm_package_config_contractsPackages} ${npm_package_config_nonContractPackages} | tr ' ' '\n' | sort | uniq) ${npm_package_config_ignoreTestsForPackages} | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ') --fast-exit --serial --exclude-missing",
"test:all": "wsrun test $PKG --fast-exit --serial --exclude-missing",
"test:contracts": "wsrun test --serial -p $(echo ${npm_package_config_contractsPackages} ${npm_package_config_ignoreTestsForPackages} | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ') -c --fast-exit --exclude-missing",
"test:contracts:all": "wsrun test --serial -p ${npm_package_config_contractsPackages} -c --fast-exit --exclude-missing",
"test": "wsrun --fast-exit --serial --exclude-missing -p $(echo $(echo ${npm_package_config_contractsPackages} ${npm_package_config_nonContractPackages} | tr ' ' '\n' | sort | uniq) ${npm_package_config_ignoreTestsForPackages} | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ') -c test",
"test:all": "wsrun --fast-exit --serial --exclude-missing -c test $PKG",
"test:contracts": "wsrun --serial -p $(echo ${npm_package_config_contractsPackages} ${npm_package_config_ignoreTestsForPackages} | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ') --fast-exit --exclude-missing -c test",
"test:contracts:all": "wsrun --serial -p ${npm_package_config_contractsPackages} --fast-exit --exclude-missing -c test",
"generate_doc": "node ./node_modules/@0x/monorepo-scripts/lib/doc_generate.js --config ./doc-gen-config.json",
"upload_md_docs": "aws s3 rm --recursive s3://docs-markdown; wsrun s3:sync_md_docs --exclude-missing",
"diff_md_docs:ci": "wsrun diff_docs --exclude-missing",
"upload_md_docs": "aws s3 rm --recursive s3://docs-markdown; wsrun --exclude-missing -c s3:sync_md_docs",
"diff_md_docs:ci": "wsrun --exclude-missing -c diff_docs",
"test:generate_docs:circleci": "for i in ${npm_package_config_packagesWithDocPages}; do yarn generate_doc --package $i || break -1; done;",
"bundlewatch": "bundlewatch",
"lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing",
"lint:stages": "wsrun lint $PKG --fast-exit --stages --exclude-missing",
"lint:contracts": "wsrun lint -p ${npm_package_config_contractsPackages} -c --fast-exit --stages --exclude-missing",
"lint": "wsrun --fast-exit --parallel --exclude-missing -c lint $PKG",
"upgrade_org_deps": "node node_modules/@0x/monorepo-scripts/lib/upgrade_deps.js -p '@0x|ethereum-types'",
"upgrade_deps": "node node_modules/@0x/monorepo-scripts/lib/upgrade_deps.js",
"verdaccio": "docker run --rm -i -p 4873:4873 0xorg/verdaccio"
@@ -66,7 +60,7 @@
"ignoreDependencyVersionsForPackage": "contract-wrappers"
},
"devDependencies": {
"@0x/monorepo-scripts": "^3.1.1",
"@0x/monorepo-scripts": "^3.1.7",
"@0x-lerna-fork/lerna": "3.16.10",
"@0xproject/npm-cli-login": "^0.0.11",
"async-child-process": "^1.1.1",
@@ -78,7 +72,7 @@
"prettier": "~1.16.3",
"source-map-support": "^0.5.6",
"typescript": "4.2.2",
"wsrun": "^2.2.0"
"wsrun": "^5.2.4"
},
"resolutions": {
"merkle-patricia-tree": "^2.3.2"

View File

@@ -1,7 +1,161 @@
[
{
"version": "6.10.0",
"changes": [
{
"note": "Reactivate PancakeSwapV2 and BakerySwap VIP on BSC",
"pr": 222
},
{
"note": "Add LUSD Curve pool",
"pr": 218
},
{
"note": "Fix exchangeProxyGasOverhead for fallback path",
"pr": 215
},
{
"note": "Enable ETH based Curve pools",
"pr": 220
},
{
"note": "Reactivate PancakeSwapV2 and BakerySwap VIP on BSC",
"pr": 222
},
{
"note": "Disable WETH based SnowSwap pools",
"pr": 220
},
{
"note": "PLP now includes a fallback due to observed collisions",
"pr": 223
},
{
"note": "Add Balancer V2 integration",
"pr": 206
},
{
"note": "Re-work the PoolCache for Balancer et al",
"pr": 226
}
],
"timestamp": 1620214333
},
{
"version": "6.9.1",
"changes": [
{
"note": "Temporarily remove PancakeV2 and BakerySwap from VIP"
}
],
"timestamp": 1619830995
},
{
"version": "6.9.0",
"changes": [
{
"note": "Remove conflicting Kyber reserve",
"pr": 216
}
],
"timestamp": 1619825976
},
{
"version": "6.8.0",
"changes": [
{
"note": "Prune paths which cannot improve the best path",
"pr": 183
},
{
"note": "Use FastABI for Sampler ABI encoding and decoding",
"pr": 183
}
],
"timestamp": 1619596077
},
{
"version": "6.7.0",
"changes": [
{
"note": "Support PancakeSwap V2",
"pr": 211
}
],
"timestamp": 1619481586
},
{
"version": "6.6.1",
"changes": [
{
"note": "Fixing Positive Slippage logic to not force the EP route",
"pr": 209
}
]
},
{
"version": "6.6.0",
"changes": [
{
"note": "Support `Ropsten` network",
"pr": 203
},
{
"note": "BSC Uniswap clones (ApeSwap, CafeSwap, CheeseSwap, JulSwap), Saddle BTC pool, Curve gas schedule",
"pr": 208
}
],
"timestamp": 1618592834
},
{
"version": "6.5.3",
"changes": [
{
"note": "Apply slippage to bridge orders in consumer",
"pr": 198
}
],
"timestamp": 1618433771
},
{
"timestamp": 1618314654,
"version": "6.5.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1618259868,
"version": "6.5.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "6.5.0",
"changes": [
{
"note": "Add Kyber DMM to Ethereum mainnet",
"pr": 194
},
{
"note": "Add default LiquidityProvider registry and allow LiquidityProvider gasCost to be a function of tokens",
"pr": 196
}
],
"timestamp": 1617913615
},
{
"version": "6.4.0",
"changes": [
{
"note": "Added Component, Smoothy, Saddle, Curve open pools, tweeks gas schedule, adding SushiSwap as a fee quote source",
"pr": 182
},
{
"note": "Use SOURCE_FLAGS.rfqOrder in comparisonPrice",
"pr": 177

View File

@@ -5,8 +5,64 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v6.10.0 - _May 5, 2021_
* Reactivate PancakeSwapV2 and BakerySwap VIP on BSC (#222)
* Add LUSD Curve pool (#218)
* Fix exchangeProxyGasOverhead for fallback path (#215)
* Enable ETH based Curve pools (#220)
* Reactivate PancakeSwapV2 and BakerySwap VIP on BSC (#222)
* Disable WETH based SnowSwap pools (#220)
* PLP now includes a fallback due to observed collisions (#223)
* Add Balancer V2 integration (#206)
* Re-work the PoolCache for Balancer et al (#226)
## v6.9.1 - _May 1, 2021_
* Temporarily remove PancakeV2 and BakerySwap from VIP
## v6.9.0 - _April 30, 2021_
* Remove conflicting Kyber reserve (#216)
## v6.8.0 - _April 28, 2021_
* Prune paths which cannot improve the best path (#183)
* Use FastABI for Sampler ABI encoding and decoding (#183)
## v6.7.0 - _April 26, 2021_
* Support PancakeSwap V2 (#211)
## v6.6.1 - _Invalid date_
* Fixing Positive Slippage logic to not force the EP route (#209)
## v6.6.0 - _April 16, 2021_
* Support `Ropsten` network (#203)
* BSC Uniswap clones (ApeSwap, CafeSwap, CheeseSwap, JulSwap), Saddle BTC pool, Curve gas schedule (#208)
## v6.5.3 - _April 14, 2021_
* Apply slippage to bridge orders in consumer (#198)
## v6.5.2 - _April 13, 2021_
* Dependencies updated
## v6.5.1 - _April 12, 2021_
* Dependencies updated
## v6.5.0 - _April 8, 2021_
* Add Kyber DMM to Ethereum mainnet (#194)
* Add default LiquidityProvider registry and allow LiquidityProvider gasCost to be a function of tokens (#196)
## v6.4.0 - _April 1, 2021_
* Added Component, Smoothy, Saddle, Curve open pools, tweeks gas schedule, adding SushiSwap as a fee quote source (#182)
* Use SOURCE_FLAGS.rfqOrder in comparisonPrice (#177)
* Add a cancel token to ensure timeouts are respected (#176)
* Rename {Rfqt=>Rfq} for many types in Asset Swapper (#179)

View File

@@ -6,11 +6,7 @@
"shouldSaveStandardInput": true,
"compilerSettings": {
"evmVersion": "istanbul",
"optimizer": {
"enabled": true,
"runs": 62500,
"details": { "yul": true, "deduplicate": true, "cse": true, "constantOptimizer": true }
},
"optimizer": { "enabled": false, "runs": 200, "details": { "yul": true } },
"outputSelection": {
"*": {
"*": [

Some files were not shown because too many files have changed in this diff Show More