Compare commits
59 Commits
@0x/contra
...
protocol@2
Author | SHA1 | Date | |
---|---|---|---|
|
289474e2ce | ||
|
407ca21168 | ||
|
5c68fc24d2 | ||
|
548800e0a9 | ||
|
bde3d6dc6a | ||
|
56550a6acc | ||
|
e51b83accc | ||
|
d5ae971f1c | ||
|
5a2f5f9a42 | ||
|
75a3b70cef | ||
|
803cf65ba1 | ||
|
5d3947b838 | ||
|
4397a59008 | ||
|
966d54c935 | ||
|
234ddb495d | ||
|
a744acc7bc | ||
|
27c624633c | ||
|
7ef75101b4 | ||
|
6f8aace00d | ||
|
6c264b2f18 | ||
|
df055e1958 | ||
|
70d2117470 | ||
|
2c173ccaf3 | ||
|
d2f4a0c5f3 | ||
|
0d6021e5e3 | ||
|
bb04726e7f | ||
|
220ca370c2 | ||
|
63af4e3e98 | ||
|
9754e12d82 | ||
|
d72ebed246 | ||
|
587fc71058 | ||
|
7d34e09a12 | ||
|
7d15baad0f | ||
|
1e6476ada7 | ||
|
1d6ca5f6b5 | ||
|
fb249f02fc | ||
|
fdf04ef275 | ||
|
b0f5f634f2 | ||
|
6ee0108565 | ||
|
c73097e688 | ||
|
a2d42b07b5 | ||
|
f9a794af93 | ||
|
a2643674ca | ||
|
c00ce9daac | ||
|
c68b5d7844 | ||
|
09ed106d4c | ||
|
a6b92fc658 | ||
|
4be4a1a30b | ||
|
9bede5d331 | ||
|
b50d4aee6d | ||
|
55bc367bd6 | ||
|
7a59b7eafe | ||
|
9e59d41e44 | ||
|
475e6c7bca | ||
|
dbc5a5293e | ||
|
f4bd2bd0d8 | ||
|
f1782a83ba | ||
|
cbade0d558 | ||
|
fe0c26387c |
@@ -1,25 +1,25 @@
|
|||||||
version: 2
|
version: 2.1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
resource_class: medium+
|
resource_class: xlarge
|
||||||
docker:
|
docker:
|
||||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
- image: node:12
|
||||||
environment:
|
environment:
|
||||||
CONTRACTS_COMMIT_HASH: '9ed05f5'
|
NODE_OPTIONS: '--max-old-space-size=16384'
|
||||||
working_directory: ~/repo
|
working_directory: ~/repo
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV
|
- run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV
|
||||||
- run:
|
- run:
|
||||||
name: install-yarn
|
name: install-yarn
|
||||||
command: npm install --force --global yarn@1.17.0
|
command: npm install --force --global yarn@1.22.0
|
||||||
- run:
|
- run:
|
||||||
name: yarn
|
name: yarn
|
||||||
command: yarn --frozen-lockfile --ignore-engines install || yarn --frozen-lockfile --ignore-engines install
|
command: yarn --frozen-lockfile --ignore-engines install || yarn --frozen-lockfile --ignore-engines install
|
||||||
- setup_remote_docker
|
- setup_remote_docker
|
||||||
- run: yarn build:ci
|
- run: yarn build:ci || yarn build:ci || yarn build:ci
|
||||||
- run: yarn build:ts
|
- run: yarn build:ts || yarn build:ts || yarn build:ts
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: repo-{{ .Environment.CIRCLE_SHA1 }}
|
key: repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
paths:
|
paths:
|
||||||
@@ -31,57 +31,59 @@ jobs:
|
|||||||
test-exchange-ganache:
|
test-exchange-ganache:
|
||||||
resource_class: medium+
|
resource_class: medium+
|
||||||
docker:
|
docker:
|
||||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
- image: node:12
|
||||||
working_directory: ~/repo
|
working_directory: ~/repo
|
||||||
steps:
|
steps:
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
keys:
|
keys:
|
||||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
- 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:
|
test-integrations-ganache:
|
||||||
resource_class: medium+
|
resource_class: medium+
|
||||||
docker:
|
docker:
|
||||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
- image: node:12
|
||||||
working_directory: ~/repo
|
working_directory: ~/repo
|
||||||
steps:
|
steps:
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
keys:
|
keys:
|
||||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
- 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:
|
test-contracts-staking-ganache:
|
||||||
resource_class: medium+
|
resource_class: medium+
|
||||||
docker:
|
docker:
|
||||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
- image: node:12
|
||||||
working_directory: ~/repo
|
working_directory: ~/repo
|
||||||
steps:
|
steps:
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
keys:
|
keys:
|
||||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
- 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:
|
test-contracts-extra-ganache:
|
||||||
resource_class: medium+
|
resource_class: medium+
|
||||||
docker:
|
docker:
|
||||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
- image: node:12
|
||||||
working_directory: ~/repo
|
working_directory: ~/repo
|
||||||
steps:
|
steps:
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
keys:
|
keys:
|
||||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
- 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:
|
test-contracts-rest-ganache:
|
||||||
resource_class: medium+
|
resource_class: medium+
|
||||||
docker:
|
docker:
|
||||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
- image: node:12
|
||||||
working_directory: ~/repo
|
working_directory: ~/repo
|
||||||
steps:
|
steps:
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
keys:
|
keys:
|
||||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
- 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:
|
test-publish:
|
||||||
resource_class: medium+
|
resource_class: large
|
||||||
|
environment:
|
||||||
|
NODE_OPTIONS: '--max-old-space-size=6442'
|
||||||
docker:
|
docker:
|
||||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
- image: node:12
|
||||||
- image: 0xorg/verdaccio
|
- image: 0xorg/verdaccio
|
||||||
working_directory: ~/repo
|
working_directory: ~/repo
|
||||||
steps:
|
steps:
|
||||||
@@ -95,7 +97,7 @@ jobs:
|
|||||||
path: ~/.npm/_logs
|
path: ~/.npm/_logs
|
||||||
test-doc-generation:
|
test-doc-generation:
|
||||||
docker:
|
docker:
|
||||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
- image: node:12
|
||||||
working_directory: ~/repo
|
working_directory: ~/repo
|
||||||
steps:
|
steps:
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
@@ -106,18 +108,18 @@ jobs:
|
|||||||
no_output_timeout: 1200
|
no_output_timeout: 1200
|
||||||
test-rest:
|
test-rest:
|
||||||
docker:
|
docker:
|
||||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
- image: node:12
|
||||||
working_directory: ~/repo
|
working_directory: ~/repo
|
||||||
steps:
|
steps:
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
keys:
|
keys:
|
||||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
- run: yarn wsrun test:circleci @0x/contracts-test-utils
|
- run: yarn wsrun -p @0x/contracts-test-utils -m --serial -c test:circleci
|
||||||
- run: yarn wsrun test:circleci @0x/contract-artifacts
|
- run: yarn wsrun -p @0x/contract-artifacts -m --serial -c test:circleci
|
||||||
- run: yarn wsrun test:circleci @0x/contract-wrappers-test
|
- run: yarn wsrun -p @0x/contract-wrappers-test -m --serial -c test:circleci
|
||||||
- run: yarn wsrun test:circleci @0x/migrations
|
- run: yarn wsrun -p @0x/migrations -m --serial -c test:circleci
|
||||||
- run: yarn wsrun test:circleci @0x/order-utils
|
- run: yarn wsrun -p @0x/order-utils -m --serial -c test:circleci
|
||||||
- run: yarn wsrun test:circleci @0x/asset-swapper
|
- run: yarn wsrun -p @0x/asset-swapper -m --serial -c test:circleci
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: coverage-contract-wrappers-test-{{ .Environment.CIRCLE_SHA1 }}
|
key: coverage-contract-wrappers-test-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
paths:
|
paths:
|
||||||
@@ -134,7 +136,7 @@ jobs:
|
|||||||
resource_class: large
|
resource_class: large
|
||||||
working_directory: ~/repo
|
working_directory: ~/repo
|
||||||
docker:
|
docker:
|
||||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
- image: node:12
|
||||||
steps:
|
steps:
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
keys:
|
keys:
|
||||||
@@ -145,7 +147,7 @@ jobs:
|
|||||||
- run: yarn diff_md_docs:ci
|
- run: yarn diff_md_docs:ci
|
||||||
submit-coverage:
|
submit-coverage:
|
||||||
docker:
|
docker:
|
||||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
- image: node:12
|
||||||
working_directory: ~/repo
|
working_directory: ~/repo
|
||||||
steps:
|
steps:
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1621944788,
|
||||||
|
"version": "3.7.13",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1621600614,
|
||||||
|
"version": "3.7.12",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1620214333,
|
||||||
|
"version": "3.7.11",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1619596077,
|
"timestamp": 1619596077,
|
||||||
"version": "3.7.10",
|
"version": "3.7.10",
|
||||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v3.7.13 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v3.7.12 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v3.7.11 - _May 5, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v3.7.10 - _April 28, 2021_
|
## v3.7.10 - _April 28, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-asset-proxy",
|
"name": "@0x/contracts-asset-proxy",
|
||||||
"version": "3.7.10",
|
"version": "3.7.13",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -51,13 +51,13 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.5.2",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contract-wrappers": "^13.16.0",
|
"@0x/contract-wrappers": "^13.16.3",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/contracts-utils": "^4.7.7",
|
"@0x/contracts-utils": "^4.7.10",
|
||||||
"@0x/dev-utils": "^4.2.6",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
@@ -79,16 +79,16 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.3.2",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/contracts-erc1155": "^2.1.28",
|
"@0x/contracts-erc1155": "^2.1.31",
|
||||||
"@0x/contracts-erc20": "^3.3.7",
|
"@0x/contracts-erc20": "^3.3.10",
|
||||||
"@0x/contracts-erc721": "^3.1.28",
|
"@0x/contracts-erc721": "^3.1.31",
|
||||||
"@0x/contracts-exchange-libs": "^4.3.28",
|
"@0x/contracts-exchange-libs": "^4.3.31",
|
||||||
"@0x/order-utils": "^10.4.20",
|
"@0x/order-utils": "^10.4.23",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"ethereum-types": "^3.5.0",
|
"ethereum-types": "^3.5.0",
|
||||||
"lodash": "^4.17.11"
|
"lodash": "^4.17.11"
|
||||||
},
|
},
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1621944788,
|
||||||
|
"version": "1.1.31",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1621600614,
|
||||||
|
"version": "1.1.30",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1620214333,
|
||||||
|
"version": "1.1.29",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1619596077,
|
"timestamp": 1619596077,
|
||||||
"version": "1.1.28",
|
"version": "1.1.28",
|
||||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.1.31 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.1.30 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.1.29 - _May 5, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.1.28 - _April 28, 2021_
|
## v1.1.28 - _April 28, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-broker",
|
"name": "@0x/contracts-broker",
|
||||||
"version": "1.1.28",
|
"version": "1.1.31",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -51,20 +51,20 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.5.2",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contracts-asset-proxy": "^3.7.10",
|
"@0x/contracts-asset-proxy": "^3.7.13",
|
||||||
"@0x/contracts-erc20": "^3.3.7",
|
"@0x/contracts-erc20": "^3.3.10",
|
||||||
"@0x/contracts-erc721": "^3.1.28",
|
"@0x/contracts-erc721": "^3.1.31",
|
||||||
"@0x/contracts-exchange": "^3.2.29",
|
"@0x/contracts-exchange": "^3.2.32",
|
||||||
"@0x/contracts-exchange-libs": "^4.3.28",
|
"@0x/contracts-exchange-libs": "^4.3.31",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/contracts-utils": "^4.7.7",
|
"@0x/contracts-utils": "^4.7.10",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -84,10 +84,10 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.3.2",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/order-utils": "^10.4.20",
|
"@0x/order-utils": "^10.4.23",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"ethereum-types": "^3.5.0"
|
"ethereum-types": "^3.5.0"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1621944788,
|
||||||
|
"version": "3.1.32",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1621600614,
|
||||||
|
"version": "3.1.31",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1620214333,
|
||||||
|
"version": "3.1.30",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1619596077,
|
"timestamp": 1619596077,
|
||||||
"version": "3.1.29",
|
"version": "3.1.29",
|
||||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v3.1.32 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v3.1.31 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v3.1.30 - _May 5, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v3.1.29 - _April 28, 2021_
|
## v3.1.29 - _April 28, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-coordinator",
|
"name": "@0x/contracts-coordinator",
|
||||||
"version": "3.1.29",
|
"version": "3.1.32",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -52,17 +52,17 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.5.2",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contracts-asset-proxy": "^3.7.10",
|
"@0x/contracts-asset-proxy": "^3.7.13",
|
||||||
"@0x/contracts-dev-utils": "^1.3.27",
|
"@0x/contracts-dev-utils": "^1.3.30",
|
||||||
"@0x/contracts-erc20": "^3.3.7",
|
"@0x/contracts-erc20": "^3.3.10",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/dev-utils": "^4.2.6",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/order-utils": "^10.4.20",
|
"@0x/order-utils": "^10.4.23",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -82,16 +82,16 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/assert": "^3.0.26",
|
"@0x/assert": "^3.0.27",
|
||||||
"@0x/base-contract": "^6.3.2",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/contract-addresses": "^6.0.0",
|
"@0x/contract-addresses": "^6.3.0",
|
||||||
"@0x/contracts-exchange": "^3.2.29",
|
"@0x/contracts-exchange": "^3.2.32",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/contracts-utils": "^4.7.7",
|
"@0x/contracts-utils": "^4.7.10",
|
||||||
"@0x/json-schemas": "^6.1.2",
|
"@0x/json-schemas": "^6.1.3",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"ethereum-types": "^3.5.0",
|
"ethereum-types": "^3.5.0",
|
||||||
"http-status-codes": "^1.3.2"
|
"http-status-codes": "^1.3.2"
|
||||||
},
|
},
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1621944788,
|
||||||
|
"version": "1.3.30",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1621600614,
|
||||||
|
"version": "1.3.29",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1620214333,
|
||||||
|
"version": "1.3.28",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1619596077,
|
"timestamp": 1619596077,
|
||||||
"version": "1.3.27",
|
"version": "1.3.27",
|
||||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.3.30 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.3.29 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.3.28 - _May 5, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.3.27 - _April 28, 2021_
|
## v1.3.27 - _April 28, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-dev-utils",
|
"name": "@0x/contracts-dev-utils",
|
||||||
"version": "1.3.27",
|
"version": "1.3.30",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -41,17 +41,17 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/dev-utils",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/dev-utils",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.5.2",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/assert": "^3.0.26",
|
"@0x/assert": "^3.0.27",
|
||||||
"@0x/contracts-asset-proxy": "^3.7.10",
|
"@0x/contracts-asset-proxy": "^3.7.13",
|
||||||
"@0x/contracts-erc20": "^3.3.7",
|
"@0x/contracts-erc20": "^3.3.10",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"ethereum-types": "^3.5.0",
|
"ethereum-types": "^3.5.0",
|
||||||
"ethers": "~4.0.4",
|
"ethers": "~4.0.4",
|
||||||
"npm-run-all": "^4.1.2",
|
"npm-run-all": "^4.1.2",
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.3.2",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@types/node": "12.12.54"
|
"@types/node": "12.12.54"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1621944788,
|
||||||
|
"version": "2.1.31",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1621600614,
|
||||||
|
"version": "2.1.30",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1620214333,
|
||||||
|
"version": "2.1.29",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1619596077,
|
"timestamp": 1619596077,
|
||||||
"version": "2.1.28",
|
"version": "2.1.28",
|
||||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v2.1.31 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v2.1.30 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v2.1.29 - _May 5, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v2.1.28 - _April 28, 2021_
|
## v2.1.28 - _April 28, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-erc1155",
|
"name": "@0x/contracts-erc1155",
|
||||||
"version": "2.1.28",
|
"version": "2.1.31",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -52,11 +52,11 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.5.2",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-utils": "^4.7.7",
|
"@0x/contracts-utils": "^4.7.10",
|
||||||
"@0x/dev-utils": "^4.2.6",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
@@ -80,10 +80,10 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.3.2",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"lodash": "^4.17.11"
|
"lodash": "^4.17.11"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1621944788,
|
||||||
|
"version": "3.3.10",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1621600614,
|
||||||
|
"version": "3.3.9",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1620214333,
|
||||||
|
"version": "3.3.8",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1619596077,
|
"timestamp": 1619596077,
|
||||||
"version": "3.3.7",
|
"version": "3.3.7",
|
||||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v3.3.10 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v3.3.9 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v3.3.8 - _May 5, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v3.3.7 - _April 28, 2021_
|
## v3.3.7 - _April 28, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-erc20",
|
"name": "@0x/contracts-erc20",
|
||||||
"version": "3.3.7",
|
"version": "3.3.10",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -51,18 +51,18 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.5.2",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/contracts-utils": "^4.7.7",
|
"@0x/contracts-utils": "^4.7.10",
|
||||||
"@0x/dev-utils": "^4.2.6",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.3.2"
|
"@0x/base-contract": "^6.4.0"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1621944788,
|
||||||
|
"version": "3.1.31",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1621600614,
|
||||||
|
"version": "3.1.30",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1620214333,
|
||||||
|
"version": "3.1.29",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1619596077,
|
"timestamp": 1619596077,
|
||||||
"version": "3.1.28",
|
"version": "3.1.28",
|
||||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v3.1.31 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v3.1.30 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v3.1.29 - _May 5, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v3.1.28 - _April 28, 2021_
|
## v3.1.28 - _April 28, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-erc721",
|
"name": "@0x/contracts-erc721",
|
||||||
"version": "3.1.28",
|
"version": "3.1.31",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -52,18 +52,18 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.5.2",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/contracts-utils": "^4.7.7",
|
"@0x/contracts-utils": "^4.7.10",
|
||||||
"@0x/dev-utils": "^4.2.6",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.3.2"
|
"@0x/base-contract": "^6.4.0"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1621944788,
|
||||||
|
"version": "4.2.32",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1621600614,
|
||||||
|
"version": "4.2.31",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1620214333,
|
||||||
|
"version": "4.2.30",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1619596077,
|
"timestamp": 1619596077,
|
||||||
"version": "4.2.29",
|
"version": "4.2.29",
|
||||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v4.2.32 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v4.2.31 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v4.2.30 - _May 5, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v4.2.29 - _April 28, 2021_
|
## v4.2.29 - _April 28, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-exchange-forwarder",
|
"name": "@0x/contracts-exchange-forwarder",
|
||||||
"version": "4.2.29",
|
"version": "4.2.32",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -52,25 +52,25 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.5.2",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contracts-asset-proxy": "^3.7.10",
|
"@0x/contracts-asset-proxy": "^3.7.13",
|
||||||
"@0x/contracts-dev-utils": "^1.3.27",
|
"@0x/contracts-dev-utils": "^1.3.30",
|
||||||
"@0x/contracts-erc1155": "^2.1.28",
|
"@0x/contracts-erc1155": "^2.1.31",
|
||||||
"@0x/contracts-erc20": "^3.3.7",
|
"@0x/contracts-erc20": "^3.3.10",
|
||||||
"@0x/contracts-erc721": "^3.1.28",
|
"@0x/contracts-erc721": "^3.1.31",
|
||||||
"@0x/contracts-exchange": "^3.2.29",
|
"@0x/contracts-exchange": "^3.2.32",
|
||||||
"@0x/contracts-exchange-libs": "^4.3.28",
|
"@0x/contracts-exchange-libs": "^4.3.31",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/contracts-utils": "^4.7.7",
|
"@0x/contracts-utils": "^4.7.10",
|
||||||
"@0x/dev-utils": "^4.2.6",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/order-utils": "^10.4.20",
|
"@0x/order-utils": "^10.4.23",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.3.2",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
"ethereum-types": "^3.5.0"
|
"ethereum-types": "^3.5.0"
|
||||||
},
|
},
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1621944788,
|
||||||
|
"version": "4.3.31",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1621600614,
|
||||||
|
"version": "4.3.30",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1620214333,
|
||||||
|
"version": "4.3.29",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1619596077,
|
"timestamp": 1619596077,
|
||||||
"version": "4.3.28",
|
"version": "4.3.28",
|
||||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v4.3.31 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v4.3.30 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v4.3.29 - _May 5, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v4.3.28 - _April 28, 2021_
|
## v4.3.28 - _April 28, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-exchange-libs",
|
"name": "@0x/contracts-exchange-libs",
|
||||||
"version": "4.3.28",
|
"version": "4.3.31",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -52,14 +52,14 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/libs",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/libs",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.5.2",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/dev-utils": "^4.2.6",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/subproviders": "^6.5.2",
|
"@0x/subproviders": "^6.5.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -80,13 +80,13 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.3.2",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/contracts-utils": "^4.7.7",
|
"@0x/contracts-utils": "^4.7.10",
|
||||||
"@0x/order-utils": "^10.4.20",
|
"@0x/order-utils": "^10.4.23",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"ethereum-types": "^3.5.0"
|
"ethereum-types": "^3.5.0"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1621944788,
|
||||||
|
"version": "3.2.32",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1621600614,
|
||||||
|
"version": "3.2.31",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1620214333,
|
||||||
|
"version": "3.2.30",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1619596077,
|
"timestamp": 1619596077,
|
||||||
"version": "3.2.29",
|
"version": "3.2.29",
|
||||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v3.2.32 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v3.2.31 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v3.2.30 - _May 5, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v3.2.29 - _April 28, 2021_
|
## v3.2.29 - _April 28, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-exchange",
|
"name": "@0x/contracts-exchange",
|
||||||
"version": "3.2.29",
|
"version": "3.2.32",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -52,21 +52,21 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.5.2",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contracts-asset-proxy": "^3.7.10",
|
"@0x/contracts-asset-proxy": "^3.7.13",
|
||||||
"@0x/contracts-exchange-libs": "^4.3.28",
|
"@0x/contracts-exchange-libs": "^4.3.31",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-multisig": "^4.1.29",
|
"@0x/contracts-multisig": "^4.1.32",
|
||||||
"@0x/contracts-staking": "^2.0.36",
|
"@0x/contracts-staking": "^2.0.39",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/contracts-utils": "^4.7.7",
|
"@0x/contracts-utils": "^4.7.10",
|
||||||
"@0x/dev-utils": "^4.2.6",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -88,13 +88,13 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.3.2",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/contracts-dev-utils": "^1.3.27",
|
"@0x/contracts-dev-utils": "^1.3.30",
|
||||||
"@0x/contracts-erc1155": "^2.1.28",
|
"@0x/contracts-erc1155": "^2.1.31",
|
||||||
"@0x/contracts-erc20": "^3.3.7",
|
"@0x/contracts-erc20": "^3.3.10",
|
||||||
"@0x/contracts-erc721": "^3.1.28",
|
"@0x/contracts-erc721": "^3.1.31",
|
||||||
"@0x/order-utils": "^10.4.20",
|
"@0x/order-utils": "^10.4.23",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"lodash": "^4.17.11"
|
"lodash": "^4.17.11"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1621944788,
|
||||||
|
"version": "6.2.26",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1621600614,
|
||||||
|
"version": "6.2.25",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1620214333,
|
||||||
|
"version": "6.2.24",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1619596077,
|
"timestamp": 1619596077,
|
||||||
"version": "6.2.23",
|
"version": "6.2.23",
|
||||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v6.2.26 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v6.2.25 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v6.2.24 - _May 5, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v6.2.23 - _April 28, 2021_
|
## v6.2.23 - _April 28, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-extensions",
|
"name": "@0x/contracts-extensions",
|
||||||
"version": "6.2.23",
|
"version": "6.2.26",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -52,23 +52,23 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.5.2",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contracts-asset-proxy": "^3.7.10",
|
"@0x/contracts-asset-proxy": "^3.7.13",
|
||||||
"@0x/contracts-dev-utils": "^1.3.27",
|
"@0x/contracts-dev-utils": "^1.3.30",
|
||||||
"@0x/contracts-erc20": "^3.3.7",
|
"@0x/contracts-erc20": "^3.3.10",
|
||||||
"@0x/contracts-erc721": "^3.1.28",
|
"@0x/contracts-erc721": "^3.1.31",
|
||||||
"@0x/contracts-exchange": "^3.2.29",
|
"@0x/contracts-exchange": "^3.2.32",
|
||||||
"@0x/contracts-exchange-libs": "^4.3.28",
|
"@0x/contracts-exchange-libs": "^4.3.31",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-utils": "^4.7.7",
|
"@0x/contracts-utils": "^4.7.10",
|
||||||
"@0x/dev-utils": "^4.2.6",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/order-utils": "^10.4.20",
|
"@0x/order-utils": "^10.4.23",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -90,8 +90,8 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.3.2",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
"ethereum-types": "^3.5.0"
|
"ethereum-types": "^3.5.0"
|
||||||
},
|
},
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-integrations",
|
"name": "@0x/contracts-integrations",
|
||||||
"version": "2.7.37",
|
"version": "2.7.47",
|
||||||
"private": true,
|
"private": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
@@ -52,25 +52,25 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.5.2",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contract-addresses": "^6.0.0",
|
"@0x/contract-addresses": "^6.3.0",
|
||||||
"@0x/contract-wrappers": "^13.16.0",
|
"@0x/contract-wrappers": "^13.16.3",
|
||||||
"@0x/contracts-broker": "^1.1.28",
|
"@0x/contracts-broker": "^1.1.31",
|
||||||
"@0x/contracts-coordinator": "^3.1.29",
|
"@0x/contracts-coordinator": "^3.1.32",
|
||||||
"@0x/contracts-dev-utils": "^1.3.27",
|
"@0x/contracts-dev-utils": "^1.3.30",
|
||||||
"@0x/contracts-exchange-forwarder": "^4.2.29",
|
"@0x/contracts-exchange-forwarder": "^4.2.32",
|
||||||
"@0x/contracts-exchange-libs": "^4.3.28",
|
"@0x/contracts-exchange-libs": "^4.3.31",
|
||||||
"@0x/contracts-extensions": "^6.2.23",
|
"@0x/contracts-extensions": "^6.2.26",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-utils": "^4.7.7",
|
"@0x/contracts-utils": "^4.7.10",
|
||||||
"@0x/coordinator-server": "^1.0.5",
|
"@0x/coordinator-server": "^1.0.5",
|
||||||
"@0x/dev-utils": "^4.2.6",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/migrations": "^8.0.3",
|
"@0x/migrations": "^8.0.8",
|
||||||
"@0x/order-utils": "^10.4.20",
|
"@0x/order-utils": "^10.4.23",
|
||||||
"@0x/protocol-utils": "^1.5.1",
|
"@0x/protocol-utils": "^1.6.2",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"@azure/core-asynciterator-polyfill": "^1.0.0",
|
"@azure/core-asynciterator-polyfill": "^1.0.0",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
@@ -93,21 +93,21 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/asset-swapper": "^6.8.0",
|
"@0x/asset-swapper": "^6.17.0",
|
||||||
"@0x/base-contract": "^6.3.2",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/contracts-asset-proxy": "^3.7.10",
|
"@0x/contracts-asset-proxy": "^3.7.13",
|
||||||
"@0x/contracts-erc1155": "^2.1.28",
|
"@0x/contracts-erc1155": "^2.1.31",
|
||||||
"@0x/contracts-erc20": "^3.3.7",
|
"@0x/contracts-erc20": "^3.3.10",
|
||||||
"@0x/contracts-erc721": "^3.1.28",
|
"@0x/contracts-erc721": "^3.1.31",
|
||||||
"@0x/contracts-exchange": "^3.2.29",
|
"@0x/contracts-exchange": "^3.2.32",
|
||||||
"@0x/contracts-multisig": "^4.1.29",
|
"@0x/contracts-multisig": "^4.1.32",
|
||||||
"@0x/contracts-staking": "^2.0.36",
|
"@0x/contracts-staking": "^2.0.39",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/contracts-zero-ex": "^0.22.1",
|
"@0x/contracts-zero-ex": "^0.24.1",
|
||||||
"@0x/subproviders": "^6.5.2",
|
"@0x/subproviders": "^6.5.3",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"ethereum-types": "^3.5.0",
|
"ethereum-types": "^3.5.0",
|
||||||
"ethereumjs-util": "^7.0.10",
|
"ethereumjs-util": "^7.0.10",
|
||||||
"lodash": "^4.17.11"
|
"lodash": "^4.17.11"
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1621944788,
|
||||||
|
"version": "4.1.32",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1621600614,
|
||||||
|
"version": "4.1.31",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1620214333,
|
||||||
|
"version": "4.1.30",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1619596077,
|
"timestamp": 1619596077,
|
||||||
"version": "4.1.29",
|
"version": "4.1.29",
|
||||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v4.1.32 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v4.1.31 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v4.1.30 - _May 5, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v4.1.29 - _April 28, 2021_
|
## v4.1.29 - _April 28, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-multisig",
|
"name": "@0x/contracts-multisig",
|
||||||
"version": "4.1.29",
|
"version": "4.1.32",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -49,18 +49,18 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/multisig",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/multisig",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.5.2",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contracts-asset-proxy": "^3.7.10",
|
"@0x/contracts-asset-proxy": "^3.7.13",
|
||||||
"@0x/contracts-erc20": "^3.3.7",
|
"@0x/contracts-erc20": "^3.3.10",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/contracts-utils": "^4.7.7",
|
"@0x/contracts-utils": "^4.7.10",
|
||||||
"@0x/dev-utils": "^4.2.6",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.3.2",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
"ethereum-types": "^3.5.0"
|
"ethereum-types": "^3.5.0"
|
||||||
},
|
},
|
||||||
|
@@ -1,4 +1,32 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1621944788,
|
||||||
|
"version": "2.0.39",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1621600614,
|
||||||
|
"version": "2.0.38",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "2.0.37",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Patch epoch finalization issue",
|
||||||
|
"pr": 221
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1620214333
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1619596077,
|
"timestamp": 1619596077,
|
||||||
"version": "2.0.36",
|
"version": "2.0.36",
|
||||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v2.0.39 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v2.0.38 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v2.0.37 - _May 5, 2021_
|
||||||
|
|
||||||
|
* Patch epoch finalization issue (#221)
|
||||||
|
|
||||||
## v2.0.36 - _April 28, 2021_
|
## v2.0.36 - _April 28, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
55
contracts/staking/contracts/src/StakingPatch.sol
Normal file
55
contracts/staking/contracts/src/StakingPatch.sol
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@@ -53,6 +53,10 @@ contract MixinExchangeFees is
|
|||||||
{
|
{
|
||||||
_assertValidProtocolFee(protocolFee);
|
_assertValidProtocolFee(protocolFee);
|
||||||
|
|
||||||
|
if (protocolFee == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Transfer the protocol fee to this address if it should be paid in
|
// Transfer the protocol fee to this address if it should be paid in
|
||||||
// WETH.
|
// WETH.
|
||||||
if (msg.value == 0) {
|
if (msg.value == 0) {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-staking",
|
"name": "@0x/contracts-staking",
|
||||||
"version": "2.0.36",
|
"version": "2.0.39",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"publicInterfaceContracts": "IStaking,IStakingEvents,IStakingProxy,IZrxVault,LibStakingRichErrors,Staking,StakingProxy,ZrxVault,TestStaking",
|
"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: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": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -53,20 +53,20 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.5.2",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contracts-asset-proxy": "^3.7.10",
|
"@0x/contracts-asset-proxy": "^3.7.13",
|
||||||
"@0x/contracts-dev-utils": "^1.3.27",
|
"@0x/contracts-dev-utils": "^1.3.30",
|
||||||
"@0x/contracts-erc20": "^3.3.7",
|
"@0x/contracts-erc20": "^3.3.10",
|
||||||
"@0x/contracts-exchange-libs": "^4.3.28",
|
"@0x/contracts-exchange-libs": "^4.3.31",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-utils": "^4.7.7",
|
"@0x/contracts-utils": "^4.7.10",
|
||||||
"@0x/dev-utils": "^4.2.6",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/order-utils": "^10.4.20",
|
"@0x/order-utils": "^10.4.23",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
"chai": "^4.0.1",
|
"chai": "^4.0.1",
|
||||||
@@ -87,10 +87,10 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.3.2",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"ethereum-types": "^3.5.0",
|
"ethereum-types": "^3.5.0",
|
||||||
"ethereumjs-util": "^7.0.10"
|
"ethereumjs-util": "^7.0.10"
|
||||||
},
|
},
|
||||||
|
@@ -33,6 +33,7 @@ import * as MixinStakingPool from '../test/generated-artifacts/MixinStakingPool.
|
|||||||
import * as MixinStakingPoolRewards from '../test/generated-artifacts/MixinStakingPoolRewards.json';
|
import * as MixinStakingPoolRewards from '../test/generated-artifacts/MixinStakingPoolRewards.json';
|
||||||
import * as MixinStorage from '../test/generated-artifacts/MixinStorage.json';
|
import * as MixinStorage from '../test/generated-artifacts/MixinStorage.json';
|
||||||
import * as Staking from '../test/generated-artifacts/Staking.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 StakingProxy from '../test/generated-artifacts/StakingProxy.json';
|
||||||
import * as TestAssertStorageParams from '../test/generated-artifacts/TestAssertStorageParams.json';
|
import * as TestAssertStorageParams from '../test/generated-artifacts/TestAssertStorageParams.json';
|
||||||
import * as TestCobbDouglas from '../test/generated-artifacts/TestCobbDouglas.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';
|
import * as ZrxVault from '../test/generated-artifacts/ZrxVault.json';
|
||||||
export const artifacts = {
|
export const artifacts = {
|
||||||
Staking: Staking as ContractArtifact,
|
Staking: Staking as ContractArtifact,
|
||||||
|
StakingPatch: StakingPatch as ContractArtifact,
|
||||||
StakingProxy: StakingProxy as ContractArtifact,
|
StakingProxy: StakingProxy as ContractArtifact,
|
||||||
ZrxVault: ZrxVault as ContractArtifact,
|
ZrxVault: ZrxVault as ContractArtifact,
|
||||||
MixinExchangeFees: MixinExchangeFees as ContractArtifact,
|
MixinExchangeFees: MixinExchangeFees as ContractArtifact,
|
||||||
|
66
contracts/staking/test/patch_mainnet_test.ts
Normal file
66
contracts/staking/test/patch_mainnet_test.ts
Normal 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
|
@@ -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_staking_pool_rewards';
|
||||||
export * from '../test/generated-wrappers/mixin_storage';
|
export * from '../test/generated-wrappers/mixin_storage';
|
||||||
export * from '../test/generated-wrappers/staking';
|
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/staking_proxy';
|
||||||
export * from '../test/generated-wrappers/test_assert_storage_params';
|
export * from '../test/generated-wrappers/test_assert_storage_params';
|
||||||
export * from '../test/generated-wrappers/test_cobb_douglas';
|
export * from '../test/generated-wrappers/test_cobb_douglas';
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
"test/generated-artifacts/MixinStakingPoolRewards.json",
|
"test/generated-artifacts/MixinStakingPoolRewards.json",
|
||||||
"test/generated-artifacts/MixinStorage.json",
|
"test/generated-artifacts/MixinStorage.json",
|
||||||
"test/generated-artifacts/Staking.json",
|
"test/generated-artifacts/Staking.json",
|
||||||
|
"test/generated-artifacts/StakingPatch.json",
|
||||||
"test/generated-artifacts/StakingProxy.json",
|
"test/generated-artifacts/StakingProxy.json",
|
||||||
"test/generated-artifacts/TestAssertStorageParams.json",
|
"test/generated-artifacts/TestAssertStorageParams.json",
|
||||||
"test/generated-artifacts/TestCobbDouglas.json",
|
"test/generated-artifacts/TestCobbDouglas.json",
|
||||||
|
@@ -1,4 +1,32 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1621944788,
|
||||||
|
"version": "5.4.2",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1621600614,
|
||||||
|
"version": "5.4.1",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "5.4.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Set default ganache gas limit to 100e6",
|
||||||
|
"pr": 197
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1620214333
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1619596077,
|
"timestamp": 1619596077,
|
||||||
"version": "5.3.25",
|
"version": "5.3.25",
|
||||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v5.4.2 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v5.4.1 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v5.4.0 - _May 5, 2021_
|
||||||
|
|
||||||
|
* Set default ganache gas limit to 100e6 (#197)
|
||||||
|
|
||||||
## v5.3.25 - _April 28, 2021_
|
## v5.3.25 - _April 28, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-test-utils",
|
"name": "@0x/contracts-test-utils",
|
||||||
"version": "5.3.25",
|
"version": "5.4.2",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/test-utils",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/test-utils",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"npm-run-all": "^4.1.2",
|
"npm-run-all": "^4.1.2",
|
||||||
"shx": "^0.2.2",
|
"shx": "^0.2.2",
|
||||||
@@ -42,20 +42,20 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/assert": "^3.0.26",
|
"@0x/assert": "^3.0.27",
|
||||||
"@0x/base-contract": "^6.3.2",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/contract-addresses": "^6.0.0",
|
"@0x/contract-addresses": "^6.3.0",
|
||||||
"@0x/dev-utils": "^4.2.6",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/json-schemas": "^6.1.2",
|
"@0x/json-schemas": "^6.1.3",
|
||||||
"@0x/order-utils": "^10.4.20",
|
"@0x/order-utils": "^10.4.23",
|
||||||
"@0x/sol-coverage": "^4.0.36",
|
"@0x/sol-coverage": "^4.0.37",
|
||||||
"@0x/sol-profiler": "^4.1.26",
|
"@0x/sol-profiler": "^4.1.27",
|
||||||
"@0x/sol-trace": "^3.0.36",
|
"@0x/sol-trace": "^3.0.37",
|
||||||
"@0x/subproviders": "^6.5.2",
|
"@0x/subproviders": "^6.5.3",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"@types/bn.js": "^4.11.0",
|
"@types/bn.js": "^4.11.0",
|
||||||
"@types/js-combinatorics": "^0.5.29",
|
"@types/js-combinatorics": "^0.5.29",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
|
@@ -20,6 +20,7 @@ export let providerConfigs: Web3Config = {
|
|||||||
shouldUseInProcessGanache: true,
|
shouldUseInProcessGanache: true,
|
||||||
shouldAllowUnlimitedContractSize: true,
|
shouldAllowUnlimitedContractSize: true,
|
||||||
hardfork: 'istanbul',
|
hardfork: 'istanbul',
|
||||||
|
gasLimit: 100e6,
|
||||||
unlocked_accounts: [
|
unlocked_accounts: [
|
||||||
'0x6cc5f688a315f3dc28a7781717a9a798a59fda7b',
|
'0x6cc5f688a315f3dc28a7781717a9a798a59fda7b',
|
||||||
'0x55dc8f21d20d4c6ed3c82916a438a413ca68e335',
|
'0x55dc8f21d20d4c6ed3c82916a438a413ca68e335',
|
||||||
|
@@ -1,4 +1,51 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "1.2.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Added proposal 0 params and test",
|
||||||
|
"pr": 252
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1622154125
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1621944788,
|
||||||
|
"version": "1.1.8",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1621600614,
|
||||||
|
"version": "1.1.7",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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,
|
"timestamp": 1619596077,
|
||||||
"version": "1.1.4",
|
"version": "1.1.4",
|
||||||
|
@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.2.0 - _May 27, 2021_
|
||||||
|
|
||||||
|
* Added proposal 0 params and test (#252)
|
||||||
|
|
||||||
|
## v1.1.8 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.1.7 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.1.6 - _May 5, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v1.1.5 - _April 30, 2021_
|
||||||
|
|
||||||
|
* Patched votingPower logic (#214)
|
||||||
|
|
||||||
## v1.1.4 - _April 28, 2021_
|
## v1.1.4 - _April 28, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -30,6 +30,7 @@ interface IZrxTreasury {
|
|||||||
uint256 votingPeriod;
|
uint256 votingPeriod;
|
||||||
uint256 proposalThreshold;
|
uint256 proposalThreshold;
|
||||||
uint256 quorumThreshold;
|
uint256 quorumThreshold;
|
||||||
|
bytes32 defaultPoolId;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ProposedAction {
|
struct ProposedAction {
|
||||||
|
@@ -20,8 +20,6 @@
|
|||||||
pragma solidity ^0.6.12;
|
pragma solidity ^0.6.12;
|
||||||
pragma experimental ABIEncoderV2;
|
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/LibBytesV06.sol";
|
||||||
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
|
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
|
||||||
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
|
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
|
||||||
@@ -32,7 +30,6 @@ import "./IZrxTreasury.sol";
|
|||||||
contract ZrxTreasury is
|
contract ZrxTreasury is
|
||||||
IZrxTreasury
|
IZrxTreasury
|
||||||
{
|
{
|
||||||
using LibERC20TokenV06 for IERC20TokenV06;
|
|
||||||
using LibSafeMathV06 for uint256;
|
using LibSafeMathV06 for uint256;
|
||||||
using LibRichErrorsV06 for bytes;
|
using LibRichErrorsV06 for bytes;
|
||||||
using LibBytesV06 for bytes;
|
using LibBytesV06 for bytes;
|
||||||
@@ -52,11 +49,9 @@ contract ZrxTreasury is
|
|||||||
/// @dev Initializes the ZRX treasury and creates the default
|
/// @dev Initializes the ZRX treasury and creates the default
|
||||||
/// staking pool.
|
/// staking pool.
|
||||||
/// @param stakingProxy_ The 0x staking proxy contract.
|
/// @param stakingProxy_ The 0x staking proxy contract.
|
||||||
/// @param weth_ The WETH token contract.
|
|
||||||
/// @param params Immutable treasury parameters.
|
/// @param params Immutable treasury parameters.
|
||||||
constructor(
|
constructor(
|
||||||
IStaking stakingProxy_,
|
IStaking stakingProxy_,
|
||||||
IERC20TokenV06 weth_,
|
|
||||||
TreasuryParameters memory params
|
TreasuryParameters memory params
|
||||||
)
|
)
|
||||||
public
|
public
|
||||||
@@ -66,15 +61,12 @@ contract ZrxTreasury is
|
|||||||
"VOTING_PERIOD_TOO_LONG"
|
"VOTING_PERIOD_TOO_LONG"
|
||||||
);
|
);
|
||||||
stakingProxy = stakingProxy_;
|
stakingProxy = stakingProxy_;
|
||||||
DefaultPoolOperator defaultPoolOperator_ = new DefaultPoolOperator(
|
|
||||||
stakingProxy_,
|
|
||||||
weth_
|
|
||||||
);
|
|
||||||
defaultPoolOperator = defaultPoolOperator_;
|
|
||||||
defaultPoolId = defaultPoolOperator_.poolId();
|
|
||||||
votingPeriod = params.votingPeriod;
|
votingPeriod = params.votingPeriod;
|
||||||
proposalThreshold = params.proposalThreshold;
|
proposalThreshold = params.proposalThreshold;
|
||||||
quorumThreshold = params.quorumThreshold;
|
quorumThreshold = params.quorumThreshold;
|
||||||
|
defaultPoolId = params.defaultPoolId;
|
||||||
|
IStaking.Pool memory defaultPool = stakingProxy_.getStakingPool(params.defaultPoolId);
|
||||||
|
defaultPoolOperator = DefaultPoolOperator(defaultPool.operator);
|
||||||
}
|
}
|
||||||
|
|
||||||
// solhint-disable
|
// solhint-disable
|
||||||
@@ -286,6 +278,12 @@ contract ZrxTreasury is
|
|||||||
|
|
||||||
// Add voting power for operated staking pools.
|
// Add voting power for operated staking pools.
|
||||||
for (uint256 i = 0; i != operatedPoolIds.length; i++) {
|
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]);
|
IStaking.Pool memory pool = stakingProxy.getStakingPool(operatedPoolIds[i]);
|
||||||
require(
|
require(
|
||||||
pool.operator == account,
|
pool.operator == account,
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-treasury",
|
"name": "@0x/contracts-treasury",
|
||||||
"version": "1.1.4",
|
"version": "1.2.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -46,14 +46,14 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.5.2",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contract-addresses": "^6.0.0",
|
"@0x/contract-addresses": "^6.3.0",
|
||||||
"@0x/contracts-asset-proxy": "^3.7.10",
|
"@0x/contracts-asset-proxy": "^3.7.13",
|
||||||
"@0x/contracts-erc20": "^3.3.7",
|
"@0x/contracts-erc20": "^3.3.10",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-staking": "^2.0.36",
|
"@0x/contracts-staking": "^2.0.39",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@types/isomorphic-fetch": "^0.0.35",
|
"@types/isomorphic-fetch": "^0.0.35",
|
||||||
@@ -72,13 +72,13 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.3.2",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/protocol-utils": "^1.5.1",
|
"@0x/protocol-utils": "^1.6.2",
|
||||||
"@0x/subproviders": "^6.5.2",
|
"@0x/subproviders": "^6.5.3",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"ethereum-types": "^3.5.0",
|
"ethereum-types": "^3.5.0",
|
||||||
"ethereumjs-util": "^7.0.10"
|
"ethereumjs-util": "^7.0.10"
|
||||||
},
|
},
|
||||||
|
35
contracts/treasury/src/proposals.ts
Normal file
35
contracts/treasury/src/proposals.ts
Normal file
File diff suppressed because one or more lines are too long
154
contracts/treasury/test/proposal_test.ts
Normal file
154
contracts/treasury/test/proposal_test.ts
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
import { artifacts as erc20Artifacts, ERC20TokenEvents } from '@0x/contracts-erc20';
|
||||||
|
import { StakingContract, StakingProxyContract } from '@0x/contracts-staking';
|
||||||
|
import { blockchainTests, constants, verifyEventsFromLogs } from '@0x/contracts-test-utils';
|
||||||
|
import { BigNumber, hexUtils, logUtils } from '@0x/utils';
|
||||||
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
|
import { proposals } from '../src/proposals';
|
||||||
|
|
||||||
|
import { artifacts } from './artifacts';
|
||||||
|
import { ZrxTreasuryContract, ZrxTreasuryEvents } from './wrappers';
|
||||||
|
|
||||||
|
const SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/mzhu25/zeroex-staking';
|
||||||
|
const STAKING_PROXY_ADDRESS = '0xa26e80e7dea86279c6d778d702cc413e6cffa777';
|
||||||
|
const TREASURY_ADDRESS = '0x0bb1810061c2f5b2088054ee184e6c79e1591101';
|
||||||
|
const PROPOSER = process.env.PROPOSER || constants.NULL_ADDRESS;
|
||||||
|
const VOTER = '0xba4f44e774158408e2dc6c5cb65bc995f0a89180';
|
||||||
|
const VOTER_OPERATED_POOLS = ['0x0000000000000000000000000000000000000000000000000000000000000017'];
|
||||||
|
blockchainTests.configure({
|
||||||
|
fork: {
|
||||||
|
unlockedAccounts: [PROPOSER, VOTER],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
async function querySubgraphAsync(operatorAddress: string): Promise<string[]> {
|
||||||
|
const query = `
|
||||||
|
{
|
||||||
|
stakingActor(id: "${operatorAddress}") {
|
||||||
|
operatedPools {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
const response = await fetch(SUBGRAPH_URL, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
query,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
const {
|
||||||
|
data: { stakingActor },
|
||||||
|
} = await response.json();
|
||||||
|
if (stakingActor) {
|
||||||
|
return stakingActor.operatedPools.map((pool: { id: string }) => hexUtils.leftPad(pool.id));
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
blockchainTests.fork.skip('Treasury proposal mainnet fork tests', env => {
|
||||||
|
let staking: StakingContract;
|
||||||
|
let stakingProxy: StakingProxyContract;
|
||||||
|
let treasury: ZrxTreasuryContract;
|
||||||
|
let votingPeriod: BigNumber;
|
||||||
|
|
||||||
|
async function fastForwardToNextEpochAsync(): Promise<void> {
|
||||||
|
const epochEndTime = await staking.getCurrentEpochEarliestEndTimeInSeconds().callAsync();
|
||||||
|
const lastBlockTime = await env.web3Wrapper.getBlockTimestampAsync('latest');
|
||||||
|
const dt = Math.max(0, epochEndTime.minus(lastBlockTime).toNumber());
|
||||||
|
await env.web3Wrapper.increaseTimeAsync(dt);
|
||||||
|
// mine next block
|
||||||
|
await env.web3Wrapper.mineBlockAsync();
|
||||||
|
const lastPoolId = new BigNumber(await staking.lastPoolId().callAsync(), 16);
|
||||||
|
const batchExecuteCalldata = [
|
||||||
|
...[...new Array(lastPoolId.toNumber())].map((_x, i) =>
|
||||||
|
staking.finalizePool(hexUtils.leftPad(i + 1)).getABIEncodedTransactionData(),
|
||||||
|
),
|
||||||
|
staking.endEpoch().getABIEncodedTransactionData(),
|
||||||
|
...[...new Array(lastPoolId.toNumber())].map((_x, i) =>
|
||||||
|
staking.finalizePool(hexUtils.leftPad(i + 1)).getABIEncodedTransactionData(),
|
||||||
|
),
|
||||||
|
...[...new Array(lastPoolId.toNumber())].map((_x, i) =>
|
||||||
|
staking.finalizePool(hexUtils.leftPad(i + 1)).getABIEncodedTransactionData(),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
await stakingProxy.batchExecute(batchExecuteCalldata).awaitTransactionSuccessAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
before(async () => {
|
||||||
|
const abis = _.mapValues({ ...artifacts, ...erc20Artifacts }, v => v.compilerOutput.abi);
|
||||||
|
treasury = new ZrxTreasuryContract(TREASURY_ADDRESS, env.provider, env.txDefaults, abis);
|
||||||
|
votingPeriod = await treasury.votingPeriod().callAsync();
|
||||||
|
staking = new StakingContract(STAKING_PROXY_ADDRESS, env.provider, env.txDefaults);
|
||||||
|
stakingProxy = new StakingProxyContract(STAKING_PROXY_ADDRESS, env.provider, env.txDefaults);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Proposal 0', () => {
|
||||||
|
it('works', async () => {
|
||||||
|
const proposal = proposals[0];
|
||||||
|
let executionEpoch: BigNumber;
|
||||||
|
if (proposal.executionEpoch) {
|
||||||
|
executionEpoch = proposal.executionEpoch;
|
||||||
|
} else {
|
||||||
|
const currentEpoch = await staking.currentEpoch().callAsync();
|
||||||
|
executionEpoch = currentEpoch.plus(2);
|
||||||
|
}
|
||||||
|
const pools = await querySubgraphAsync(PROPOSER);
|
||||||
|
const proposeTx = treasury.propose(proposal.actions, executionEpoch, proposal.description, pools);
|
||||||
|
|
||||||
|
const calldata = proposeTx.getABIEncodedTransactionData();
|
||||||
|
logUtils.log('ZrxTreasury.propose calldata:');
|
||||||
|
logUtils.log(calldata);
|
||||||
|
|
||||||
|
const proposalId = await proposeTx.callAsync({ from: PROPOSER });
|
||||||
|
const receipt = await proposeTx.awaitTransactionSuccessAsync({ from: PROPOSER });
|
||||||
|
verifyEventsFromLogs(
|
||||||
|
receipt.logs,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
...proposal,
|
||||||
|
proposalId,
|
||||||
|
executionEpoch,
|
||||||
|
proposer: PROPOSER,
|
||||||
|
operatedPoolIds: pools,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
ZrxTreasuryEvents.ProposalCreated,
|
||||||
|
);
|
||||||
|
await fastForwardToNextEpochAsync();
|
||||||
|
await fastForwardToNextEpochAsync();
|
||||||
|
await treasury
|
||||||
|
.castVote(proposalId, true, VOTER_OPERATED_POOLS)
|
||||||
|
.awaitTransactionSuccessAsync({ from: VOTER });
|
||||||
|
await env.web3Wrapper.increaseTimeAsync(votingPeriod.plus(1).toNumber());
|
||||||
|
await env.web3Wrapper.mineBlockAsync();
|
||||||
|
const executeTx = await treasury.execute(proposalId, proposal.actions).awaitTransactionSuccessAsync();
|
||||||
|
verifyEventsFromLogs(
|
||||||
|
executeTx.logs,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
proposalId,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
ZrxTreasuryEvents.ProposalExecuted,
|
||||||
|
);
|
||||||
|
const recipient = '0xf9347f751a6a1467abc722ec7d80ba2698dd9d6c';
|
||||||
|
verifyEventsFromLogs(
|
||||||
|
executeTx.logs,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
_from: TREASURY_ADDRESS,
|
||||||
|
_to: recipient,
|
||||||
|
_value: new BigNumber(400_000).times('1e18'),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
ERC20TokenEvents.Transfer,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@@ -28,6 +28,7 @@ blockchainTests.resets('Treasury governance', env => {
|
|||||||
votingPeriod: new BigNumber(3).times(stakingConstants.ONE_DAY_IN_SECONDS),
|
votingPeriod: new BigNumber(3).times(stakingConstants.ONE_DAY_IN_SECONDS),
|
||||||
proposalThreshold: new BigNumber(100),
|
proposalThreshold: new BigNumber(100),
|
||||||
quorumThreshold: new BigNumber(1000),
|
quorumThreshold: new BigNumber(1000),
|
||||||
|
defaultPoolId: stakingConstants.INITIAL_POOL_ID,
|
||||||
};
|
};
|
||||||
const PROPOSAL_DESCRIPTION = 'A very compelling proposal!';
|
const PROPOSAL_DESCRIPTION = 'A very compelling proposal!';
|
||||||
const TREASURY_BALANCE = constants.INITIAL_ERC20_BALANCE;
|
const TREASURY_BALANCE = constants.INITIAL_ERC20_BALANCE;
|
||||||
@@ -135,6 +136,16 @@ blockchainTests.resets('Treasury governance', env => {
|
|||||||
.approve(erc20ProxyContract.address, constants.INITIAL_ERC20_ALLOWANCE)
|
.approve(erc20ProxyContract.address, constants.INITIAL_ERC20_ALLOWANCE)
|
||||||
.awaitTransactionSuccessAsync({ from: delegator });
|
.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);
|
const createStakingPoolTx = staking.createStakingPool(stakingConstants.PPM, false);
|
||||||
nonDefaultPoolId = await createStakingPoolTx.callAsync({ from: poolOperator });
|
nonDefaultPoolId = await createStakingPoolTx.callAsync({ from: poolOperator });
|
||||||
await createStakingPoolTx.awaitTransactionSuccessAsync({ from: poolOperator });
|
await createStakingPoolTx.awaitTransactionSuccessAsync({ from: poolOperator });
|
||||||
@@ -145,9 +156,9 @@ blockchainTests.resets('Treasury governance', env => {
|
|||||||
env.txDefaults,
|
env.txDefaults,
|
||||||
{ ...artifacts, ...erc20Artifacts },
|
{ ...artifacts, ...erc20Artifacts },
|
||||||
staking.address,
|
staking.address,
|
||||||
weth.address,
|
|
||||||
TREASURY_PARAMS,
|
TREASURY_PARAMS,
|
||||||
);
|
);
|
||||||
|
|
||||||
await zrx.mint(TREASURY_BALANCE).awaitTransactionSuccessAsync();
|
await zrx.mint(TREASURY_BALANCE).awaitTransactionSuccessAsync();
|
||||||
await zrx.transfer(treasury.address, TREASURY_BALANCE).awaitTransactionSuccessAsync();
|
await zrx.transfer(treasury.address, TREASURY_BALANCE).awaitTransactionSuccessAsync();
|
||||||
actions = [
|
actions = [
|
||||||
@@ -166,10 +177,6 @@ blockchainTests.resets('Treasury governance', env => {
|
|||||||
value: constants.ZERO_AMOUNT,
|
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()', () => {
|
describe('getVotingPower()', () => {
|
||||||
it('Unstaked ZRX has no voting power', async () => {
|
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();
|
const operatorVotingPower = await treasury.getVotingPower(poolOperator, [nonDefaultPoolId]).callAsync();
|
||||||
expect(operatorVotingPower).to.bignumber.equal(TREASURY_PARAMS.proposalThreshold.dividedBy(2));
|
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 () => {
|
it('Correctly sums voting power delegated to multiple pools', async () => {
|
||||||
await staking
|
await staking
|
||||||
.stake(TREASURY_PARAMS.proposalThreshold.times(2))
|
.stake(TREASURY_PARAMS.proposalThreshold.times(2))
|
||||||
|
@@ -1,4 +1,31 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1621944788,
|
||||||
|
"version": "4.7.10",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1621600614,
|
||||||
|
"version": "4.7.9",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1620214333,
|
||||||
|
"version": "4.7.8",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1619596077,
|
"timestamp": 1619596077,
|
||||||
"version": "4.7.7",
|
"version": "4.7.7",
|
||||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v4.7.10 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v4.7.9 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v4.7.8 - _May 5, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v4.7.7 - _April 28, 2021_
|
## v4.7.7 - _April 28, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-utils",
|
"name": "@0x/contracts-utils",
|
||||||
"version": "4.7.7",
|
"version": "4.7.10",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -50,15 +50,15 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/utils",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/utils",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.5.2",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/dev-utils": "^4.2.6",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/order-utils": "^10.4.20",
|
"@0x/order-utils": "^10.4.23",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"@types/bn.js": "^4.11.0",
|
"@types/bn.js": "^4.11.0",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
@@ -79,9 +79,9 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.3.2",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"bn.js": "^4.11.8",
|
"bn.js": "^4.11.8",
|
||||||
"ethereum-types": "^3.5.0"
|
"ethereum-types": "^3.5.0"
|
||||||
},
|
},
|
||||||
|
@@ -1,4 +1,55 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1621944788,
|
||||||
|
"version": "0.24.1",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "0.24.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Add special selectors to selector collision test",
|
||||||
|
"pr": 243
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1621600614
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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",
|
"version": "0.22.1",
|
||||||
"changes": [
|
"changes": [
|
||||||
@@ -25,6 +76,10 @@
|
|||||||
"changes": [
|
"changes": [
|
||||||
{
|
{
|
||||||
"note": "Dependencies updated"
|
"note": "Dependencies updated"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "BSC Uniswap clones (ApeSwap, CafeSwap, CheeseSwap, JulSwap)",
|
||||||
|
"pr": 208
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@@ -5,6 +5,27 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v0.24.1 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
|
## v0.24.0 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Add special selectors to selector collision test (#243)
|
||||||
|
|
||||||
|
## 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_
|
## v0.22.1 - _April 28, 2021_
|
||||||
|
|
||||||
* bump feature version to 1.2 (#213)
|
* bump feature version to 1.2 (#213)
|
||||||
@@ -16,6 +37,7 @@ CHANGELOG
|
|||||||
## v0.21.1 - _April 12, 2021_
|
## v0.21.1 - _April 12, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
* BSC Uniswap clones (ApeSwap, CafeSwap, CheeseSwap, JulSwap) (#208)
|
||||||
|
|
||||||
## v0.21.0 - _April 1, 2021_
|
## v0.21.0 - _April 1, 2021_
|
||||||
|
|
||||||
|
@@ -37,22 +37,44 @@ contract PancakeSwapFeature is
|
|||||||
/// @dev Name of this feature.
|
/// @dev Name of this feature.
|
||||||
string public constant override FEATURE_NAME = "PancakeSwapFeature";
|
string public constant override FEATURE_NAME = "PancakeSwapFeature";
|
||||||
/// @dev Version of this feature.
|
/// @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.
|
/// @dev WBNB contract.
|
||||||
IEtherTokenV06 private immutable WBNB;
|
IEtherTokenV06 private immutable WBNB;
|
||||||
|
|
||||||
// 0xFF + address of the PancakeSwap factory contract.
|
// 0xFF + address of the PancakeSwap factory contract.
|
||||||
uint256 constant private FF_PANCAKESWAP_FACTORY = 0xffbcfccbde45ce874adcb698cc183debcf179528120000000000000000000000;
|
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.
|
// 0xFF + address of the BakerySwap factory contract.
|
||||||
uint256 constant private FF_BAKERYSWAP_FACTORY = 0xff01bf7c66c6bd861915cdaae475042d3c4bae16a70000000000000000000000;
|
uint256 constant private FF_BAKERYSWAP_FACTORY = 0xff01bf7c66c6bd861915cdaae475042d3c4bae16a70000000000000000000000;
|
||||||
// 0xFF + address of the SushiSwap factory contract.
|
// 0xFF + address of the SushiSwap factory contract.
|
||||||
uint256 constant private FF_SUSHISWAP_FACTORY = 0xffc35DADB65012eC5796536bD9864eD8773aBc74C40000000000000000000000;
|
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.
|
// Init code hash of the PancakeSwap pair contract.
|
||||||
uint256 constant private PANCAKESWAP_PAIR_INIT_CODE_HASH = 0xd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66;
|
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.
|
// Init code hash of the BakerySwap pair contract.
|
||||||
uint256 constant private BAKERYSWAP_PAIR_INIT_CODE_HASH = 0xe2e87433120e32c4738a7d8f3271f3d872cbe16241d67537139158d90bac61d3;
|
uint256 constant private BAKERYSWAP_PAIR_INIT_CODE_HASH = 0xe2e87433120e32c4738a7d8f3271f3d872cbe16241d67537139158d90bac61d3;
|
||||||
// Init code hash of the SushiSwap pair contract.
|
// Init code hash of the SushiSwap pair contract.
|
||||||
uint256 constant private SUSHISWAP_PAIR_INIT_CODE_HASH = 0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303;
|
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.
|
// Mask of the lower 20 bytes of a bytes32.
|
||||||
uint256 constant private ADDRESS_MASK = 0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff;
|
uint256 constant private ADDRESS_MASK = 0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff;
|
||||||
// BNB pseudo-token address.
|
// BNB pseudo-token address.
|
||||||
@@ -258,7 +280,7 @@ contract PancakeSwapFeature is
|
|||||||
|
|
||||||
// Call pair.swap()
|
// Call pair.swap()
|
||||||
switch mload(0xA20) // fork
|
switch mload(0xA20) // fork
|
||||||
case 1 {
|
case 2 {
|
||||||
mstore(0xB00, BAKERYSWAP_PAIR_SWAP_CALL_SELECTOR_32)
|
mstore(0xB00, BAKERYSWAP_PAIR_SWAP_CALL_SELECTOR_32)
|
||||||
}
|
}
|
||||||
default {
|
default {
|
||||||
@@ -352,15 +374,40 @@ contract PancakeSwapFeature is
|
|||||||
mstore(0xB35, PANCAKESWAP_PAIR_INIT_CODE_HASH)
|
mstore(0xB35, PANCAKESWAP_PAIR_INIT_CODE_HASH)
|
||||||
}
|
}
|
||||||
case 1 {
|
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(0xB00, FF_BAKERYSWAP_FACTORY)
|
||||||
mstore(0xB15, salt)
|
mstore(0xB15, salt)
|
||||||
mstore(0xB35, BAKERYSWAP_PAIR_INIT_CODE_HASH)
|
mstore(0xB35, BAKERYSWAP_PAIR_INIT_CODE_HASH)
|
||||||
}
|
}
|
||||||
default {
|
case 3 {
|
||||||
mstore(0xB00, FF_SUSHISWAP_FACTORY)
|
mstore(0xB00, FF_SUSHISWAP_FACTORY)
|
||||||
mstore(0xB15, salt)
|
mstore(0xB15, salt)
|
||||||
mstore(0xB35, SUSHISWAP_PAIR_INIT_CODE_HASH)
|
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))
|
pair := and(ADDRESS_MASK, keccak256(0xB00, 0x55))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,16 +23,21 @@ pragma experimental ABIEncoderV2;
|
|||||||
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
|
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 {
|
interface IPancakeSwapFeature {
|
||||||
|
|
||||||
enum ProtocolFork {
|
enum ProtocolFork {
|
||||||
PancakeSwap,
|
PancakeSwap,
|
||||||
|
PancakeSwapV2,
|
||||||
BakerySwap,
|
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 tokens Sell path.
|
||||||
/// @param sellAmount of `tokens[0]` Amount to sell.
|
/// @param sellAmount of `tokens[0]` Amount to sell.
|
||||||
/// @param minBuyAmount Minimum amount of `tokens[-1]` to buy.
|
/// @param minBuyAmount Minimum amount of `tokens[-1]` to buy.
|
||||||
|
@@ -23,6 +23,7 @@ pragma experimental ABIEncoderV2;
|
|||||||
import "./IBridgeAdapter.sol";
|
import "./IBridgeAdapter.sol";
|
||||||
import "./BridgeProtocols.sol";
|
import "./BridgeProtocols.sol";
|
||||||
import "./mixins/MixinBalancer.sol";
|
import "./mixins/MixinBalancer.sol";
|
||||||
|
import "./mixins/MixinBalancerV2.sol";
|
||||||
import "./mixins/MixinBancor.sol";
|
import "./mixins/MixinBancor.sol";
|
||||||
import "./mixins/MixinCoFiX.sol";
|
import "./mixins/MixinCoFiX.sol";
|
||||||
import "./mixins/MixinCurve.sol";
|
import "./mixins/MixinCurve.sol";
|
||||||
@@ -30,6 +31,7 @@ import "./mixins/MixinCryptoCom.sol";
|
|||||||
import "./mixins/MixinDodo.sol";
|
import "./mixins/MixinDodo.sol";
|
||||||
import "./mixins/MixinDodoV2.sol";
|
import "./mixins/MixinDodoV2.sol";
|
||||||
import "./mixins/MixinKyber.sol";
|
import "./mixins/MixinKyber.sol";
|
||||||
|
import "./mixins/MixinKyberDmm.sol";
|
||||||
import "./mixins/MixinMakerPSM.sol";
|
import "./mixins/MixinMakerPSM.sol";
|
||||||
import "./mixins/MixinMooniswap.sol";
|
import "./mixins/MixinMooniswap.sol";
|
||||||
import "./mixins/MixinMStable.sol";
|
import "./mixins/MixinMStable.sol";
|
||||||
@@ -38,11 +40,13 @@ import "./mixins/MixinOasis.sol";
|
|||||||
import "./mixins/MixinShell.sol";
|
import "./mixins/MixinShell.sol";
|
||||||
import "./mixins/MixinUniswap.sol";
|
import "./mixins/MixinUniswap.sol";
|
||||||
import "./mixins/MixinUniswapV2.sol";
|
import "./mixins/MixinUniswapV2.sol";
|
||||||
|
import "./mixins/MixinUniswapV3.sol";
|
||||||
import "./mixins/MixinZeroExBridge.sol";
|
import "./mixins/MixinZeroExBridge.sol";
|
||||||
|
|
||||||
contract BridgeAdapter is
|
contract BridgeAdapter is
|
||||||
IBridgeAdapter,
|
IBridgeAdapter,
|
||||||
MixinBalancer,
|
MixinBalancer,
|
||||||
|
MixinBalancerV2,
|
||||||
MixinBancor,
|
MixinBancor,
|
||||||
MixinCoFiX,
|
MixinCoFiX,
|
||||||
MixinCurve,
|
MixinCurve,
|
||||||
@@ -50,6 +54,7 @@ contract BridgeAdapter is
|
|||||||
MixinDodo,
|
MixinDodo,
|
||||||
MixinDodoV2,
|
MixinDodoV2,
|
||||||
MixinKyber,
|
MixinKyber,
|
||||||
|
MixinKyberDmm,
|
||||||
MixinMakerPSM,
|
MixinMakerPSM,
|
||||||
MixinMooniswap,
|
MixinMooniswap,
|
||||||
MixinMStable,
|
MixinMStable,
|
||||||
@@ -58,14 +63,16 @@ contract BridgeAdapter is
|
|||||||
MixinShell,
|
MixinShell,
|
||||||
MixinUniswap,
|
MixinUniswap,
|
||||||
MixinUniswapV2,
|
MixinUniswapV2,
|
||||||
|
MixinUniswapV3,
|
||||||
MixinZeroExBridge
|
MixinZeroExBridge
|
||||||
{
|
{
|
||||||
constructor(IEtherTokenV06 weth)
|
constructor(IEtherTokenV06 weth)
|
||||||
public
|
public
|
||||||
MixinBalancer()
|
MixinBalancer()
|
||||||
|
MixinBalancerV2()
|
||||||
MixinBancor(weth)
|
MixinBancor(weth)
|
||||||
MixinCoFiX()
|
MixinCoFiX()
|
||||||
MixinCurve()
|
MixinCurve(weth)
|
||||||
MixinCryptoCom()
|
MixinCryptoCom()
|
||||||
MixinDodo()
|
MixinDodo()
|
||||||
MixinDodoV2()
|
MixinDodoV2()
|
||||||
@@ -78,6 +85,7 @@ contract BridgeAdapter is
|
|||||||
MixinShell()
|
MixinShell()
|
||||||
MixinUniswap(weth)
|
MixinUniswap(weth)
|
||||||
MixinUniswapV2()
|
MixinUniswapV2()
|
||||||
|
MixinUniswapV3()
|
||||||
MixinZeroExBridge()
|
MixinZeroExBridge()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -99,6 +107,12 @@ contract BridgeAdapter is
|
|||||||
sellAmount,
|
sellAmount,
|
||||||
order.bridgeData
|
order.bridgeData
|
||||||
);
|
);
|
||||||
|
} else if (protocolId == BridgeProtocols.UNISWAPV3) {
|
||||||
|
boughtAmount = _tradeUniswapV3(
|
||||||
|
sellToken,
|
||||||
|
sellAmount,
|
||||||
|
order.bridgeData
|
||||||
|
);
|
||||||
} else if (protocolId == BridgeProtocols.UNISWAPV2) {
|
} else if (protocolId == BridgeProtocols.UNISWAPV2) {
|
||||||
boughtAmount = _tradeUniswapV2(
|
boughtAmount = _tradeUniswapV2(
|
||||||
buyToken,
|
buyToken,
|
||||||
@@ -119,6 +133,13 @@ contract BridgeAdapter is
|
|||||||
sellAmount,
|
sellAmount,
|
||||||
order.bridgeData
|
order.bridgeData
|
||||||
);
|
);
|
||||||
|
} else if (protocolId == BridgeProtocols.BALANCERV2) {
|
||||||
|
boughtAmount = _tradeBalancerV2(
|
||||||
|
sellToken,
|
||||||
|
buyToken,
|
||||||
|
sellAmount,
|
||||||
|
order.bridgeData
|
||||||
|
);
|
||||||
} else if (protocolId == BridgeProtocols.KYBER) {
|
} else if (protocolId == BridgeProtocols.KYBER) {
|
||||||
boughtAmount = _tradeKyber(
|
boughtAmount = _tradeKyber(
|
||||||
sellToken,
|
sellToken,
|
||||||
@@ -198,6 +219,12 @@ contract BridgeAdapter is
|
|||||||
sellAmount,
|
sellAmount,
|
||||||
order.bridgeData
|
order.bridgeData
|
||||||
);
|
);
|
||||||
|
} else if (protocolId == BridgeProtocols.KYBERDMM) {
|
||||||
|
boughtAmount = _tradeKyberDmm(
|
||||||
|
buyToken,
|
||||||
|
sellAmount,
|
||||||
|
order.bridgeData
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
boughtAmount = _tradeZeroExBridge(
|
boughtAmount = _tradeZeroExBridge(
|
||||||
sellToken,
|
sellToken,
|
||||||
|
@@ -44,4 +44,7 @@ library BridgeProtocols {
|
|||||||
uint128 internal constant COFIX = 14;
|
uint128 internal constant COFIX = 14;
|
||||||
uint128 internal constant NERVE = 15;
|
uint128 internal constant NERVE = 15;
|
||||||
uint128 internal constant MAKERPSM = 16;
|
uint128 internal constant MAKERPSM = 16;
|
||||||
|
uint128 internal constant BALANCERV2 = 17;
|
||||||
|
uint128 internal constant UNISWAPV3 = 18;
|
||||||
|
uint128 internal constant KYBERDMM = 19;
|
||||||
}
|
}
|
||||||
|
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
@@ -21,6 +21,7 @@ pragma solidity ^0.6.5;
|
|||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
|
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/LibERC20TokenV06.sol";
|
||||||
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
|
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
|
||||||
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
|
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
|
||||||
@@ -31,6 +32,15 @@ contract MixinCurve {
|
|||||||
using LibSafeMathV06 for uint256;
|
using LibSafeMathV06 for uint256;
|
||||||
using LibRichErrorsV06 for bytes;
|
using LibRichErrorsV06 for bytes;
|
||||||
|
|
||||||
|
/// @dev Mainnet address of the WETH contract.
|
||||||
|
IEtherTokenV06 private immutable WETH;
|
||||||
|
|
||||||
|
constructor(IEtherTokenV06 weth)
|
||||||
|
public
|
||||||
|
{
|
||||||
|
WETH = weth;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
struct CurveBridgeData {
|
struct CurveBridgeData {
|
||||||
address curveAddress;
|
address curveAddress;
|
||||||
@@ -50,10 +60,17 @@ contract MixinCurve {
|
|||||||
{
|
{
|
||||||
// Decode the bridge data to get the Curve metadata.
|
// Decode the bridge data to get the Curve metadata.
|
||||||
CurveBridgeData memory data = abi.decode(bridgeData, (CurveBridgeData));
|
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));
|
uint256 beforeBalance = buyToken.balanceOf(address(this));
|
||||||
(bool success, bytes memory resultData) =
|
(bool success, bytes memory resultData) =
|
||||||
data.curveAddress.call(abi.encodeWithSelector(
|
data.curveAddress.call{value: payableAmount}(abi.encodeWithSelector(
|
||||||
data.exchangeFunctionSelector,
|
data.exchangeFunctionSelector,
|
||||||
data.fromCoinIdx,
|
data.fromCoinIdx,
|
||||||
data.toCoinIdx,
|
data.toCoinIdx,
|
||||||
@@ -65,6 +82,12 @@ contract MixinCurve {
|
|||||||
if (!success) {
|
if (!success) {
|
||||||
resultData.rrevert();
|
resultData.rrevert();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (buyToken == WETH) {
|
||||||
|
boughtAmount = address(this).balance;
|
||||||
|
WETH.deposit{ value: boughtAmount }();
|
||||||
|
}
|
||||||
|
|
||||||
return buyToken.balanceOf(address(this)).safeSub(beforeBalance);
|
return buyToken.balanceOf(address(this)).safeSub(beforeBalance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,94 @@
|
|||||||
|
// 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";
|
||||||
|
|
||||||
|
/*
|
||||||
|
KyberDmm Router
|
||||||
|
*/
|
||||||
|
interface IKyberDmmRouter {
|
||||||
|
|
||||||
|
/// @dev Swaps an exact amount of input tokens for as many output tokens as possible, along the route determined by the path.
|
||||||
|
/// The first element of path is the input token, the last is the output token, and any intermediate elements represent
|
||||||
|
/// intermediate pairs to trade through (if, for example, a direct pair does not exist).
|
||||||
|
/// @param amountIn The amount of input tokens to send.
|
||||||
|
/// @param amountOutMin The minimum amount of output tokens that must be received for the transaction not to revert.
|
||||||
|
/// @param pools An array of pool addresses. pools.length must be >= 1.
|
||||||
|
/// @param path An array of token addresses. path.length must be >= 2. Pools for each consecutive pair of addresses must exist and have liquidity.
|
||||||
|
/// @param to Recipient of the output tokens.
|
||||||
|
/// @param deadline Unix timestamp after which the transaction will revert.
|
||||||
|
/// @return amounts The input token amount and all subsequent output token amounts.
|
||||||
|
function swapExactTokensForTokens(
|
||||||
|
uint amountIn,
|
||||||
|
uint amountOutMin,
|
||||||
|
address[] calldata pools,
|
||||||
|
address[] calldata path,
|
||||||
|
address to,
|
||||||
|
uint deadline
|
||||||
|
) external returns (uint[] memory amounts);
|
||||||
|
}
|
||||||
|
|
||||||
|
contract MixinKyberDmm {
|
||||||
|
|
||||||
|
using LibERC20TokenV06 for IERC20TokenV06;
|
||||||
|
|
||||||
|
function _tradeKyberDmm(
|
||||||
|
IERC20TokenV06 buyToken,
|
||||||
|
uint256 sellAmount,
|
||||||
|
bytes memory bridgeData
|
||||||
|
)
|
||||||
|
internal
|
||||||
|
returns (uint256 boughtAmount)
|
||||||
|
{
|
||||||
|
address router;
|
||||||
|
address[] memory pools;
|
||||||
|
address[] memory path;
|
||||||
|
(router, pools, path) = abi.decode(bridgeData, (address, address[], address[]));
|
||||||
|
|
||||||
|
require(pools.length >= 1, "MixinKyberDmm/POOLS_LENGTH_MUST_BE_AT_LEAST_ONE");
|
||||||
|
require(path.length == pools.length + 1, "MixinKyberDmm/ARRAY_LENGTH_MISMATCH");
|
||||||
|
require(
|
||||||
|
path[path.length - 1] == address(buyToken),
|
||||||
|
"MixinKyberDmm/LAST_ELEMENT_OF_PATH_MUST_MATCH_OUTPUT_TOKEN"
|
||||||
|
);
|
||||||
|
// Grant the KyberDmm router an allowance to sell the first token.
|
||||||
|
IERC20TokenV06(path[0]).approveIfBelow(address(router), sellAmount);
|
||||||
|
|
||||||
|
uint[] memory amounts = IKyberDmmRouter(router).swapExactTokensForTokens(
|
||||||
|
// Sell all tokens we hold.
|
||||||
|
sellAmount,
|
||||||
|
// Minimum buy amount.
|
||||||
|
1,
|
||||||
|
pools,
|
||||||
|
// Convert to `buyToken` along this path.
|
||||||
|
path,
|
||||||
|
// Recipient is `this`.
|
||||||
|
address(this),
|
||||||
|
// Expires after this block.
|
||||||
|
block.timestamp
|
||||||
|
);
|
||||||
|
return amounts[amounts.length-1];
|
||||||
|
}
|
||||||
|
}
|
@@ -31,6 +31,7 @@ interface IMStable {
|
|||||||
IERC20TokenV06 sellToken,
|
IERC20TokenV06 sellToken,
|
||||||
IERC20TokenV06 buyToken,
|
IERC20TokenV06 buyToken,
|
||||||
uint256 sellAmount,
|
uint256 sellAmount,
|
||||||
|
uint256 minBoughtAmount,
|
||||||
address recipient
|
address recipient
|
||||||
)
|
)
|
||||||
external
|
external
|
||||||
@@ -59,6 +60,8 @@ contract MixinMStable {
|
|||||||
sellToken,
|
sellToken,
|
||||||
buyToken,
|
buyToken,
|
||||||
sellAmount,
|
sellAmount,
|
||||||
|
// Minimum buy amount.
|
||||||
|
1,
|
||||||
address(this)
|
address(this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -69,7 +69,7 @@ contract MixinUniswapV2 {
|
|||||||
assembly { path := _path }
|
assembly { path := _path }
|
||||||
}
|
}
|
||||||
|
|
||||||
require(path.length >= 2, "MixinUniswapV3/PATH_LENGTH_MUST_BE_AT_LEAST_TWO");
|
require(path.length >= 2, "MixinUniswapV2/PATH_LENGTH_MUST_BE_AT_LEAST_TWO");
|
||||||
require(
|
require(
|
||||||
path[path.length - 1] == buyToken,
|
path[path.length - 1] == buyToken,
|
||||||
"MixinUniswapV2/LAST_ELEMENT_OF_PATH_MUST_MATCH_OUTPUT_TOKEN"
|
"MixinUniswapV2/LAST_ELEMENT_OF_PATH_MUST_MATCH_OUTPUT_TOKEN"
|
||||||
|
@@ -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
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-zero-ex",
|
"name": "@0x/contracts-zero-ex",
|
||||||
"version": "0.22.1",
|
"version": "0.24.1",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
"config": {
|
"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",
|
"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: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|TestOrderSignerRegistryWithContractWallet|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|MixinKyberDmm|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": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -55,14 +55,14 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.5.2",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contract-addresses": "^6.0.0",
|
"@0x/contract-addresses": "^6.3.0",
|
||||||
"@0x/contracts-erc20": "^3.3.7",
|
"@0x/contracts-erc20": "^3.3.10",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/dev-utils": "^4.2.6",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/order-utils": "^10.4.20",
|
"@0x/order-utils": "^10.4.23",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@types/isomorphic-fetch": "^0.0.35",
|
"@types/isomorphic-fetch": "^0.0.35",
|
||||||
@@ -82,13 +82,13 @@
|
|||||||
"typescript": "4.2.2"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.3.2",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/protocol-utils": "^1.5.1",
|
"@0x/protocol-utils": "^1.6.2",
|
||||||
"@0x/subproviders": "^6.5.2",
|
"@0x/subproviders": "^6.5.3",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"ethereum-types": "^3.5.0",
|
"ethereum-types": "^3.5.0",
|
||||||
"ethereumjs-util": "^7.0.10"
|
"ethereumjs-util": "^7.0.10"
|
||||||
},
|
},
|
||||||
|
@@ -76,6 +76,7 @@ import * as LiquidityProviderSandbox from '../test/generated-artifacts/Liquidity
|
|||||||
import * as LogMetadataTransformer from '../test/generated-artifacts/LogMetadataTransformer.json';
|
import * as LogMetadataTransformer from '../test/generated-artifacts/LogMetadataTransformer.json';
|
||||||
import * as MetaTransactionsFeature from '../test/generated-artifacts/MetaTransactionsFeature.json';
|
import * as MetaTransactionsFeature from '../test/generated-artifacts/MetaTransactionsFeature.json';
|
||||||
import * as MixinBalancer from '../test/generated-artifacts/MixinBalancer.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 MixinBancor from '../test/generated-artifacts/MixinBancor.json';
|
||||||
import * as MixinCoFiX from '../test/generated-artifacts/MixinCoFiX.json';
|
import * as MixinCoFiX from '../test/generated-artifacts/MixinCoFiX.json';
|
||||||
import * as MixinCryptoCom from '../test/generated-artifacts/MixinCryptoCom.json';
|
import * as MixinCryptoCom from '../test/generated-artifacts/MixinCryptoCom.json';
|
||||||
@@ -83,6 +84,7 @@ import * as MixinCurve from '../test/generated-artifacts/MixinCurve.json';
|
|||||||
import * as MixinDodo from '../test/generated-artifacts/MixinDodo.json';
|
import * as MixinDodo from '../test/generated-artifacts/MixinDodo.json';
|
||||||
import * as MixinDodoV2 from '../test/generated-artifacts/MixinDodoV2.json';
|
import * as MixinDodoV2 from '../test/generated-artifacts/MixinDodoV2.json';
|
||||||
import * as MixinKyber from '../test/generated-artifacts/MixinKyber.json';
|
import * as MixinKyber from '../test/generated-artifacts/MixinKyber.json';
|
||||||
|
import * as MixinKyberDmm from '../test/generated-artifacts/MixinKyberDmm.json';
|
||||||
import * as MixinMakerPSM from '../test/generated-artifacts/MixinMakerPSM.json';
|
import * as MixinMakerPSM from '../test/generated-artifacts/MixinMakerPSM.json';
|
||||||
import * as MixinMooniswap from '../test/generated-artifacts/MixinMooniswap.json';
|
import * as MixinMooniswap from '../test/generated-artifacts/MixinMooniswap.json';
|
||||||
import * as MixinMStable from '../test/generated-artifacts/MixinMStable.json';
|
import * as MixinMStable from '../test/generated-artifacts/MixinMStable.json';
|
||||||
@@ -91,6 +93,7 @@ import * as MixinOasis from '../test/generated-artifacts/MixinOasis.json';
|
|||||||
import * as MixinShell from '../test/generated-artifacts/MixinShell.json';
|
import * as MixinShell from '../test/generated-artifacts/MixinShell.json';
|
||||||
import * as MixinUniswap from '../test/generated-artifacts/MixinUniswap.json';
|
import * as MixinUniswap from '../test/generated-artifacts/MixinUniswap.json';
|
||||||
import * as MixinUniswapV2 from '../test/generated-artifacts/MixinUniswapV2.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 MixinZeroExBridge from '../test/generated-artifacts/MixinZeroExBridge.json';
|
||||||
import * as MooniswapLiquidityProvider from '../test/generated-artifacts/MooniswapLiquidityProvider.json';
|
import * as MooniswapLiquidityProvider from '../test/generated-artifacts/MooniswapLiquidityProvider.json';
|
||||||
import * as MultiplexFeature from '../test/generated-artifacts/MultiplexFeature.json';
|
import * as MultiplexFeature from '../test/generated-artifacts/MultiplexFeature.json';
|
||||||
@@ -235,6 +238,7 @@ export const artifacts = {
|
|||||||
BridgeProtocols: BridgeProtocols as ContractArtifact,
|
BridgeProtocols: BridgeProtocols as ContractArtifact,
|
||||||
IBridgeAdapter: IBridgeAdapter as ContractArtifact,
|
IBridgeAdapter: IBridgeAdapter as ContractArtifact,
|
||||||
MixinBalancer: MixinBalancer as ContractArtifact,
|
MixinBalancer: MixinBalancer as ContractArtifact,
|
||||||
|
MixinBalancerV2: MixinBalancerV2 as ContractArtifact,
|
||||||
MixinBancor: MixinBancor as ContractArtifact,
|
MixinBancor: MixinBancor as ContractArtifact,
|
||||||
MixinCoFiX: MixinCoFiX as ContractArtifact,
|
MixinCoFiX: MixinCoFiX as ContractArtifact,
|
||||||
MixinCryptoCom: MixinCryptoCom as ContractArtifact,
|
MixinCryptoCom: MixinCryptoCom as ContractArtifact,
|
||||||
@@ -242,6 +246,7 @@ export const artifacts = {
|
|||||||
MixinDodo: MixinDodo as ContractArtifact,
|
MixinDodo: MixinDodo as ContractArtifact,
|
||||||
MixinDodoV2: MixinDodoV2 as ContractArtifact,
|
MixinDodoV2: MixinDodoV2 as ContractArtifact,
|
||||||
MixinKyber: MixinKyber as ContractArtifact,
|
MixinKyber: MixinKyber as ContractArtifact,
|
||||||
|
MixinKyberDmm: MixinKyberDmm as ContractArtifact,
|
||||||
MixinMStable: MixinMStable as ContractArtifact,
|
MixinMStable: MixinMStable as ContractArtifact,
|
||||||
MixinMakerPSM: MixinMakerPSM as ContractArtifact,
|
MixinMakerPSM: MixinMakerPSM as ContractArtifact,
|
||||||
MixinMooniswap: MixinMooniswap as ContractArtifact,
|
MixinMooniswap: MixinMooniswap as ContractArtifact,
|
||||||
@@ -250,6 +255,7 @@ export const artifacts = {
|
|||||||
MixinShell: MixinShell as ContractArtifact,
|
MixinShell: MixinShell as ContractArtifact,
|
||||||
MixinUniswap: MixinUniswap as ContractArtifact,
|
MixinUniswap: MixinUniswap as ContractArtifact,
|
||||||
MixinUniswapV2: MixinUniswapV2 as ContractArtifact,
|
MixinUniswapV2: MixinUniswapV2 as ContractArtifact,
|
||||||
|
MixinUniswapV3: MixinUniswapV3 as ContractArtifact,
|
||||||
MixinZeroExBridge: MixinZeroExBridge as ContractArtifact,
|
MixinZeroExBridge: MixinZeroExBridge as ContractArtifact,
|
||||||
ILiquidityProvider: ILiquidityProvider as ContractArtifact,
|
ILiquidityProvider: ILiquidityProvider as ContractArtifact,
|
||||||
IMooniswapPool: IMooniswapPool as ContractArtifact,
|
IMooniswapPool: IMooniswapPool as ContractArtifact,
|
||||||
|
@@ -3,9 +3,14 @@ import { MethodAbi } from 'ethereum-types';
|
|||||||
|
|
||||||
import * as wrappers from '../../src/wrappers';
|
import * as wrappers from '../../src/wrappers';
|
||||||
|
|
||||||
|
// tslint:disable:no-string-literal
|
||||||
|
|
||||||
blockchainTests('Selector collision test', env => {
|
blockchainTests('Selector collision test', env => {
|
||||||
it('Function selectors do not collide', () => {
|
it('Function selectors do not collide', () => {
|
||||||
const selectorToSignature: { [selector: string]: string } = {};
|
const selectorToSignature: { [selector: string]: string } = {};
|
||||||
|
selectorToSignature['bca8c7b5'] = 'executeCall(address,bytes)'; // legacy allowance target
|
||||||
|
selectorToSignature['a9059cbb'] = 'transfer(address,uint256)'; // ERC20Token transfer
|
||||||
|
selectorToSignature['23b872dd'] = 'transferFrom(address,address,uint256)'; // ERC20Token transferFrom
|
||||||
for (const wrapper of Object.values(wrappers)) {
|
for (const wrapper of Object.values(wrappers)) {
|
||||||
if (typeof wrapper === 'function') {
|
if (typeof wrapper === 'function') {
|
||||||
const contract = new wrapper(constants.NULL_ADDRESS, env.provider, env.txDefaults);
|
const contract = new wrapper(constants.NULL_ADDRESS, env.provider, env.txDefaults);
|
||||||
|
@@ -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/log_metadata_transformer';
|
||||||
export * from '../test/generated-wrappers/meta_transactions_feature';
|
export * from '../test/generated-wrappers/meta_transactions_feature';
|
||||||
export * from '../test/generated-wrappers/mixin_balancer';
|
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_bancor';
|
||||||
export * from '../test/generated-wrappers/mixin_co_fi_x';
|
export * from '../test/generated-wrappers/mixin_co_fi_x';
|
||||||
export * from '../test/generated-wrappers/mixin_crypto_com';
|
export * from '../test/generated-wrappers/mixin_crypto_com';
|
||||||
@@ -81,6 +82,7 @@ export * from '../test/generated-wrappers/mixin_curve';
|
|||||||
export * from '../test/generated-wrappers/mixin_dodo';
|
export * from '../test/generated-wrappers/mixin_dodo';
|
||||||
export * from '../test/generated-wrappers/mixin_dodo_v2';
|
export * from '../test/generated-wrappers/mixin_dodo_v2';
|
||||||
export * from '../test/generated-wrappers/mixin_kyber';
|
export * from '../test/generated-wrappers/mixin_kyber';
|
||||||
|
export * from '../test/generated-wrappers/mixin_kyber_dmm';
|
||||||
export * from '../test/generated-wrappers/mixin_m_stable';
|
export * from '../test/generated-wrappers/mixin_m_stable';
|
||||||
export * from '../test/generated-wrappers/mixin_maker_p_s_m';
|
export * from '../test/generated-wrappers/mixin_maker_p_s_m';
|
||||||
export * from '../test/generated-wrappers/mixin_mooniswap';
|
export * from '../test/generated-wrappers/mixin_mooniswap';
|
||||||
@@ -89,6 +91,7 @@ export * from '../test/generated-wrappers/mixin_oasis';
|
|||||||
export * from '../test/generated-wrappers/mixin_shell';
|
export * from '../test/generated-wrappers/mixin_shell';
|
||||||
export * from '../test/generated-wrappers/mixin_uniswap';
|
export * from '../test/generated-wrappers/mixin_uniswap';
|
||||||
export * from '../test/generated-wrappers/mixin_uniswap_v2';
|
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/mixin_zero_ex_bridge';
|
||||||
export * from '../test/generated-wrappers/mooniswap_liquidity_provider';
|
export * from '../test/generated-wrappers/mooniswap_liquidity_provider';
|
||||||
export * from '../test/generated-wrappers/multiplex_feature';
|
export * from '../test/generated-wrappers/multiplex_feature';
|
||||||
|
@@ -105,6 +105,7 @@
|
|||||||
"test/generated-artifacts/LogMetadataTransformer.json",
|
"test/generated-artifacts/LogMetadataTransformer.json",
|
||||||
"test/generated-artifacts/MetaTransactionsFeature.json",
|
"test/generated-artifacts/MetaTransactionsFeature.json",
|
||||||
"test/generated-artifacts/MixinBalancer.json",
|
"test/generated-artifacts/MixinBalancer.json",
|
||||||
|
"test/generated-artifacts/MixinBalancerV2.json",
|
||||||
"test/generated-artifacts/MixinBancor.json",
|
"test/generated-artifacts/MixinBancor.json",
|
||||||
"test/generated-artifacts/MixinCoFiX.json",
|
"test/generated-artifacts/MixinCoFiX.json",
|
||||||
"test/generated-artifacts/MixinCryptoCom.json",
|
"test/generated-artifacts/MixinCryptoCom.json",
|
||||||
@@ -112,6 +113,7 @@
|
|||||||
"test/generated-artifacts/MixinDodo.json",
|
"test/generated-artifacts/MixinDodo.json",
|
||||||
"test/generated-artifacts/MixinDodoV2.json",
|
"test/generated-artifacts/MixinDodoV2.json",
|
||||||
"test/generated-artifacts/MixinKyber.json",
|
"test/generated-artifacts/MixinKyber.json",
|
||||||
|
"test/generated-artifacts/MixinKyberDmm.json",
|
||||||
"test/generated-artifacts/MixinMStable.json",
|
"test/generated-artifacts/MixinMStable.json",
|
||||||
"test/generated-artifacts/MixinMakerPSM.json",
|
"test/generated-artifacts/MixinMakerPSM.json",
|
||||||
"test/generated-artifacts/MixinMooniswap.json",
|
"test/generated-artifacts/MixinMooniswap.json",
|
||||||
@@ -120,6 +122,7 @@
|
|||||||
"test/generated-artifacts/MixinShell.json",
|
"test/generated-artifacts/MixinShell.json",
|
||||||
"test/generated-artifacts/MixinUniswap.json",
|
"test/generated-artifacts/MixinUniswap.json",
|
||||||
"test/generated-artifacts/MixinUniswapV2.json",
|
"test/generated-artifacts/MixinUniswapV2.json",
|
||||||
|
"test/generated-artifacts/MixinUniswapV3.json",
|
||||||
"test/generated-artifacts/MixinZeroExBridge.json",
|
"test/generated-artifacts/MixinZeroExBridge.json",
|
||||||
"test/generated-artifacts/MooniswapLiquidityProvider.json",
|
"test/generated-artifacts/MooniswapLiquidityProvider.json",
|
||||||
"test/generated-artifacts/MultiplexFeature.json",
|
"test/generated-artifacts/MultiplexFeature.json",
|
||||||
|
36
package.json
36
package.json
@@ -10,7 +10,7 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"deps_versions:ci": "node ./node_modules/@0x/monorepo-scripts/lib/deps_versions.js",
|
"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 -p $PKG -c fix",
|
||||||
"ganache": "ganache-cli -p 8545 --gasLimit 10000000 --networkId 50 -m \"${npm_package_config_mnemonic}\"",
|
"ganache": "ganache-cli -p 8545 --gasLimit 10000000 --networkId 50 -m \"${npm_package_config_mnemonic}\"",
|
||||||
"prettier": "prettier --write '**/*.{ts,tsx,json,md}' --config .prettierrc",
|
"prettier": "prettier --write '**/*.{ts,tsx,json,md}' --config .prettierrc",
|
||||||
"prettier:ci": "prettier --list-different '**/*.{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",
|
"install:all": "yarn install",
|
||||||
"wsrun": "wsrun",
|
"wsrun": "wsrun",
|
||||||
"lerna": "lerna",
|
"lerna": "lerna",
|
||||||
"build": "lerna link && wsrun build $PKG -r --stages --fast-exit --exclude-missing",
|
"build": "lerna link && wsrun -r --stages --fast-exit --exclude-missing -p $PKG -c build",
|
||||||
"build:ci": "lerna link && wsrun build:ci $PKG --fast-exit -r --stages --exclude-missing",
|
"build:ci": "lerna link && wsrun --fast-exit -r --stages --exclude-missing -p $PKG -c build:ci",
|
||||||
"build:contracts": "lerna link && wsrun build -p ${npm_package_config_contractsPackages} -c --fast-exit -r --stages --exclude-missing",
|
"build:contracts": "lerna link && wsrun -p ${npm_package_config_contractsPackages} --fast-exit -r --stages --exclude-missing -c build",
|
||||||
"build:ts": "tsc -b",
|
"build:ts": "tsc -b",
|
||||||
"watch:ts": "tsc -b -w",
|
"watch:ts": "tsc -b -w",
|
||||||
"clean": "wsrun clean $PKG --fast-exit -r --parallel --exclude-missing",
|
"clean": "wsrun --fast-exit -r --parallel --exclude-missing -p $PKG -c clean",
|
||||||
"clean:contracts": "wsrun clean -p ${npm_package_config_contractsPackages} -c --fast-exit -r --parallel --exclude-missing",
|
"contracts:watch": "wsrun --parallel --exclude-missing -p $PKG -c watch",
|
||||||
"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",
|
|
||||||
"remove_node_modules": "lerna clean --yes; rm -rf node_modules",
|
"remove_node_modules": "lerna clean --yes; rm -rf node_modules",
|
||||||
"rebuild": "run-s clean build",
|
"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": "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 test $PKG --fast-exit --serial --exclude-missing",
|
"test:all": "wsrun --fast-exit --serial --exclude-missing -p $PKG -c test",
|
||||||
"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": "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 test --serial -p ${npm_package_config_contractsPackages} -c --fast-exit --exclude-missing",
|
"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",
|
"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",
|
"upload_md_docs": "aws s3 rm --recursive s3://docs-markdown; wsrun --exclude-missing -c s3:sync_md_docs",
|
||||||
"diff_md_docs:ci": "wsrun diff_docs --exclude-missing",
|
"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;",
|
"test:generate_docs:circleci": "for i in ${npm_package_config_packagesWithDocPages}; do yarn generate_doc --package $i || break -1; done;",
|
||||||
"bundlewatch": "bundlewatch",
|
"bundlewatch": "bundlewatch",
|
||||||
"lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing",
|
"lint": "wsrun --fast-exit --parallel --exclude-missing -p $PKG -c lint",
|
||||||
"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",
|
|
||||||
"upgrade_org_deps": "node node_modules/@0x/monorepo-scripts/lib/upgrade_deps.js -p '@0x|ethereum-types'",
|
"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",
|
"upgrade_deps": "node node_modules/@0x/monorepo-scripts/lib/upgrade_deps.js",
|
||||||
"verdaccio": "docker run --rm -i -p 4873:4873 0xorg/verdaccio"
|
"verdaccio": "docker run --rm -i -p 4873:4873 0xorg/verdaccio"
|
||||||
@@ -66,7 +60,7 @@
|
|||||||
"ignoreDependencyVersionsForPackage": "contract-wrappers"
|
"ignoreDependencyVersionsForPackage": "contract-wrappers"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/monorepo-scripts": "^3.1.6",
|
"@0x/monorepo-scripts": "^3.1.7",
|
||||||
"@0x-lerna-fork/lerna": "3.16.10",
|
"@0x-lerna-fork/lerna": "3.16.10",
|
||||||
"@0xproject/npm-cli-login": "^0.0.11",
|
"@0xproject/npm-cli-login": "^0.0.11",
|
||||||
"async-child-process": "^1.1.1",
|
"async-child-process": "^1.1.1",
|
||||||
@@ -78,7 +72,7 @@
|
|||||||
"prettier": "~1.16.3",
|
"prettier": "~1.16.3",
|
||||||
"source-map-support": "^0.5.6",
|
"source-map-support": "^0.5.6",
|
||||||
"typescript": "4.2.2",
|
"typescript": "4.2.2",
|
||||||
"wsrun": "^2.2.0"
|
"wsrun": "^5.2.4"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"merkle-patricia-tree": "^2.3.2"
|
"merkle-patricia-tree": "^2.3.2"
|
||||||
|
@@ -1,4 +1,162 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "6.17.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Re-enable liquidity provider and update KNC address",
|
||||||
|
"pr": 253
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1622154125
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "6.16.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Add support for the Polygon chain",
|
||||||
|
"pr": 240
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1621944788
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "6.15.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Fix KyberDmm",
|
||||||
|
"pr": 236
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Re-enable KyberDmm",
|
||||||
|
"pr": 247
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Add Huobi Token to liquidity provider tokens",
|
||||||
|
"pr": 246
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Temporarily disable specific LiquidityProvider"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1621600614
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "6.14.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Add support for additional sources and intermediate tokens on Ropsten",
|
||||||
|
"pr": 231
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1620810800
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "6.13.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Add LiquidityProvider to BSC sources",
|
||||||
|
"pr": 234
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1620703098
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "6.12.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "`TwoHopSampler` to use `call` over `staticcall` in order to support sources like `Uniswap_V3` and `Balancer_V2`",
|
||||||
|
"pr": 233
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1620610602
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "6.11.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Add price comparisons data separate from the quote report",
|
||||||
|
"pr": 219
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Add caching for top Balancer V2 pools on startup and during regular intervals",
|
||||||
|
"pr": 228
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Tweak compiler settings for smaller sampler bytecode",
|
||||||
|
"pr": 229
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Fix Multiplex multihop encoding for ETH buys/sells",
|
||||||
|
"pr": 230
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Fix Sampler address override for Ganache",
|
||||||
|
"pr": 232
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1620362129
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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",
|
"version": "6.8.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
@@ -38,6 +196,10 @@
|
|||||||
{
|
{
|
||||||
"note": "Support `Ropsten` network",
|
"note": "Support `Ropsten` network",
|
||||||
"pr": 203
|
"pr": 203
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "BSC Uniswap clones (ApeSwap, CafeSwap, CheeseSwap, JulSwap), Saddle BTC pool, Curve gas schedule",
|
||||||
|
"pr": 208
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"timestamp": 1618592834
|
"timestamp": 1618592834
|
||||||
|
@@ -5,6 +5,61 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v6.17.0 - _May 27, 2021_
|
||||||
|
|
||||||
|
* Re-enable liquidity provider and update KNC address (#253)
|
||||||
|
|
||||||
|
## v6.16.0 - _May 25, 2021_
|
||||||
|
|
||||||
|
* Add support for the Polygon chain (#240)
|
||||||
|
|
||||||
|
## v6.15.0 - _May 21, 2021_
|
||||||
|
|
||||||
|
* Fix KyberDmm (#236)
|
||||||
|
* Re-enable KyberDmm (#247)
|
||||||
|
* Add Huobi Token to liquidity provider tokens (#246)
|
||||||
|
* Temporarily disable specific LiquidityProvider
|
||||||
|
|
||||||
|
## v6.14.0 - _May 12, 2021_
|
||||||
|
|
||||||
|
* Add support for additional sources and intermediate tokens on Ropsten (#231)
|
||||||
|
|
||||||
|
## v6.13.0 - _May 11, 2021_
|
||||||
|
|
||||||
|
* Add LiquidityProvider to BSC sources (#234)
|
||||||
|
|
||||||
|
## v6.12.0 - _May 10, 2021_
|
||||||
|
|
||||||
|
* `TwoHopSampler` to use `call` over `staticcall` in order to support sources like `Uniswap_V3` and `Balancer_V2` (#233)
|
||||||
|
|
||||||
|
## v6.11.0 - _May 7, 2021_
|
||||||
|
|
||||||
|
* Add price comparisons data separate from the quote report (#219)
|
||||||
|
* Add caching for top Balancer V2 pools on startup and during regular intervals (#228)
|
||||||
|
* Tweak compiler settings for smaller sampler bytecode (#229)
|
||||||
|
* Fix Multiplex multihop encoding for ETH buys/sells (#230)
|
||||||
|
* Fix Sampler address override for Ganache (#232)
|
||||||
|
|
||||||
|
## 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_
|
## v6.8.0 - _April 28, 2021_
|
||||||
|
|
||||||
* Prune paths which cannot improve the best path (#183)
|
* Prune paths which cannot improve the best path (#183)
|
||||||
@@ -21,6 +76,7 @@ CHANGELOG
|
|||||||
## v6.6.0 - _April 16, 2021_
|
## v6.6.0 - _April 16, 2021_
|
||||||
|
|
||||||
* Support `Ropsten` network (#203)
|
* Support `Ropsten` network (#203)
|
||||||
|
* BSC Uniswap clones (ApeSwap, CafeSwap, CheeseSwap, JulSwap), Saddle BTC pool, Curve gas schedule (#208)
|
||||||
|
|
||||||
## v6.5.3 - _April 14, 2021_
|
## v6.5.3 - _April 14, 2021_
|
||||||
|
|
||||||
|
@@ -6,11 +6,7 @@
|
|||||||
"shouldSaveStandardInput": true,
|
"shouldSaveStandardInput": true,
|
||||||
"compilerSettings": {
|
"compilerSettings": {
|
||||||
"evmVersion": "istanbul",
|
"evmVersion": "istanbul",
|
||||||
"optimizer": {
|
"optimizer": { "enabled": true, "runs": 200, "details": { "yul": true, "deduplicate": true } },
|
||||||
"enabled": true,
|
|
||||||
"runs": 62500,
|
|
||||||
"details": { "yul": true, "deduplicate": true, "cse": true, "constantOptimizer": true }
|
|
||||||
},
|
|
||||||
"outputSelection": {
|
"outputSelection": {
|
||||||
"*": {
|
"*": {
|
||||||
"*": [
|
"*": [
|
||||||
|
189
packages/asset-swapper/contracts/src/BalancerV2Sampler.sol
Normal file
189
packages/asset-swapper/contracts/src/BalancerV2Sampler.sol
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
// 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;
|
||||||
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
|
import "./SamplerUtils.sol";
|
||||||
|
|
||||||
|
/// @dev Minimal Balancer V2 Vault interface
|
||||||
|
/// for documentation refer to https://github.com/balancer-labs/balancer-core-v2/blob/master/contracts/vault/interfaces/IVault.sol
|
||||||
|
interface IBalancerV2Vault {
|
||||||
|
enum SwapKind { GIVEN_IN, GIVEN_OUT }
|
||||||
|
|
||||||
|
struct BatchSwapStep {
|
||||||
|
bytes32 poolId;
|
||||||
|
uint256 assetInIndex;
|
||||||
|
uint256 assetOutIndex;
|
||||||
|
uint256 amount;
|
||||||
|
bytes userData;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct FundManagement {
|
||||||
|
address sender;
|
||||||
|
bool fromInternalBalance;
|
||||||
|
address payable recipient;
|
||||||
|
bool toInternalBalance;
|
||||||
|
}
|
||||||
|
|
||||||
|
function queryBatchSwap(
|
||||||
|
SwapKind kind,
|
||||||
|
BatchSwapStep[] calldata swaps,
|
||||||
|
IAsset[] calldata assets,
|
||||||
|
FundManagement calldata funds
|
||||||
|
) external returns (int256[] memory assetDeltas);
|
||||||
|
}
|
||||||
|
interface IAsset {
|
||||||
|
// solhint-disable-previous-line no-empty-blocks
|
||||||
|
}
|
||||||
|
|
||||||
|
contract BalancerV2Sampler is SamplerUtils {
|
||||||
|
|
||||||
|
struct BalancerV2PoolInfo {
|
||||||
|
bytes32 poolId;
|
||||||
|
address vault;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @dev Sample sell quotes from Balancer V2.
|
||||||
|
/// @param poolInfo Struct with pool related data
|
||||||
|
/// @param takerToken Address of the taker token (what to sell).
|
||||||
|
/// @param makerToken Address of the maker token (what to buy).
|
||||||
|
/// @param takerTokenAmounts Taker token sell amount for each sample.
|
||||||
|
/// @return makerTokenAmounts Maker amounts bought at each taker token
|
||||||
|
/// amount.
|
||||||
|
function sampleSellsFromBalancerV2(
|
||||||
|
BalancerV2PoolInfo memory poolInfo,
|
||||||
|
address takerToken,
|
||||||
|
address makerToken,
|
||||||
|
uint256[] memory takerTokenAmounts
|
||||||
|
)
|
||||||
|
public
|
||||||
|
returns (uint256[] memory makerTokenAmounts)
|
||||||
|
{
|
||||||
|
_assertValidPair(makerToken, takerToken);
|
||||||
|
IBalancerV2Vault vault = IBalancerV2Vault(poolInfo.vault);
|
||||||
|
IAsset[] memory swapAssets = new IAsset[](2);
|
||||||
|
swapAssets[0] = IAsset(takerToken);
|
||||||
|
swapAssets[1] = IAsset(makerToken);
|
||||||
|
|
||||||
|
uint256 numSamples = takerTokenAmounts.length;
|
||||||
|
makerTokenAmounts = new uint256[](numSamples);
|
||||||
|
IBalancerV2Vault.FundManagement memory swapFunds =
|
||||||
|
_createSwapFunds();
|
||||||
|
|
||||||
|
for (uint256 i = 0; i < numSamples; i++) {
|
||||||
|
IBalancerV2Vault.BatchSwapStep[] memory swapSteps =
|
||||||
|
_createSwapSteps(poolInfo, takerTokenAmounts[i]);
|
||||||
|
|
||||||
|
try
|
||||||
|
// For sells we specify the takerToken which is what the vault will receive from the trade
|
||||||
|
vault.queryBatchSwap(IBalancerV2Vault.SwapKind.GIVEN_IN, swapSteps, swapAssets, swapFunds)
|
||||||
|
// amounts represent pool balance deltas from the swap (incoming balance, outgoing balance)
|
||||||
|
returns (int256[] memory amounts) {
|
||||||
|
// Outgoing balance is negative so we need to flip the sign
|
||||||
|
int256 amountOutFromPool = amounts[1] * -1;
|
||||||
|
if (amountOutFromPool <= 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
makerTokenAmounts[i] = uint256(amountOutFromPool);
|
||||||
|
} catch (bytes memory) {
|
||||||
|
// Swallow failures, leaving all results as zero.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @dev Sample buy quotes from Balancer V2.
|
||||||
|
/// @param poolInfo Struct with pool related data
|
||||||
|
/// @param takerToken Address of the taker token (what to sell).
|
||||||
|
/// @param makerToken Address of the maker token (what to buy).
|
||||||
|
/// @param makerTokenAmounts Maker token buy amount for each sample.
|
||||||
|
/// @return takerTokenAmounts Taker amounts sold at each maker token
|
||||||
|
/// amount.
|
||||||
|
function sampleBuysFromBalancerV2(
|
||||||
|
BalancerV2PoolInfo memory poolInfo,
|
||||||
|
address takerToken,
|
||||||
|
address makerToken,
|
||||||
|
uint256[] memory makerTokenAmounts
|
||||||
|
)
|
||||||
|
public
|
||||||
|
returns (uint256[] memory takerTokenAmounts)
|
||||||
|
{
|
||||||
|
_assertValidPair(makerToken, takerToken);
|
||||||
|
IBalancerV2Vault vault = IBalancerV2Vault(poolInfo.vault);
|
||||||
|
IAsset[] memory swapAssets = new IAsset[](2);
|
||||||
|
swapAssets[0] = IAsset(takerToken);
|
||||||
|
swapAssets[1] = IAsset(makerToken);
|
||||||
|
|
||||||
|
uint256 numSamples = makerTokenAmounts.length;
|
||||||
|
takerTokenAmounts = new uint256[](numSamples);
|
||||||
|
IBalancerV2Vault.FundManagement memory swapFunds =
|
||||||
|
_createSwapFunds();
|
||||||
|
|
||||||
|
for (uint256 i = 0; i < numSamples; i++) {
|
||||||
|
IBalancerV2Vault.BatchSwapStep[] memory swapSteps =
|
||||||
|
_createSwapSteps(poolInfo, makerTokenAmounts[i]);
|
||||||
|
|
||||||
|
try
|
||||||
|
// For buys we specify the makerToken which is what taker will receive from the trade
|
||||||
|
vault.queryBatchSwap(IBalancerV2Vault.SwapKind.GIVEN_OUT, swapSteps, swapAssets, swapFunds)
|
||||||
|
returns (int256[] memory amounts) {
|
||||||
|
int256 amountIntoPool = amounts[0];
|
||||||
|
if (amountIntoPool <= 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
takerTokenAmounts[i] = uint256(amountIntoPool);
|
||||||
|
} catch (bytes memory) {
|
||||||
|
// Swallow failures, leaving all results as zero.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _createSwapSteps(
|
||||||
|
BalancerV2PoolInfo memory poolInfo,
|
||||||
|
uint256 amount
|
||||||
|
) private pure returns (IBalancerV2Vault.BatchSwapStep[] memory) {
|
||||||
|
IBalancerV2Vault.BatchSwapStep[] memory swapSteps =
|
||||||
|
new IBalancerV2Vault.BatchSwapStep[](1);
|
||||||
|
swapSteps[0] = IBalancerV2Vault.BatchSwapStep({
|
||||||
|
poolId: poolInfo.poolId,
|
||||||
|
assetInIndex: 0,
|
||||||
|
assetOutIndex: 1,
|
||||||
|
amount: amount,
|
||||||
|
userData: ""
|
||||||
|
});
|
||||||
|
|
||||||
|
return swapSteps;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _createSwapFunds()
|
||||||
|
private
|
||||||
|
view
|
||||||
|
returns (IBalancerV2Vault.FundManagement memory)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
IBalancerV2Vault.FundManagement({
|
||||||
|
sender: address(this),
|
||||||
|
fromInternalBalance: false,
|
||||||
|
recipient: payable(address(this)),
|
||||||
|
toInternalBalance: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@@ -22,16 +22,15 @@ pragma experimental ABIEncoderV2;
|
|||||||
|
|
||||||
import "./interfaces/IBancor.sol";
|
import "./interfaces/IBancor.sol";
|
||||||
|
|
||||||
contract DeploymentConstants {}
|
contract CompilerHack {}
|
||||||
|
|
||||||
contract BancorSampler is DeploymentConstants
|
contract BancorSampler is CompilerHack {
|
||||||
{
|
|
||||||
|
|
||||||
/// @dev Base gas limit for Bancor calls.
|
/// @dev Base gas limit for Bancor calls.
|
||||||
uint256 constant private BANCOR_CALL_GAS = 300e3; // 300k
|
uint256 constant private BANCOR_CALL_GAS = 300e3; // 300k
|
||||||
|
|
||||||
struct BancorSamplerOpts {
|
struct BancorSamplerOpts {
|
||||||
address registry;
|
IBancorRegistry registry;
|
||||||
address[][] paths;
|
address[][] paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +111,7 @@ contract BancorSampler is DeploymentConstants
|
|||||||
view
|
view
|
||||||
returns (address bancorNetwork, address[] memory path)
|
returns (address bancorNetwork, address[] memory path)
|
||||||
{
|
{
|
||||||
bancorNetwork = _getBancorNetwork(opts.registry);
|
bancorNetwork = opts.registry.getAddress(opts.registry.BANCOR_NETWORK());
|
||||||
if (opts.paths.length == 0) {
|
if (opts.paths.length == 0) {
|
||||||
return (bancorNetwork, path);
|
return (bancorNetwork, path);
|
||||||
}
|
}
|
||||||
@@ -140,13 +139,4 @@ contract BancorSampler is DeploymentConstants
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _getBancorNetwork(address registry)
|
|
||||||
private
|
|
||||||
view
|
|
||||||
returns (address)
|
|
||||||
{
|
|
||||||
IBancorRegistry registry = IBancorRegistry(registry);
|
|
||||||
return registry.getAddress(registry.BANCOR_NETWORK());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -21,12 +21,14 @@ pragma solidity ^0.6;
|
|||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "./BalancerSampler.sol";
|
import "./BalancerSampler.sol";
|
||||||
|
import "./BalancerV2Sampler.sol";
|
||||||
import "./BancorSampler.sol";
|
import "./BancorSampler.sol";
|
||||||
import "./CurveSampler.sol";
|
import "./CurveSampler.sol";
|
||||||
import "./DODOSampler.sol";
|
import "./DODOSampler.sol";
|
||||||
import "./DODOV2Sampler.sol";
|
import "./DODOV2Sampler.sol";
|
||||||
import "./Eth2DaiSampler.sol";
|
import "./Eth2DaiSampler.sol";
|
||||||
import "./KyberSampler.sol";
|
import "./KyberSampler.sol";
|
||||||
|
import "./KyberDmmSampler.sol";
|
||||||
import "./LiquidityProviderSampler.sol";
|
import "./LiquidityProviderSampler.sol";
|
||||||
import "./MakerPSMSampler.sol";
|
import "./MakerPSMSampler.sol";
|
||||||
import "./MultiBridgeSampler.sol";
|
import "./MultiBridgeSampler.sol";
|
||||||
@@ -38,17 +40,20 @@ import "./SmoothySampler.sol";
|
|||||||
import "./TwoHopSampler.sol";
|
import "./TwoHopSampler.sol";
|
||||||
import "./UniswapSampler.sol";
|
import "./UniswapSampler.sol";
|
||||||
import "./UniswapV2Sampler.sol";
|
import "./UniswapV2Sampler.sol";
|
||||||
|
import "./UniswapV3Sampler.sol";
|
||||||
import "./UtilitySampler.sol";
|
import "./UtilitySampler.sol";
|
||||||
|
|
||||||
|
|
||||||
contract ERC20BridgeSampler is
|
contract ERC20BridgeSampler is
|
||||||
BalancerSampler,
|
BalancerSampler,
|
||||||
|
BalancerV2Sampler,
|
||||||
BancorSampler,
|
BancorSampler,
|
||||||
CurveSampler,
|
CurveSampler,
|
||||||
DODOSampler,
|
DODOSampler,
|
||||||
DODOV2Sampler,
|
DODOV2Sampler,
|
||||||
Eth2DaiSampler,
|
Eth2DaiSampler,
|
||||||
KyberSampler,
|
KyberSampler,
|
||||||
|
KyberDmmSampler,
|
||||||
LiquidityProviderSampler,
|
LiquidityProviderSampler,
|
||||||
MakerPSMSampler,
|
MakerPSMSampler,
|
||||||
MStableSampler,
|
MStableSampler,
|
||||||
@@ -60,6 +65,7 @@ contract ERC20BridgeSampler is
|
|||||||
TwoHopSampler,
|
TwoHopSampler,
|
||||||
UniswapSampler,
|
UniswapSampler,
|
||||||
UniswapV2Sampler,
|
UniswapV2Sampler,
|
||||||
|
UniswapV3Sampler,
|
||||||
UtilitySampler
|
UtilitySampler
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -73,7 +79,6 @@ contract ERC20BridgeSampler is
|
|||||||
/// @return callResults ABI-encoded results data for each call.
|
/// @return callResults ABI-encoded results data for each call.
|
||||||
function batchCall(bytes[] calldata callDatas)
|
function batchCall(bytes[] calldata callDatas)
|
||||||
external
|
external
|
||||||
view
|
|
||||||
returns (CallResults[] memory callResults)
|
returns (CallResults[] memory callResults)
|
||||||
{
|
{
|
||||||
callResults = new CallResults[](callDatas.length);
|
callResults = new CallResults[](callDatas.length);
|
||||||
@@ -82,7 +87,7 @@ contract ERC20BridgeSampler is
|
|||||||
if (callDatas[i].length == 0) {
|
if (callDatas[i].length == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
(callResults[i].success, callResults[i].data) = address(this).staticcall(callDatas[i]);
|
(callResults[i].success, callResults[i].data) = address(this).call(callDatas[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
159
packages/asset-swapper/contracts/src/KyberDmmSampler.sol
Normal file
159
packages/asset-swapper/contracts/src/KyberDmmSampler.sol
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
// 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;
|
||||||
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
|
interface IKyberDmmFactory {
|
||||||
|
|
||||||
|
function getPoolAtIndex(address token0, address token1, uint256 index)
|
||||||
|
external
|
||||||
|
view
|
||||||
|
returns (address);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IKyberDmmRouter {
|
||||||
|
|
||||||
|
function factory() external view returns (address);
|
||||||
|
|
||||||
|
function getAmountsOut(uint256 amountIn, address[] calldata pools, address[] calldata path)
|
||||||
|
external
|
||||||
|
view
|
||||||
|
returns (uint256[] memory amounts);
|
||||||
|
|
||||||
|
function getAmountsIn(uint256 amountOut, address[] calldata pools, address[] calldata path)
|
||||||
|
external
|
||||||
|
view
|
||||||
|
returns (uint256[] memory amounts);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
contract KyberDmmSampler
|
||||||
|
{
|
||||||
|
/// @dev Gas limit for KyberDmm calls.
|
||||||
|
uint256 constant private KYBER_DMM_CALL_GAS = 150e3; // 150k
|
||||||
|
|
||||||
|
/// @dev Sample sell quotes from KyberDmm.
|
||||||
|
/// @param router Router to look up tokens and amounts
|
||||||
|
/// @param path Token route. Should be takerToken -> makerToken
|
||||||
|
/// @param takerTokenAmounts Taker token sell amount for each sample.
|
||||||
|
/// @return pools The pool addresses involved in the multi path trade
|
||||||
|
/// @return makerTokenAmounts Maker amounts bought at each taker token
|
||||||
|
/// amount.
|
||||||
|
function sampleSellsFromKyberDmm(
|
||||||
|
address router,
|
||||||
|
address[] memory path,
|
||||||
|
uint256[] memory takerTokenAmounts
|
||||||
|
)
|
||||||
|
public
|
||||||
|
view
|
||||||
|
returns (address[] memory pools, uint256[] memory makerTokenAmounts)
|
||||||
|
{
|
||||||
|
uint256 numSamples = takerTokenAmounts.length;
|
||||||
|
makerTokenAmounts = new uint256[](numSamples);
|
||||||
|
pools = _getKyberDmmPools(router, path);
|
||||||
|
if (pools.length == 0) {
|
||||||
|
return (pools, makerTokenAmounts);
|
||||||
|
}
|
||||||
|
for (uint256 i = 0; i < numSamples; i++) {
|
||||||
|
try
|
||||||
|
IKyberDmmRouter(router).getAmountsOut
|
||||||
|
{gas: KYBER_DMM_CALL_GAS}
|
||||||
|
(takerTokenAmounts[i], pools, path)
|
||||||
|
returns (uint256[] memory amounts)
|
||||||
|
{
|
||||||
|
makerTokenAmounts[i] = amounts[path.length - 1];
|
||||||
|
// Break early if there are 0 amounts
|
||||||
|
if (makerTokenAmounts[i] == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (bytes memory) {
|
||||||
|
// Swallow failures, leaving all results as zero.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @dev Sample buy quotes from KyberDmm.
|
||||||
|
/// @param router Router to look up tokens and amounts
|
||||||
|
/// @param path Token route. Should be takerToken -> makerToken.
|
||||||
|
/// @param makerTokenAmounts Maker token buy amount for each sample.
|
||||||
|
/// @return pools The pool addresses involved in the multi path trade
|
||||||
|
/// @return takerTokenAmounts Taker amounts sold at each maker token
|
||||||
|
/// amount.
|
||||||
|
function sampleBuysFromKyberDmm(
|
||||||
|
address router,
|
||||||
|
address[] memory path,
|
||||||
|
uint256[] memory makerTokenAmounts
|
||||||
|
)
|
||||||
|
public
|
||||||
|
view
|
||||||
|
returns (address[] memory pools, uint256[] memory takerTokenAmounts)
|
||||||
|
{
|
||||||
|
uint256 numSamples = makerTokenAmounts.length;
|
||||||
|
takerTokenAmounts = new uint256[](numSamples);
|
||||||
|
pools = _getKyberDmmPools(router, path);
|
||||||
|
if (pools.length == 0) {
|
||||||
|
return (pools, takerTokenAmounts);
|
||||||
|
}
|
||||||
|
for (uint256 i = 0; i < numSamples; i++) {
|
||||||
|
try
|
||||||
|
IKyberDmmRouter(router).getAmountsIn
|
||||||
|
{gas: KYBER_DMM_CALL_GAS}
|
||||||
|
(makerTokenAmounts[i], pools, path)
|
||||||
|
returns (uint256[] memory amounts)
|
||||||
|
{
|
||||||
|
takerTokenAmounts[i] = amounts[0];
|
||||||
|
// Break early if there are 0 amounts
|
||||||
|
if (takerTokenAmounts[i] == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (bytes memory) {
|
||||||
|
// Swallow failures, leaving all results as zero.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _getKyberDmmPools(
|
||||||
|
address router,
|
||||||
|
address[] memory path
|
||||||
|
)
|
||||||
|
private
|
||||||
|
view
|
||||||
|
returns (address[] memory pools)
|
||||||
|
{
|
||||||
|
pools = new address[](path.length - 1);
|
||||||
|
IKyberDmmFactory factory = IKyberDmmFactory(IKyberDmmRouter(router).factory());
|
||||||
|
for (uint256 i = 0; i < pools.length; i++) {
|
||||||
|
// Currently only supporting the first pool found at the index
|
||||||
|
try
|
||||||
|
factory.getPoolAtIndex
|
||||||
|
{gas: KYBER_DMM_CALL_GAS}
|
||||||
|
(path[i], path[i + 1], 0)
|
||||||
|
returns (address pool)
|
||||||
|
{
|
||||||
|
pools[i] = pool;
|
||||||
|
} catch (bytes memory) {
|
||||||
|
return new address[](0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -49,6 +49,7 @@ contract MStableSampler is
|
|||||||
view
|
view
|
||||||
returns (uint256[] memory makerTokenAmounts)
|
returns (uint256[] memory makerTokenAmounts)
|
||||||
{
|
{
|
||||||
|
_assertValidPair(makerToken, takerToken);
|
||||||
// Initialize array of maker token amounts.
|
// Initialize array of maker token amounts.
|
||||||
uint256 numSamples = takerTokenAmounts.length;
|
uint256 numSamples = takerTokenAmounts.length;
|
||||||
makerTokenAmounts = new uint256[](numSamples);
|
makerTokenAmounts = new uint256[](numSamples);
|
||||||
@@ -58,7 +59,7 @@ contract MStableSampler is
|
|||||||
IMStable(router).getSwapOutput
|
IMStable(router).getSwapOutput
|
||||||
{gas: DEFAULT_CALL_GAS}
|
{gas: DEFAULT_CALL_GAS}
|
||||||
(takerToken, makerToken, takerTokenAmounts[i])
|
(takerToken, makerToken, takerTokenAmounts[i])
|
||||||
returns (bool, string memory, uint256 amount)
|
returns (uint256 amount)
|
||||||
{
|
{
|
||||||
makerTokenAmounts[i] = amount;
|
makerTokenAmounts[i] = amount;
|
||||||
// Break early if there are 0 amounts
|
// Break early if there are 0 amounts
|
||||||
|
@@ -37,7 +37,6 @@ contract TwoHopSampler {
|
|||||||
uint256 sellAmount
|
uint256 sellAmount
|
||||||
)
|
)
|
||||||
public
|
public
|
||||||
view
|
|
||||||
returns (
|
returns (
|
||||||
HopInfo memory firstHop,
|
HopInfo memory firstHop,
|
||||||
HopInfo memory secondHop,
|
HopInfo memory secondHop,
|
||||||
@@ -47,7 +46,7 @@ contract TwoHopSampler {
|
|||||||
uint256 intermediateAssetAmount = 0;
|
uint256 intermediateAssetAmount = 0;
|
||||||
for (uint256 i = 0; i != firstHopCalls.length; ++i) {
|
for (uint256 i = 0; i != firstHopCalls.length; ++i) {
|
||||||
firstHopCalls[i].writeUint256(firstHopCalls[i].length - 32, sellAmount);
|
firstHopCalls[i].writeUint256(firstHopCalls[i].length - 32, sellAmount);
|
||||||
(bool didSucceed, bytes memory returnData) = address(this).staticcall(firstHopCalls[i]);
|
(bool didSucceed, bytes memory returnData) = address(this).call(firstHopCalls[i]);
|
||||||
if (didSucceed) {
|
if (didSucceed) {
|
||||||
uint256 amount = returnData.readUint256(returnData.length - 32);
|
uint256 amount = returnData.readUint256(returnData.length - 32);
|
||||||
if (amount > intermediateAssetAmount) {
|
if (amount > intermediateAssetAmount) {
|
||||||
@@ -62,7 +61,7 @@ contract TwoHopSampler {
|
|||||||
}
|
}
|
||||||
for (uint256 j = 0; j != secondHopCalls.length; ++j) {
|
for (uint256 j = 0; j != secondHopCalls.length; ++j) {
|
||||||
secondHopCalls[j].writeUint256(secondHopCalls[j].length - 32, intermediateAssetAmount);
|
secondHopCalls[j].writeUint256(secondHopCalls[j].length - 32, intermediateAssetAmount);
|
||||||
(bool didSucceed, bytes memory returnData) = address(this).staticcall(secondHopCalls[j]);
|
(bool didSucceed, bytes memory returnData) = address(this).call(secondHopCalls[j]);
|
||||||
if (didSucceed) {
|
if (didSucceed) {
|
||||||
uint256 amount = returnData.readUint256(returnData.length - 32);
|
uint256 amount = returnData.readUint256(returnData.length - 32);
|
||||||
if (amount > buyAmount) {
|
if (amount > buyAmount) {
|
||||||
@@ -80,7 +79,6 @@ contract TwoHopSampler {
|
|||||||
uint256 buyAmount
|
uint256 buyAmount
|
||||||
)
|
)
|
||||||
public
|
public
|
||||||
view
|
|
||||||
returns (
|
returns (
|
||||||
HopInfo memory firstHop,
|
HopInfo memory firstHop,
|
||||||
HopInfo memory secondHop,
|
HopInfo memory secondHop,
|
||||||
@@ -91,7 +89,7 @@ contract TwoHopSampler {
|
|||||||
uint256 intermediateAssetAmount = uint256(-1);
|
uint256 intermediateAssetAmount = uint256(-1);
|
||||||
for (uint256 j = 0; j != secondHopCalls.length; ++j) {
|
for (uint256 j = 0; j != secondHopCalls.length; ++j) {
|
||||||
secondHopCalls[j].writeUint256(secondHopCalls[j].length - 32, buyAmount);
|
secondHopCalls[j].writeUint256(secondHopCalls[j].length - 32, buyAmount);
|
||||||
(bool didSucceed, bytes memory returnData) = address(this).staticcall(secondHopCalls[j]);
|
(bool didSucceed, bytes memory returnData) = address(this).call(secondHopCalls[j]);
|
||||||
if (didSucceed) {
|
if (didSucceed) {
|
||||||
uint256 amount = returnData.readUint256(returnData.length - 32);
|
uint256 amount = returnData.readUint256(returnData.length - 32);
|
||||||
if (
|
if (
|
||||||
@@ -109,7 +107,7 @@ contract TwoHopSampler {
|
|||||||
}
|
}
|
||||||
for (uint256 i = 0; i != firstHopCalls.length; ++i) {
|
for (uint256 i = 0; i != firstHopCalls.length; ++i) {
|
||||||
firstHopCalls[i].writeUint256(firstHopCalls[i].length - 32, intermediateAssetAmount);
|
firstHopCalls[i].writeUint256(firstHopCalls[i].length - 32, intermediateAssetAmount);
|
||||||
(bool didSucceed, bytes memory returnData) = address(this).staticcall(firstHopCalls[i]);
|
(bool didSucceed, bytes memory returnData) = address(this).call(firstHopCalls[i]);
|
||||||
if (didSucceed) {
|
if (didSucceed) {
|
||||||
uint256 amount = returnData.readUint256(returnData.length - 32);
|
uint256 amount = returnData.readUint256(returnData.length - 32);
|
||||||
if (
|
if (
|
||||||
|
313
packages/asset-swapper/contracts/src/UniswapV3Sampler.sol
Normal file
313
packages/asset-swapper/contracts/src/UniswapV3Sampler.sol
Normal file
@@ -0,0 +1,313 @@
|
|||||||
|
// 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;
|
||||||
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
|
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
|
||||||
|
|
||||||
|
interface IUniswapV3Quoter {
|
||||||
|
function factory()
|
||||||
|
external
|
||||||
|
view
|
||||||
|
returns (IUniswapV3Factory factory);
|
||||||
|
function quoteExactInput(bytes memory path, uint256 amountIn)
|
||||||
|
external
|
||||||
|
returns (uint256 amountOut);
|
||||||
|
function quoteExactOutput(bytes memory path, uint256 amountOut)
|
||||||
|
external
|
||||||
|
returns (uint256 amountIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IUniswapV3Factory {
|
||||||
|
function getPool(IERC20TokenV06 a, IERC20TokenV06 b, uint24 fee)
|
||||||
|
external
|
||||||
|
view
|
||||||
|
returns (IUniswapV3Pool pool);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IUniswapV3Pool {
|
||||||
|
function token0() external view returns (IERC20TokenV06);
|
||||||
|
function token1() external view returns (IERC20TokenV06);
|
||||||
|
function fee() external view returns (uint24);
|
||||||
|
}
|
||||||
|
|
||||||
|
contract UniswapV3Sampler
|
||||||
|
{
|
||||||
|
/// @dev Gas limit for UniswapV3 calls. This is 100% a guess.
|
||||||
|
uint256 constant private QUOTE_GAS = 300e3;
|
||||||
|
|
||||||
|
/// @dev Sample sell quotes from UniswapV3.
|
||||||
|
/// @param quoter UniswapV3 Quoter contract.
|
||||||
|
/// @param path Token route. Should be takerToken -> makerToken
|
||||||
|
/// @param takerTokenAmounts Taker token sell amount for each sample.
|
||||||
|
/// @return uniswapPaths The encoded uniswap path for each sample.
|
||||||
|
/// @return makerTokenAmounts Maker amounts bought at each taker token
|
||||||
|
/// amount.
|
||||||
|
function sampleSellsFromUniswapV3(
|
||||||
|
IUniswapV3Quoter quoter,
|
||||||
|
IERC20TokenV06[] memory path,
|
||||||
|
uint256[] memory takerTokenAmounts
|
||||||
|
)
|
||||||
|
public
|
||||||
|
returns (
|
||||||
|
bytes[] memory uniswapPaths,
|
||||||
|
uint256[] memory makerTokenAmounts
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IUniswapV3Pool[][] memory poolPaths =
|
||||||
|
_getValidPoolPaths(quoter.factory(), path, 0);
|
||||||
|
|
||||||
|
makerTokenAmounts = new uint256[](takerTokenAmounts.length);
|
||||||
|
uniswapPaths = new bytes[](takerTokenAmounts.length);
|
||||||
|
|
||||||
|
for (uint256 i = 0; i < takerTokenAmounts.length; ++i) {
|
||||||
|
// Pick the best result from all the paths.
|
||||||
|
bytes memory topUniswapPath;
|
||||||
|
uint256 topBuyAmount = 0;
|
||||||
|
for (uint256 j = 0; j < poolPaths.length; ++j) {
|
||||||
|
bytes memory uniswapPath = _toUniswapPath(path, poolPaths[j]);
|
||||||
|
try
|
||||||
|
quoter.quoteExactInput
|
||||||
|
{ gas: QUOTE_GAS }
|
||||||
|
(uniswapPath, takerTokenAmounts[i])
|
||||||
|
returns (uint256 buyAmount)
|
||||||
|
{
|
||||||
|
if (topBuyAmount <= buyAmount) {
|
||||||
|
topBuyAmount = buyAmount;
|
||||||
|
topUniswapPath = uniswapPath;
|
||||||
|
}
|
||||||
|
} catch { }
|
||||||
|
}
|
||||||
|
// Break early if we can't complete the buys.
|
||||||
|
if (topBuyAmount == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
makerTokenAmounts[i] = topBuyAmount;
|
||||||
|
uniswapPaths[i] = topUniswapPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @dev Sample buy quotes from UniswapV3.
|
||||||
|
/// @param quoter UniswapV3 Quoter contract.
|
||||||
|
/// @param path Token route. Should be takerToken -> makerToken.
|
||||||
|
/// @param makerTokenAmounts Maker token buy amount for each sample.
|
||||||
|
/// @return uniswapPaths The encoded uniswap path for each sample.
|
||||||
|
/// @return takerTokenAmounts Taker amounts sold at each maker token
|
||||||
|
/// amount.
|
||||||
|
function sampleBuysFromUniswapV3(
|
||||||
|
IUniswapV3Quoter quoter,
|
||||||
|
IERC20TokenV06[] memory path,
|
||||||
|
uint256[] memory makerTokenAmounts
|
||||||
|
)
|
||||||
|
public
|
||||||
|
returns (
|
||||||
|
bytes[] memory uniswapPaths,
|
||||||
|
uint256[] memory takerTokenAmounts
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IUniswapV3Pool[][] memory poolPaths =
|
||||||
|
_getValidPoolPaths(quoter.factory(), path, 0);
|
||||||
|
IERC20TokenV06[] memory reversedPath = _reverseTokenPath(path);
|
||||||
|
|
||||||
|
takerTokenAmounts = new uint256[](makerTokenAmounts.length);
|
||||||
|
uniswapPaths = new bytes[](makerTokenAmounts.length);
|
||||||
|
|
||||||
|
for (uint256 i = 0; i < makerTokenAmounts.length; ++i) {
|
||||||
|
// Pick the best result from all the paths.
|
||||||
|
bytes memory topUniswapPath;
|
||||||
|
uint256 topSellAmount = 0;
|
||||||
|
for (uint256 j = 0; j < poolPaths.length; ++j) {
|
||||||
|
// quoter requires path to be reversed for buys.
|
||||||
|
bytes memory uniswapPath = _toUniswapPath(
|
||||||
|
reversedPath,
|
||||||
|
_reversePoolPath(poolPaths[j])
|
||||||
|
);
|
||||||
|
try
|
||||||
|
quoter.quoteExactOutput
|
||||||
|
{ gas: QUOTE_GAS }
|
||||||
|
(uniswapPath, makerTokenAmounts[i])
|
||||||
|
returns (uint256 sellAmount)
|
||||||
|
{
|
||||||
|
if (topSellAmount == 0 || topSellAmount >= sellAmount) {
|
||||||
|
topSellAmount = sellAmount;
|
||||||
|
// But the output path should still be encoded for sells.
|
||||||
|
topUniswapPath = _toUniswapPath(path, poolPaths[j]);
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
// Break early if we can't complete the buys.
|
||||||
|
if (topSellAmount == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
takerTokenAmounts[i] = topSellAmount;
|
||||||
|
uniswapPaths[i] = topUniswapPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _getValidPoolPaths(
|
||||||
|
IUniswapV3Factory factory,
|
||||||
|
IERC20TokenV06[] memory tokenPath,
|
||||||
|
uint256 startIndex
|
||||||
|
)
|
||||||
|
private
|
||||||
|
view
|
||||||
|
returns (IUniswapV3Pool[][] memory poolPaths)
|
||||||
|
{
|
||||||
|
require(
|
||||||
|
tokenPath.length - startIndex >= 2,
|
||||||
|
"UniswapV3Sampler/tokenPath too short"
|
||||||
|
);
|
||||||
|
uint24[3] memory validPoolFees = [
|
||||||
|
// The launch pool fees. Could get hairier if they add more.
|
||||||
|
uint24(0.0005e6),
|
||||||
|
uint24(0.003e6),
|
||||||
|
uint24(0.01e6)
|
||||||
|
];
|
||||||
|
IUniswapV3Pool[] memory validPools =
|
||||||
|
new IUniswapV3Pool[](validPoolFees.length);
|
||||||
|
uint256 numValidPools = 0;
|
||||||
|
{
|
||||||
|
IERC20TokenV06 inputToken = tokenPath[startIndex];
|
||||||
|
IERC20TokenV06 outputToken = tokenPath[startIndex + 1];
|
||||||
|
for (uint256 i = 0; i < validPoolFees.length; ++i) {
|
||||||
|
IUniswapV3Pool pool =
|
||||||
|
factory.getPool(inputToken, outputToken, validPoolFees[i]);
|
||||||
|
if (_isValidPool(pool)) {
|
||||||
|
validPools[numValidPools++] = pool;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (numValidPools == 0) {
|
||||||
|
// No valid pools for this hop.
|
||||||
|
return poolPaths;
|
||||||
|
}
|
||||||
|
if (startIndex + 2 == tokenPath.length) {
|
||||||
|
// End of path.
|
||||||
|
poolPaths = new IUniswapV3Pool[][](numValidPools);
|
||||||
|
for (uint256 i = 0; i < numValidPools; ++i) {
|
||||||
|
poolPaths[i] = new IUniswapV3Pool[](1);
|
||||||
|
poolPaths[i][0] = validPools[i];
|
||||||
|
}
|
||||||
|
return poolPaths;
|
||||||
|
}
|
||||||
|
// Get paths for subsequent hops.
|
||||||
|
IUniswapV3Pool[][] memory subsequentPoolPaths =
|
||||||
|
_getValidPoolPaths(factory, tokenPath, startIndex + 1);
|
||||||
|
if (subsequentPoolPaths.length == 0) {
|
||||||
|
// Could not complete the path.
|
||||||
|
return poolPaths;
|
||||||
|
}
|
||||||
|
// Combine our pools with the next hop paths.
|
||||||
|
poolPaths = new IUniswapV3Pool[][](
|
||||||
|
numValidPools * subsequentPoolPaths.length
|
||||||
|
);
|
||||||
|
for (uint256 i = 0; i < numValidPools; ++i) {
|
||||||
|
for (uint256 j = 0; j < subsequentPoolPaths.length; ++j) {
|
||||||
|
uint256 o = i * subsequentPoolPaths.length + j;
|
||||||
|
// Prepend pool to the subsequent path.
|
||||||
|
poolPaths[o] =
|
||||||
|
new IUniswapV3Pool[](1 + subsequentPoolPaths[j].length);
|
||||||
|
poolPaths[o][0] = validPools[i];
|
||||||
|
for (uint256 k = 0; k < subsequentPoolPaths[j].length; ++k) {
|
||||||
|
poolPaths[o][1 + k] = subsequentPoolPaths[j][k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return poolPaths;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _reverseTokenPath(IERC20TokenV06[] memory tokenPath)
|
||||||
|
private
|
||||||
|
returns (IERC20TokenV06[] memory reversed)
|
||||||
|
{
|
||||||
|
reversed = new IERC20TokenV06[](tokenPath.length);
|
||||||
|
for (uint256 i = 0; i < tokenPath.length; ++i) {
|
||||||
|
reversed[i] = tokenPath[tokenPath.length - i - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _reversePoolPath(IUniswapV3Pool[] memory poolPath)
|
||||||
|
private
|
||||||
|
returns (IUniswapV3Pool[] memory reversed)
|
||||||
|
{
|
||||||
|
reversed = new IUniswapV3Pool[](poolPath.length);
|
||||||
|
for (uint256 i = 0; i < poolPath.length; ++i) {
|
||||||
|
reversed[i] = poolPath[poolPath.length - i - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _isValidPool(IUniswapV3Pool pool)
|
||||||
|
private
|
||||||
|
view
|
||||||
|
returns (bool isValid)
|
||||||
|
{
|
||||||
|
// Check if it has been deployed.
|
||||||
|
{
|
||||||
|
uint256 codeSize;
|
||||||
|
assembly {
|
||||||
|
codeSize := extcodesize(pool)
|
||||||
|
}
|
||||||
|
if (codeSize == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Must have a balance of both tokens.
|
||||||
|
if (pool.token0().balanceOf(address(pool)) == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (pool.token1().balanceOf(address(pool)) == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _toUniswapPath(
|
||||||
|
IERC20TokenV06[] memory tokenPath,
|
||||||
|
IUniswapV3Pool[] memory poolPath
|
||||||
|
)
|
||||||
|
private
|
||||||
|
view
|
||||||
|
returns (bytes memory uniswapPath)
|
||||||
|
{
|
||||||
|
require(
|
||||||
|
tokenPath.length >= 2 && tokenPath.length == poolPath.length + 1,
|
||||||
|
"UniswapV3Sampler/invalid path lengths"
|
||||||
|
);
|
||||||
|
// Uniswap paths are tightly packed as:
|
||||||
|
// [token0, token0token1PairFee, token1, token1Token2PairFee, token2, ...]
|
||||||
|
uniswapPath = new bytes(tokenPath.length * 20 + poolPath.length * 3);
|
||||||
|
uint256 o;
|
||||||
|
assembly { o := add(uniswapPath, 32) }
|
||||||
|
for (uint256 i = 0; i < tokenPath.length; ++i) {
|
||||||
|
if (i > 0) {
|
||||||
|
uint24 poolFee = poolPath[i - 1].fee();
|
||||||
|
assembly {
|
||||||
|
mstore(o, shl(232, poolFee))
|
||||||
|
o := add(o, 3)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IERC20TokenV06 token = tokenPath[i];
|
||||||
|
assembly {
|
||||||
|
mstore(o, shl(96, token))
|
||||||
|
o := add(o, 20)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -29,5 +29,5 @@ interface IMStable {
|
|||||||
)
|
)
|
||||||
external
|
external
|
||||||
view
|
view
|
||||||
returns (bool, string memory, uint256 output);
|
returns (uint256 swapOutput);
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/asset-swapper",
|
"name": "@0x/asset-swapper",
|
||||||
"version": "6.8.0",
|
"version": "6.17.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -33,12 +33,13 @@
|
|||||||
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
|
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
|
||||||
"contracts:gen": "contracts-gen generate",
|
"contracts:gen": "contracts-gen generate",
|
||||||
"contracts:copy": "contracts-gen copy",
|
"contracts:copy": "contracts-gen copy",
|
||||||
"publish:private": "yarn build && gitpkg publish"
|
"publish:private": "yarn build && gitpkg publish",
|
||||||
|
"sampler-size": "jq .compilerOutput.evm.deployedBytecode.object -- test/generated-artifacts/ERC20BridgeSampler.json | echo $(( $(wc -c) / 2 - 1 ))"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"publicInterfaceContracts": "ERC20BridgeSampler,BalanceChecker,FakeTaker",
|
"publicInterfaceContracts": "ERC20BridgeSampler,BalanceChecker,FakeTaker",
|
||||||
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
|
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
|
||||||
"abis": "./test/generated-artifacts/@(ApproximateBuys|BalanceChecker|BalancerSampler|BancorSampler|CurveSampler|DODOSampler|DODOV2Sampler|DummyLiquidityProvider|ERC20BridgeSampler|Eth2DaiSampler|FakeTaker|IBalancer|IBancor|ICurve|IEth2Dai|IKyberNetwork|IMStable|IMooniswap|IMultiBridge|IShell|ISmoothy|IUniswapExchangeQuotes|IUniswapV2Router01|KyberSampler|LiquidityProviderSampler|MStableSampler|MakerPSMSampler|MooniswapSampler|MultiBridgeSampler|NativeOrderSampler|SamplerUtils|ShellSampler|SmoothySampler|TestERC20BridgeSampler|TestNativeOrderSampler|TwoHopSampler|UniswapSampler|UniswapV2Sampler|UtilitySampler).json",
|
"abis": "./test/generated-artifacts/@(ApproximateBuys|BalanceChecker|BalancerSampler|BalancerV2Sampler|BancorSampler|CurveSampler|DODOSampler|DODOV2Sampler|DummyLiquidityProvider|ERC20BridgeSampler|Eth2DaiSampler|FakeTaker|IBalancer|IBancor|ICurve|IEth2Dai|IKyberNetwork|IMStable|IMooniswap|IMultiBridge|IShell|ISmoothy|IUniswapExchangeQuotes|IUniswapV2Router01|KyberDmmSampler|KyberSampler|LiquidityProviderSampler|MStableSampler|MakerPSMSampler|MooniswapSampler|MultiBridgeSampler|NativeOrderSampler|SamplerUtils|ShellSampler|SmoothySampler|TestERC20BridgeSampler|TestNativeOrderSampler|TwoHopSampler|UniswapSampler|UniswapV2Sampler|UniswapV3Sampler|UtilitySampler).json",
|
||||||
"postpublish": {
|
"postpublish": {
|
||||||
"assets": []
|
"assets": []
|
||||||
}
|
}
|
||||||
@@ -57,20 +58,20 @@
|
|||||||
"registry": "git@github.com:0xProject/gitpkg-registry.git"
|
"registry": "git@github.com:0xProject/gitpkg-registry.git"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/assert": "^3.0.26",
|
"@0x/assert": "^3.0.27",
|
||||||
"@0x/base-contract": "^6.4.0",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/contract-addresses": "^6.0.0",
|
"@0x/contract-addresses": "^6.3.0",
|
||||||
"@0x/contract-wrappers": "^13.16.0",
|
"@0x/contract-wrappers": "^13.16.3",
|
||||||
"@0x/contracts-erc20": "^3.3.7",
|
"@0x/contracts-erc20": "^3.3.10",
|
||||||
"@0x/contracts-zero-ex": "^0.22.1",
|
"@0x/contracts-zero-ex": "^0.24.1",
|
||||||
"@0x/dev-utils": "^4.2.6",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/json-schemas": "^6.1.2",
|
"@0x/json-schemas": "^6.1.3",
|
||||||
"@0x/protocol-utils": "^1.5.1",
|
"@0x/protocol-utils": "^1.6.2",
|
||||||
"@0x/quote-server": "^5.0.0",
|
"@0x/quote-server": "^6.0.2",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
"@0x/utils": "^6.4.2",
|
"@0x/utils": "^6.4.3",
|
||||||
"@0x/web3-wrapper": "^7.5.2",
|
"@0x/web3-wrapper": "^7.5.3",
|
||||||
"@balancer-labs/sor": "0.3.2",
|
"@balancer-labs/sor": "0.3.2",
|
||||||
"@bancor/sdk": "0.2.9",
|
"@bancor/sdk": "0.2.9",
|
||||||
"@ethersproject/abi": "^5.0.1",
|
"@ethersproject/abi": "^5.0.1",
|
||||||
@@ -85,21 +86,23 @@
|
|||||||
"ethereum-types": "^3.5.0",
|
"ethereum-types": "^3.5.0",
|
||||||
"ethereumjs-util": "^7.0.10",
|
"ethereumjs-util": "^7.0.10",
|
||||||
"fast-abi": "^0.0.2",
|
"fast-abi": "^0.0.2",
|
||||||
|
"graphql": "^15.4.0",
|
||||||
|
"graphql-request": "^3.4.0",
|
||||||
"heartbeats": "^5.0.1",
|
"heartbeats": "^5.0.1",
|
||||||
"lodash": "^4.17.11"
|
"lodash": "^4.17.11"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.6.0",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contracts-asset-proxy": "^3.7.10",
|
"@0x/contracts-asset-proxy": "^3.7.13",
|
||||||
"@0x/contracts-exchange": "^3.2.29",
|
"@0x/contracts-exchange": "^3.2.32",
|
||||||
"@0x/contracts-exchange-libs": "^4.3.28",
|
"@0x/contracts-exchange-libs": "^4.3.31",
|
||||||
"@0x/contracts-gen": "^2.0.37",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-test-utils": "^5.3.25",
|
"@0x/contracts-test-utils": "^5.4.2",
|
||||||
"@0x/contracts-utils": "^4.7.7",
|
"@0x/contracts-utils": "^4.7.10",
|
||||||
"@0x/mesh-rpc-client": "^9.4.2",
|
"@0x/mesh-rpc-client": "^9.4.2",
|
||||||
"@0x/migrations": "^8.0.3",
|
"@0x/migrations": "^8.0.8",
|
||||||
"@0x/sol-compiler": "^4.7.2",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/subproviders": "^6.5.2",
|
"@0x/subproviders": "^6.5.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
|
@@ -5,7 +5,12 @@ export {
|
|||||||
SendTransactionOpts,
|
SendTransactionOpts,
|
||||||
} from '@0x/base-contract';
|
} from '@0x/base-contract';
|
||||||
export { ContractAddresses } from '@0x/contract-addresses';
|
export { ContractAddresses } from '@0x/contract-addresses';
|
||||||
export { V4RFQFirmQuote, V4RFQIndicativeQuote, V4SignedRfqOrder, TakerRequestQueryParams } from '@0x/quote-server';
|
export {
|
||||||
|
V4RFQFirmQuote,
|
||||||
|
V4RFQIndicativeQuote,
|
||||||
|
V4SignedRfqOrder,
|
||||||
|
TakerRequestQueryParamsUnnested as TakerRequestQueryParams,
|
||||||
|
} from '@0x/quote-server';
|
||||||
export { Asset, AssetPairsItem, DecodedLogEvent, EventCallback, IndexedFilterValues } from '@0x/types';
|
export { Asset, AssetPairsItem, DecodedLogEvent, EventCallback, IndexedFilterValues } from '@0x/types';
|
||||||
export { BigNumber } from '@0x/utils';
|
export { BigNumber } from '@0x/utils';
|
||||||
export {
|
export {
|
||||||
@@ -115,6 +120,7 @@ export {
|
|||||||
SOURCE_FLAGS,
|
SOURCE_FLAGS,
|
||||||
BUY_SOURCE_FILTER_BY_CHAIN_ID,
|
BUY_SOURCE_FILTER_BY_CHAIN_ID,
|
||||||
SELL_SOURCE_FILTER_BY_CHAIN_ID,
|
SELL_SOURCE_FILTER_BY_CHAIN_ID,
|
||||||
|
NATIVE_FEE_TOKEN_BY_CHAIN_ID,
|
||||||
} from './utils/market_operation_utils/constants';
|
} from './utils/market_operation_utils/constants';
|
||||||
export {
|
export {
|
||||||
Parameters,
|
Parameters,
|
||||||
@@ -160,6 +166,7 @@ export {
|
|||||||
NativeRfqOrderQuoteReportEntry,
|
NativeRfqOrderQuoteReportEntry,
|
||||||
QuoteReport,
|
QuoteReport,
|
||||||
QuoteReportEntry,
|
QuoteReportEntry,
|
||||||
|
PriceComparisonsReport,
|
||||||
} from './utils/quote_report_generator';
|
} from './utils/quote_report_generator';
|
||||||
export { QuoteRequestor } from './utils/quote_requestor';
|
export { QuoteRequestor } from './utils/quote_requestor';
|
||||||
export { ERC20BridgeSamplerContract, BalanceCheckerContract, FakeTakerContract } from './wrappers';
|
export { ERC20BridgeSamplerContract, BalanceCheckerContract, FakeTakerContract } from './wrappers';
|
||||||
|
@@ -13,8 +13,7 @@ import {
|
|||||||
FillQuoteTransformerSide,
|
FillQuoteTransformerSide,
|
||||||
findTransformerNonce,
|
findTransformerNonce,
|
||||||
} from '@0x/protocol-utils';
|
} from '@0x/protocol-utils';
|
||||||
import { BigNumber, providerUtils } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { SupportedProvider, ZeroExProvider } from '@0x/web3-wrapper';
|
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { constants, POSITIVE_SLIPPAGE_FEE_TRANSFORMER_GAS } from '../constants';
|
import { constants, POSITIVE_SLIPPAGE_FEE_TRANSFORMER_GAS } from '../constants';
|
||||||
@@ -65,15 +64,26 @@ import {
|
|||||||
// tslint:disable-next-line:custom-no-magic-numbers
|
// tslint:disable-next-line:custom-no-magic-numbers
|
||||||
const MAX_UINT256 = new BigNumber(2).pow(256).minus(1);
|
const MAX_UINT256 = new BigNumber(2).pow(256).minus(1);
|
||||||
const { NULL_ADDRESS, NULL_BYTES, ZERO_AMOUNT } = constants;
|
const { NULL_ADDRESS, NULL_BYTES, ZERO_AMOUNT } = constants;
|
||||||
const PANCAKE_SWAP_FORKS = [ERC20BridgeSource.PancakeSwap, ERC20BridgeSource.BakerySwap, ERC20BridgeSource.SushiSwap];
|
|
||||||
const DUMMY_WETH_CONTRACT = new WETH9Contract(NULL_ADDRESS, {
|
// use the same order in IPancakeSwapFeature.sol
|
||||||
|
const PANCAKE_SWAP_FORKS = [
|
||||||
|
ERC20BridgeSource.PancakeSwap,
|
||||||
|
ERC20BridgeSource.PancakeSwapV2,
|
||||||
|
ERC20BridgeSource.BakerySwap,
|
||||||
|
ERC20BridgeSource.SushiSwap,
|
||||||
|
ERC20BridgeSource.ApeSwap,
|
||||||
|
ERC20BridgeSource.CafeSwap,
|
||||||
|
ERC20BridgeSource.CheeseSwap,
|
||||||
|
ERC20BridgeSource.JulSwap,
|
||||||
|
];
|
||||||
|
const FAKE_PROVIDER: any = {
|
||||||
sendAsync(): void {
|
sendAsync(): void {
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
} as any);
|
};
|
||||||
|
const DUMMY_WETH_CONTRACT = new WETH9Contract(NULL_ADDRESS, FAKE_PROVIDER);
|
||||||
|
|
||||||
export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
||||||
public readonly provider: ZeroExProvider;
|
|
||||||
public readonly chainId: ChainId;
|
public readonly chainId: ChainId;
|
||||||
public readonly transformerNonces: {
|
public readonly transformerNonces: {
|
||||||
wethTransformer: number;
|
wethTransformer: number;
|
||||||
@@ -86,19 +96,13 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
|||||||
private readonly _exchangeProxy: IZeroExContract;
|
private readonly _exchangeProxy: IZeroExContract;
|
||||||
private readonly _multiplex: MultiplexFeatureContract;
|
private readonly _multiplex: MultiplexFeatureContract;
|
||||||
|
|
||||||
constructor(
|
constructor(public readonly contractAddresses: ContractAddresses, options: Partial<SwapQuoteConsumerOpts> = {}) {
|
||||||
supportedProvider: SupportedProvider,
|
|
||||||
public readonly contractAddresses: ContractAddresses,
|
|
||||||
options: Partial<SwapQuoteConsumerOpts> = {},
|
|
||||||
) {
|
|
||||||
const { chainId } = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options);
|
const { chainId } = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options);
|
||||||
assert.isNumber('chainId', chainId);
|
assert.isNumber('chainId', chainId);
|
||||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
|
||||||
this.provider = provider;
|
|
||||||
this.chainId = chainId;
|
this.chainId = chainId;
|
||||||
this.contractAddresses = contractAddresses;
|
this.contractAddresses = contractAddresses;
|
||||||
this._exchangeProxy = new IZeroExContract(contractAddresses.exchangeProxy, supportedProvider);
|
this._exchangeProxy = new IZeroExContract(contractAddresses.exchangeProxy, FAKE_PROVIDER);
|
||||||
this._multiplex = new MultiplexFeatureContract(contractAddresses.exchangeProxy, supportedProvider);
|
this._multiplex = new MultiplexFeatureContract(contractAddresses.exchangeProxy, FAKE_PROVIDER);
|
||||||
this.transformerNonces = {
|
this.transformerNonces = {
|
||||||
wethTransformer: findTransformerNonce(
|
wethTransformer: findTransformerNonce(
|
||||||
contractAddresses.transformers.wethTransformer,
|
contractAddresses.transformers.wethTransformer,
|
||||||
@@ -186,8 +190,13 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
|||||||
this.chainId === ChainId.BSC &&
|
this.chainId === ChainId.BSC &&
|
||||||
isDirectSwapCompatible(quote, optsWithDefaults, [
|
isDirectSwapCompatible(quote, optsWithDefaults, [
|
||||||
ERC20BridgeSource.PancakeSwap,
|
ERC20BridgeSource.PancakeSwap,
|
||||||
|
ERC20BridgeSource.PancakeSwapV2,
|
||||||
ERC20BridgeSource.BakerySwap,
|
ERC20BridgeSource.BakerySwap,
|
||||||
ERC20BridgeSource.SushiSwap,
|
ERC20BridgeSource.SushiSwap,
|
||||||
|
ERC20BridgeSource.ApeSwap,
|
||||||
|
ERC20BridgeSource.CafeSwap,
|
||||||
|
ERC20BridgeSource.CheeseSwap,
|
||||||
|
ERC20BridgeSource.JulSwap,
|
||||||
])
|
])
|
||||||
) {
|
) {
|
||||||
const source = slippedOrders[0].source;
|
const source = slippedOrders[0].source;
|
||||||
@@ -217,7 +226,7 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.chainId === ChainId.Mainnet &&
|
[ChainId.Mainnet, ChainId.BSC].includes(this.chainId) &&
|
||||||
isDirectSwapCompatible(quote, optsWithDefaults, [ERC20BridgeSource.LiquidityProvider])
|
isDirectSwapCompatible(quote, optsWithDefaults, [ERC20BridgeSource.LiquidityProvider])
|
||||||
) {
|
) {
|
||||||
const fillData = (slippedOrders[0] as OptimizedMarketBridgeOrder<LiquidityProviderFillData>).fillData;
|
const fillData = (slippedOrders[0] as OptimizedMarketBridgeOrder<LiquidityProviderFillData>).fillData;
|
||||||
@@ -243,7 +252,11 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
this.chainId === ChainId.Mainnet &&
|
this.chainId === ChainId.Mainnet &&
|
||||||
isDirectSwapCompatible(quote, optsWithDefaults, [ERC20BridgeSource.Curve, ERC20BridgeSource.Swerve])
|
isDirectSwapCompatible(quote, optsWithDefaults, [ERC20BridgeSource.Curve, ERC20BridgeSource.Swerve]) &&
|
||||||
|
// Curve VIP cannot currently support WETH buy/sell as the functionality needs to WITHDRAW or DEPOSIT
|
||||||
|
// into WETH prior/post the trade.
|
||||||
|
// ETH buy/sell is supported
|
||||||
|
![sellToken, buyToken].includes(NATIVE_FEE_TOKEN_BY_CHAIN_ID[ChainId.Mainnet])
|
||||||
) {
|
) {
|
||||||
const fillData = slippedOrders[0].fills[0].fillData as CurveFillData;
|
const fillData = slippedOrders[0].fills[0].fillData as CurveFillData;
|
||||||
return {
|
return {
|
||||||
@@ -552,14 +565,17 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
|||||||
|
|
||||||
private _encodeMultiplexMultiHopFillCalldata(quote: SwapQuote, opts: ExchangeProxyContractOpts): string {
|
private _encodeMultiplexMultiHopFillCalldata(quote: SwapQuote, opts: ExchangeProxyContractOpts): string {
|
||||||
const wrappedMultiHopCalls = [];
|
const wrappedMultiHopCalls = [];
|
||||||
|
const tokens: string[] = [];
|
||||||
if (opts.isFromETH) {
|
if (opts.isFromETH) {
|
||||||
wrappedMultiHopCalls.push({
|
wrappedMultiHopCalls.push({
|
||||||
selector: DUMMY_WETH_CONTRACT.getSelector('deposit'),
|
selector: DUMMY_WETH_CONTRACT.getSelector('deposit'),
|
||||||
data: NULL_BYTES,
|
data: NULL_BYTES,
|
||||||
});
|
});
|
||||||
|
tokens.push(ETH_TOKEN_ADDRESS);
|
||||||
}
|
}
|
||||||
const [firstHopOrder, secondHopOrder] = quote.orders;
|
const [firstHopOrder, secondHopOrder] = quote.orders;
|
||||||
const intermediateToken = firstHopOrder.makerToken;
|
const intermediateToken = firstHopOrder.makerToken;
|
||||||
|
tokens.push(quote.takerToken, intermediateToken, quote.makerToken);
|
||||||
for (const order of [firstHopOrder, secondHopOrder]) {
|
for (const order of [firstHopOrder, secondHopOrder]) {
|
||||||
switch (order.source) {
|
switch (order.source) {
|
||||||
case ERC20BridgeSource.UniswapV2:
|
case ERC20BridgeSource.UniswapV2:
|
||||||
@@ -594,11 +610,12 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
|||||||
selector: DUMMY_WETH_CONTRACT.getSelector('withdraw'),
|
selector: DUMMY_WETH_CONTRACT.getSelector('withdraw'),
|
||||||
data: NULL_BYTES,
|
data: NULL_BYTES,
|
||||||
});
|
});
|
||||||
|
tokens.push(ETH_TOKEN_ADDRESS);
|
||||||
}
|
}
|
||||||
return this._exchangeProxy
|
return this._exchangeProxy
|
||||||
.multiHopFill(
|
.multiHopFill(
|
||||||
{
|
{
|
||||||
tokens: [quote.takerToken, intermediateToken, quote.makerToken],
|
tokens,
|
||||||
sellAmount: quote.worstCaseQuoteInfo.totalTakerAmount,
|
sellAmount: quote.worstCaseQuoteInfo.totalTakerAmount,
|
||||||
calls: wrappedMultiHopCalls,
|
calls: wrappedMultiHopCalls,
|
||||||
},
|
},
|
||||||
|
@@ -1,6 +1,4 @@
|
|||||||
import { ContractAddresses, getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
|
import { ContractAddresses, getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
|
||||||
import { providerUtils } from '@0x/utils';
|
|
||||||
import { SupportedProvider, ZeroExProvider } from '@0x/web3-wrapper';
|
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { constants } from '../constants';
|
import { constants } from '../constants';
|
||||||
@@ -17,32 +15,22 @@ import { assert } from '../utils/assert';
|
|||||||
import { ExchangeProxySwapQuoteConsumer } from './exchange_proxy_swap_quote_consumer';
|
import { ExchangeProxySwapQuoteConsumer } from './exchange_proxy_swap_quote_consumer';
|
||||||
|
|
||||||
export class SwapQuoteConsumer implements SwapQuoteConsumerBase {
|
export class SwapQuoteConsumer implements SwapQuoteConsumerBase {
|
||||||
public readonly provider: ZeroExProvider;
|
|
||||||
public readonly chainId: number;
|
public readonly chainId: number;
|
||||||
|
|
||||||
private readonly _contractAddresses: ContractAddresses;
|
private readonly _contractAddresses: ContractAddresses;
|
||||||
private readonly _exchangeProxyConsumer: ExchangeProxySwapQuoteConsumer;
|
private readonly _exchangeProxyConsumer: ExchangeProxySwapQuoteConsumer;
|
||||||
|
|
||||||
public static getSwapQuoteConsumer(
|
public static getSwapQuoteConsumer(options: Partial<SwapQuoteConsumerOpts> = {}): SwapQuoteConsumer {
|
||||||
supportedProvider: SupportedProvider,
|
return new SwapQuoteConsumer(options);
|
||||||
options: Partial<SwapQuoteConsumerOpts> = {},
|
|
||||||
): SwapQuoteConsumer {
|
|
||||||
return new SwapQuoteConsumer(supportedProvider, options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(supportedProvider: SupportedProvider, options: Partial<SwapQuoteConsumerOpts> = {}) {
|
constructor(options: Partial<SwapQuoteConsumerOpts> = {}) {
|
||||||
const { chainId } = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options);
|
const { chainId } = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options);
|
||||||
assert.isNumber('chainId', chainId);
|
assert.isNumber('chainId', chainId);
|
||||||
|
|
||||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
|
||||||
this.provider = provider;
|
|
||||||
this.chainId = chainId;
|
this.chainId = chainId;
|
||||||
this._contractAddresses = options.contractAddresses || getContractAddressesForChainOrThrow(chainId);
|
this._contractAddresses = options.contractAddresses || getContractAddressesForChainOrThrow(chainId);
|
||||||
this._exchangeProxyConsumer = new ExchangeProxySwapQuoteConsumer(
|
this._exchangeProxyConsumer = new ExchangeProxySwapQuoteConsumer(this._contractAddresses, options);
|
||||||
supportedProvider,
|
|
||||||
this._contractAddresses,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -27,7 +27,7 @@ import {
|
|||||||
import { assert } from './utils/assert';
|
import { assert } from './utils/assert';
|
||||||
import { MarketOperationUtils } from './utils/market_operation_utils';
|
import { MarketOperationUtils } from './utils/market_operation_utils';
|
||||||
import { BancorService } from './utils/market_operation_utils/bancor_service';
|
import { BancorService } from './utils/market_operation_utils/bancor_service';
|
||||||
import { SOURCE_FLAGS, ZERO_AMOUNT } from './utils/market_operation_utils/constants';
|
import { SAMPLER_ADDRESS, SOURCE_FLAGS, ZERO_AMOUNT } from './utils/market_operation_utils/constants';
|
||||||
import { DexOrderSampler } from './utils/market_operation_utils/sampler';
|
import { DexOrderSampler } from './utils/market_operation_utils/sampler';
|
||||||
import { SourceFilters } from './utils/market_operation_utils/source_filters';
|
import { SourceFilters } from './utils/market_operation_utils/source_filters';
|
||||||
import {
|
import {
|
||||||
@@ -93,7 +93,7 @@ export class SwapQuoter {
|
|||||||
rfqt,
|
rfqt,
|
||||||
tokenAdjacencyGraph,
|
tokenAdjacencyGraph,
|
||||||
liquidityProviderRegistry,
|
liquidityProviderRegistry,
|
||||||
} = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options);
|
} = { ...constants.DEFAULT_SWAP_QUOTER_OPTS, ...options };
|
||||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||||
assert.isValidOrderbook('orderbook', orderbook);
|
assert.isValidOrderbook('orderbook', orderbook);
|
||||||
assert.isNumber('chainId', chainId);
|
assert.isNumber('chainId', chainId);
|
||||||
@@ -114,18 +114,20 @@ export class SwapQuoter {
|
|||||||
);
|
);
|
||||||
// Allow the sampler bytecode to be overwritten using geths override functionality
|
// Allow the sampler bytecode to be overwritten using geths override functionality
|
||||||
const samplerBytecode = _.get(artifacts.ERC20BridgeSampler, 'compilerOutput.evm.deployedBytecode.object');
|
const samplerBytecode = _.get(artifacts.ERC20BridgeSampler, 'compilerOutput.evm.deployedBytecode.object');
|
||||||
|
// Allow address of the Sampler to be overridden, i.e in Ganache where overrides do not work
|
||||||
|
const samplerAddress = (options.samplerOverrides && options.samplerOverrides.to) || SAMPLER_ADDRESS;
|
||||||
const defaultCodeOverrides = samplerBytecode
|
const defaultCodeOverrides = samplerBytecode
|
||||||
? {
|
? {
|
||||||
[this._contractAddresses.erc20BridgeSampler]: { code: samplerBytecode },
|
[samplerAddress]: { code: samplerBytecode },
|
||||||
}
|
}
|
||||||
: {};
|
: {};
|
||||||
const samplerOverrides = _.assign(
|
const samplerOverrides = _.assign(
|
||||||
{ block: BlockParamLiteral.Latest, overrides: defaultCodeOverrides },
|
{ block: BlockParamLiteral.Latest, overrides: defaultCodeOverrides },
|
||||||
options.samplerOverrides,
|
options.samplerOverrides,
|
||||||
);
|
);
|
||||||
const fastAbi = new FastABI(ERC20BridgeSamplerContract.ABI() as MethodAbi[]);
|
const fastAbi = new FastABI(ERC20BridgeSamplerContract.ABI() as MethodAbi[], { BigNumber });
|
||||||
const samplerContract = new ERC20BridgeSamplerContract(
|
const samplerContract = new ERC20BridgeSamplerContract(
|
||||||
this._contractAddresses.erc20BridgeSampler,
|
samplerAddress,
|
||||||
this.provider,
|
this.provider,
|
||||||
{
|
{
|
||||||
gas: samplerGasLimit,
|
gas: samplerGasLimit,
|
||||||
@@ -143,8 +145,7 @@ export class SwapQuoter {
|
|||||||
this.chainId,
|
this.chainId,
|
||||||
samplerContract,
|
samplerContract,
|
||||||
samplerOverrides,
|
samplerOverrides,
|
||||||
undefined, // balancer pool cache
|
undefined, // pools caches for balancer and cream
|
||||||
undefined, // cream pool cache
|
|
||||||
tokenAdjacencyGraph,
|
tokenAdjacencyGraph,
|
||||||
liquidityProviderRegistry,
|
liquidityProviderRegistry,
|
||||||
this.chainId === ChainId.Mainnet // Enable Bancor only on Mainnet
|
this.chainId === ChainId.Mainnet // Enable Bancor only on Mainnet
|
||||||
@@ -496,7 +497,14 @@ function createSwapQuote(
|
|||||||
gasSchedule: FeeSchedule,
|
gasSchedule: FeeSchedule,
|
||||||
slippage: number,
|
slippage: number,
|
||||||
): SwapQuote {
|
): SwapQuote {
|
||||||
const { optimizedOrders, quoteReport, sourceFlags, takerAmountPerEth, makerAmountPerEth } = optimizerResult;
|
const {
|
||||||
|
optimizedOrders,
|
||||||
|
quoteReport,
|
||||||
|
sourceFlags,
|
||||||
|
takerAmountPerEth,
|
||||||
|
makerAmountPerEth,
|
||||||
|
priceComparisonsReport,
|
||||||
|
} = optimizerResult;
|
||||||
const isTwoHop = sourceFlags === SOURCE_FLAGS[ERC20BridgeSource.MultiHop];
|
const isTwoHop = sourceFlags === SOURCE_FLAGS[ERC20BridgeSource.MultiHop];
|
||||||
|
|
||||||
// Calculate quote info
|
// Calculate quote info
|
||||||
@@ -520,6 +528,7 @@ function createSwapQuote(
|
|||||||
makerAmountPerEth,
|
makerAmountPerEth,
|
||||||
quoteReport,
|
quoteReport,
|
||||||
isTwoHop,
|
isTwoHop,
|
||||||
|
priceComparisonsReport,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (operation === MarketOperation.Buy) {
|
if (operation === MarketOperation.Buy) {
|
||||||
|
@@ -7,7 +7,8 @@ import {
|
|||||||
RfqOrderFields,
|
RfqOrderFields,
|
||||||
Signature,
|
Signature,
|
||||||
} from '@0x/protocol-utils';
|
} from '@0x/protocol-utils';
|
||||||
import { TakerRequestQueryParams, V4SignedRfqOrder } from '@0x/quote-server';
|
import { TakerRequestQueryParamsUnnested, V4SignedRfqOrder } from '@0x/quote-server';
|
||||||
|
import { Fee } from '@0x/quote-server/lib/src/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { AxiosRequestConfig } from 'axios';
|
import { AxiosRequestConfig } from 'axios';
|
||||||
|
|
||||||
@@ -18,7 +19,7 @@ import {
|
|||||||
OptimizedMarketOrder,
|
OptimizedMarketOrder,
|
||||||
TokenAdjacencyGraph,
|
TokenAdjacencyGraph,
|
||||||
} from './utils/market_operation_utils/types';
|
} from './utils/market_operation_utils/types';
|
||||||
import { QuoteReport } from './utils/quote_report_generator';
|
import { PriceComparisonsReport, QuoteReport } from './utils/quote_report_generator';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* expiryBufferMs: The number of seconds to add when calculating whether an order is expired or not. Defaults to 300s (5m).
|
* expiryBufferMs: The number of seconds to add when calculating whether an order is expired or not. Defaults to 300s (5m).
|
||||||
@@ -169,6 +170,7 @@ export interface SwapQuoteBase {
|
|||||||
worstCaseQuoteInfo: SwapQuoteInfo;
|
worstCaseQuoteInfo: SwapQuoteInfo;
|
||||||
sourceBreakdown: SwapQuoteOrdersBreakdown;
|
sourceBreakdown: SwapQuoteOrdersBreakdown;
|
||||||
quoteReport?: QuoteReport;
|
quoteReport?: QuoteReport;
|
||||||
|
priceComparisonsReport?: PriceComparisonsReport;
|
||||||
isTwoHop: boolean;
|
isTwoHop: boolean;
|
||||||
makerTokenDecimals: number;
|
makerTokenDecimals: number;
|
||||||
takerTokenDecimals: number;
|
takerTokenDecimals: number;
|
||||||
@@ -231,6 +233,12 @@ export type SwapQuoteOrdersBreakdown = Partial<
|
|||||||
* If set to `true` and `ERC20BridgeSource.Native` is part of the `excludedSources`
|
* If set to `true` and `ERC20BridgeSource.Native` is part of the `excludedSources`
|
||||||
* array in `SwapQuoteRequestOpts`, an Error will be raised.
|
* array in `SwapQuoteRequestOpts`, an Error will be raised.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
export interface RfqmRequestOptions extends RfqRequestOpts {
|
||||||
|
isLastLook: true;
|
||||||
|
fee: Fee;
|
||||||
|
}
|
||||||
|
|
||||||
export interface RfqRequestOpts {
|
export interface RfqRequestOpts {
|
||||||
takerAddress: string;
|
takerAddress: string;
|
||||||
txOrigin: string;
|
txOrigin: string;
|
||||||
@@ -241,6 +249,7 @@ export interface RfqRequestOpts {
|
|||||||
nativeExclusivelyRFQ?: boolean;
|
nativeExclusivelyRFQ?: boolean;
|
||||||
altRfqAssetOfferings?: AltRfqMakerAssetOfferings;
|
altRfqAssetOfferings?: AltRfqMakerAssetOfferings;
|
||||||
isLastLook?: boolean;
|
isLastLook?: boolean;
|
||||||
|
fee?: Fee;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -365,7 +374,7 @@ export enum OrderPrunerPermittedFeeTypes {
|
|||||||
export interface MockedRfqQuoteResponse {
|
export interface MockedRfqQuoteResponse {
|
||||||
endpoint: string;
|
endpoint: string;
|
||||||
requestApiKey: string;
|
requestApiKey: string;
|
||||||
requestParams: TakerRequestQueryParams;
|
requestParams: TakerRequestQueryParamsUnnested;
|
||||||
responseData: any;
|
responseData: any;
|
||||||
responseCode: number;
|
responseCode: number;
|
||||||
callback?: (config: any) => Promise<any>;
|
callback?: (config: any) => Promise<any>;
|
||||||
@@ -385,6 +394,7 @@ export interface AltMockedRfqQuoteResponse {
|
|||||||
export interface SamplerOverrides {
|
export interface SamplerOverrides {
|
||||||
overrides: GethCallOverrides;
|
overrides: GethCallOverrides;
|
||||||
block: BlockParam;
|
block: BlockParam;
|
||||||
|
to?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SamplerCallResult {
|
export interface SamplerCallResult {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { Web3Wrapper } from '@0x/dev-utils';
|
import { Web3Wrapper } from '@0x/dev-utils';
|
||||||
import { TakerRequestQueryParams, V4RFQFirmQuote, V4RFQIndicativeQuote } from '@0x/quote-server';
|
import { TakerRequestQueryParamsUnnested, V4RFQFirmQuote, V4RFQIndicativeQuote } from '@0x/quote-server';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { AxiosInstance, CancelToken } from 'axios';
|
import { AxiosInstance, CancelToken } from 'axios';
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ export async function returnQuoteFromAltMMAsync<ResponseT>(
|
|||||||
takerToken: string,
|
takerToken: string,
|
||||||
maxResponseTimeMs: number,
|
maxResponseTimeMs: number,
|
||||||
altRfqAssetOfferings: AltRfqMakerAssetOfferings,
|
altRfqAssetOfferings: AltRfqMakerAssetOfferings,
|
||||||
takerRequestQueryParams: TakerRequestQueryParams,
|
takerRequestQueryParams: TakerRequestQueryParamsUnnested,
|
||||||
axiosInstance: AxiosInstance,
|
axiosInstance: AxiosInstance,
|
||||||
warningLogger: LogFunction,
|
warningLogger: LogFunction,
|
||||||
cancelToken: CancelToken,
|
cancelToken: CancelToken,
|
||||||
|
@@ -1,192 +0,0 @@
|
|||||||
import { getPoolsWithTokens, parsePoolData } from '@balancer-labs/sor';
|
|
||||||
import { Pool } from '@balancer-labs/sor/dist/types';
|
|
||||||
|
|
||||||
import { BALANCER_MAX_POOLS_FETCHED, BALANCER_SUBGRAPH_URL, BALANCER_TOP_POOLS_FETCHED } from './constants';
|
|
||||||
|
|
||||||
// tslint:disable:boolean-naming
|
|
||||||
|
|
||||||
interface CacheValue {
|
|
||||||
timestamp: number;
|
|
||||||
pools: Pool[];
|
|
||||||
}
|
|
||||||
|
|
||||||
// tslint:disable:custom-no-magic-numbers
|
|
||||||
const FIVE_SECONDS_MS = 5 * 1000;
|
|
||||||
const ONE_DAY_MS = 24 * 60 * 60 * 1000;
|
|
||||||
const DEFAULT_TIMEOUT_MS = 1000;
|
|
||||||
// tslint:enable:custom-no-magic-numbers
|
|
||||||
|
|
||||||
interface BalancerPoolResponse {
|
|
||||||
id: string;
|
|
||||||
swapFee: string;
|
|
||||||
tokens: Array<{ address: string; decimals: number; balance: string }>;
|
|
||||||
tokensList: string[];
|
|
||||||
totalWeight: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class BalancerPoolsCache {
|
|
||||||
constructor(
|
|
||||||
private readonly _cache: { [key: string]: CacheValue } = {},
|
|
||||||
private readonly maxPoolsFetched: number = BALANCER_MAX_POOLS_FETCHED,
|
|
||||||
private readonly subgraphUrl: string = BALANCER_SUBGRAPH_URL,
|
|
||||||
private readonly topPoolsFetched: number = BALANCER_TOP_POOLS_FETCHED,
|
|
||||||
) {
|
|
||||||
void this._loadTopPoolsAsync();
|
|
||||||
// Reload the top pools every 12 hours
|
|
||||||
setInterval(async () => void this._loadTopPoolsAsync(), ONE_DAY_MS / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async getPoolsForPairAsync(
|
|
||||||
takerToken: string,
|
|
||||||
makerToken: string,
|
|
||||||
timeoutMs: number = DEFAULT_TIMEOUT_MS,
|
|
||||||
): Promise<Pool[]> {
|
|
||||||
const timeout = new Promise<Pool[]>(resolve => setTimeout(resolve, timeoutMs, []));
|
|
||||||
return Promise.race([this._getPoolsForPairAsync(takerToken, makerToken), timeout]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public getCachedPoolAddressesForPair(
|
|
||||||
takerToken: string,
|
|
||||||
makerToken: string,
|
|
||||||
cacheExpiryMs?: number,
|
|
||||||
): string[] | undefined {
|
|
||||||
const key = JSON.stringify([takerToken, makerToken]);
|
|
||||||
const value = this._cache[key];
|
|
||||||
if (cacheExpiryMs === undefined) {
|
|
||||||
return value === undefined ? [] : value.pools.map(pool => pool.id);
|
|
||||||
}
|
|
||||||
const minTimestamp = Date.now() - cacheExpiryMs;
|
|
||||||
if (value === undefined || value.timestamp < minTimestamp) {
|
|
||||||
return undefined;
|
|
||||||
} else {
|
|
||||||
return value.pools.map(pool => pool.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public howToSampleBalancer(
|
|
||||||
takerToken: string,
|
|
||||||
makerToken: string,
|
|
||||||
isAllowedSource: boolean,
|
|
||||||
): { onChain: boolean; offChain: boolean } {
|
|
||||||
// If Balancer is excluded as a source, do not sample.
|
|
||||||
if (!isAllowedSource) {
|
|
||||||
return { onChain: false, offChain: false };
|
|
||||||
}
|
|
||||||
const cachedBalancerPools = this.getCachedPoolAddressesForPair(takerToken, makerToken, ONE_DAY_MS);
|
|
||||||
// Sample Balancer on-chain (i.e. via the ERC20BridgeSampler contract) if:
|
|
||||||
// - Cached values are not stale
|
|
||||||
// - There is at least one Balancer pool for this pair
|
|
||||||
const onChain = cachedBalancerPools !== undefined && cachedBalancerPools.length > 0;
|
|
||||||
// Sample Balancer off-chain (i.e. via GraphQL query + `computeBalancerBuy/SellQuote`)
|
|
||||||
// if cached values are stale
|
|
||||||
const offChain = cachedBalancerPools === undefined;
|
|
||||||
return { onChain, offChain };
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async _getPoolsForPairAsync(
|
|
||||||
takerToken: string,
|
|
||||||
makerToken: string,
|
|
||||||
cacheExpiryMs: number = FIVE_SECONDS_MS,
|
|
||||||
): Promise<Pool[]> {
|
|
||||||
const key = JSON.stringify([takerToken, makerToken]);
|
|
||||||
const value = this._cache[key];
|
|
||||||
const minTimestamp = Date.now() - cacheExpiryMs;
|
|
||||||
if (value === undefined || value.timestamp < minTimestamp) {
|
|
||||||
const pools = await this._fetchPoolsForPairAsync(takerToken, makerToken);
|
|
||||||
this._cachePoolsForPair(takerToken, makerToken, pools);
|
|
||||||
}
|
|
||||||
return this._cache[key].pools;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected _cachePoolsForPair(takerToken: string, makerToken: string, pools: Pool[]): void {
|
|
||||||
const key = JSON.stringify([takerToken, makerToken]);
|
|
||||||
this._cache[key] = {
|
|
||||||
pools,
|
|
||||||
timestamp: Date.now(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async _fetchPoolsForPairAsync(takerToken: string, makerToken: string): Promise<Pool[]> {
|
|
||||||
try {
|
|
||||||
const poolData = (await getPoolsWithTokens(takerToken, makerToken)).pools;
|
|
||||||
// Sort by maker token balance (descending)
|
|
||||||
const pools = parsePoolData(poolData, takerToken, makerToken).sort((a, b) =>
|
|
||||||
b.balanceOut.minus(a.balanceOut).toNumber(),
|
|
||||||
);
|
|
||||||
return pools.length > this.maxPoolsFetched ? pools.slice(0, this.maxPoolsFetched) : pools;
|
|
||||||
} catch (err) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async _loadTopPoolsAsync(): Promise<void> {
|
|
||||||
const fromToPools: {
|
|
||||||
[from: string]: { [to: string]: Pool[] };
|
|
||||||
} = {};
|
|
||||||
|
|
||||||
const pools = await this._fetchTopPoolsAsync();
|
|
||||||
pools.forEach(pool => {
|
|
||||||
const { tokensList } = pool;
|
|
||||||
for (const from of tokensList) {
|
|
||||||
for (const to of tokensList.filter(t => t.toLowerCase() !== from.toLowerCase())) {
|
|
||||||
if (!fromToPools[from]) {
|
|
||||||
fromToPools[from] = {};
|
|
||||||
}
|
|
||||||
if (!fromToPools[from][to]) {
|
|
||||||
fromToPools[from][to] = [];
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
// The list of pools must be relevant to `from` and `to` for `parsePoolData`
|
|
||||||
const poolData = parsePoolData([pool], from, to);
|
|
||||||
fromToPools[from][to].push(poolData[0]);
|
|
||||||
// Cache this as we progress through
|
|
||||||
this._cachePoolsForPair(from, to, fromToPools[from][to]);
|
|
||||||
} catch {
|
|
||||||
// soldier on
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async _fetchTopPoolsAsync(): Promise<BalancerPoolResponse[]> {
|
|
||||||
const query = `
|
|
||||||
query {
|
|
||||||
pools (first: ${
|
|
||||||
this.topPoolsFetched
|
|
||||||
}, where: {publicSwap: true, liquidity_gt: 0}, orderBy: swapsCount, orderDirection: desc) {
|
|
||||||
id
|
|
||||||
publicSwap
|
|
||||||
swapFee
|
|
||||||
totalWeight
|
|
||||||
tokensList
|
|
||||||
tokens {
|
|
||||||
id
|
|
||||||
address
|
|
||||||
balance
|
|
||||||
decimals
|
|
||||||
symbol
|
|
||||||
denormWeight
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
try {
|
|
||||||
const response = await fetch(this.subgraphUrl, {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
Accept: 'application/json',
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
query,
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
const { data } = await response.json();
|
|
||||||
return data.pools;
|
|
||||||
} catch (err) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -2,20 +2,29 @@ import { ChainId } from '@0x/contract-addresses';
|
|||||||
import { BigNumber, NULL_BYTES } from '@0x/utils';
|
import { BigNumber, NULL_BYTES } from '@0x/utils';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
APESWAP_ROUTER_BY_CHAIN_ID,
|
||||||
BAKERYSWAP_ROUTER_BY_CHAIN_ID,
|
BAKERYSWAP_ROUTER_BY_CHAIN_ID,
|
||||||
BELT_BSC_INFOS,
|
BELT_BSC_INFOS,
|
||||||
|
CAFESWAP_ROUTER_BY_CHAIN_ID,
|
||||||
|
CHEESESWAP_ROUTER_BY_CHAIN_ID,
|
||||||
|
COMETHSWAP_ROUTER_BY_CHAIN_ID,
|
||||||
COMPONENT_POOLS_BY_CHAIN_ID,
|
COMPONENT_POOLS_BY_CHAIN_ID,
|
||||||
CRYPTO_COM_ROUTER_BY_CHAIN_ID,
|
CRYPTO_COM_ROUTER_BY_CHAIN_ID,
|
||||||
CURVE_MAINNET_INFOS,
|
CURVE_MAINNET_INFOS,
|
||||||
|
CURVE_POLYGON_INFOS,
|
||||||
|
DFYN_ROUTER_BY_CHAIN_ID,
|
||||||
ELLIPSIS_BSC_INFOS,
|
ELLIPSIS_BSC_INFOS,
|
||||||
|
JULSWAP_ROUTER_BY_CHAIN_ID,
|
||||||
|
KYBER_BANNED_RESERVES,
|
||||||
KYBER_BRIDGED_LIQUIDITY_PREFIX,
|
KYBER_BRIDGED_LIQUIDITY_PREFIX,
|
||||||
KYBER_DMM_ROUTER_BY_CHAIN_ID,
|
|
||||||
MAX_DODOV2_POOLS_QUERIED,
|
MAX_DODOV2_POOLS_QUERIED,
|
||||||
MAX_KYBER_RESERVES_QUERIED,
|
MAX_KYBER_RESERVES_QUERIED,
|
||||||
|
MSTABLE_POOLS_BY_CHAIN_ID,
|
||||||
NERVE_BSC_INFOS,
|
NERVE_BSC_INFOS,
|
||||||
NULL_ADDRESS,
|
NULL_ADDRESS,
|
||||||
PANCAKESWAP_ROUTER_BY_CHAIN_ID,
|
PANCAKESWAP_ROUTER_BY_CHAIN_ID,
|
||||||
PANCAKESWAP_V2_ROUTER_BY_CHAIN_ID,
|
PANCAKESWAPV2_ROUTER_BY_CHAIN_ID,
|
||||||
|
QUICKSWAP_ROUTER_BY_CHAIN_ID,
|
||||||
SADDLE_MAINNET_INFOS,
|
SADDLE_MAINNET_INFOS,
|
||||||
SHELL_POOLS_BY_CHAIN_ID,
|
SHELL_POOLS_BY_CHAIN_ID,
|
||||||
SMOOTHY_BSC_INFOS,
|
SMOOTHY_BSC_INFOS,
|
||||||
@@ -24,6 +33,7 @@ import {
|
|||||||
SUSHISWAP_ROUTER_BY_CHAIN_ID,
|
SUSHISWAP_ROUTER_BY_CHAIN_ID,
|
||||||
SWERVE_MAINNET_INFOS,
|
SWERVE_MAINNET_INFOS,
|
||||||
UNISWAPV2_ROUTER_BY_CHAIN_ID,
|
UNISWAPV2_ROUTER_BY_CHAIN_ID,
|
||||||
|
XSIGMA_MAINNET_INFOS,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
import { CurveInfo, ERC20BridgeSource } from './types';
|
import { CurveInfo, ERC20BridgeSource } from './types';
|
||||||
|
|
||||||
@@ -32,7 +42,11 @@ import { CurveInfo, ERC20BridgeSource } from './types';
|
|||||||
* @param reserveId Kyber reserveId
|
* @param reserveId Kyber reserveId
|
||||||
*/
|
*/
|
||||||
export function isAllowedKyberReserveId(reserveId: string): boolean {
|
export function isAllowedKyberReserveId(reserveId: string): boolean {
|
||||||
return reserveId !== NULL_BYTES && !reserveId.startsWith(KYBER_BRIDGED_LIQUIDITY_PREFIX);
|
return (
|
||||||
|
reserveId !== NULL_BYTES &&
|
||||||
|
!reserveId.startsWith(KYBER_BRIDGED_LIQUIDITY_PREFIX) &&
|
||||||
|
!KYBER_BANNED_RESERVES.includes(reserveId)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// tslint:disable-next-line: completed-docs ban-types
|
// tslint:disable-next-line: completed-docs ban-types
|
||||||
@@ -77,17 +91,41 @@ export function getComponentForPair(chainId: ChainId, takerToken: string, makerT
|
|||||||
}
|
}
|
||||||
|
|
||||||
// tslint:disable completed-docs
|
// tslint:disable completed-docs
|
||||||
export function getCurveInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
|
export function getMStableForPair(chainId: ChainId, takerToken: string, makerToken: string): string[] {
|
||||||
if (chainId !== ChainId.Mainnet) {
|
if (chainId !== ChainId.Mainnet && chainId !== ChainId.Polygon) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return Object.values(CURVE_MAINNET_INFOS).filter(c =>
|
return Object.values(MSTABLE_POOLS_BY_CHAIN_ID[chainId])
|
||||||
[makerToken, takerToken].every(
|
.filter(c => [makerToken, takerToken].every(t => c.tokens.includes(t)))
|
||||||
t =>
|
.map(i => i.poolAddress);
|
||||||
(c.tokens.includes(t) && c.metaToken === undefined) ||
|
}
|
||||||
(c.tokens.includes(t) && c.metaToken !== undefined && [makerToken, takerToken].includes(c.metaToken)),
|
|
||||||
),
|
// tslint:disable completed-docs
|
||||||
);
|
export function getCurveInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
|
||||||
|
switch (chainId) {
|
||||||
|
case ChainId.Mainnet:
|
||||||
|
return Object.values(CURVE_MAINNET_INFOS).filter(c =>
|
||||||
|
[makerToken, takerToken].every(
|
||||||
|
t =>
|
||||||
|
(c.tokens.includes(t) && c.metaToken === undefined) ||
|
||||||
|
(c.tokens.includes(t) &&
|
||||||
|
c.metaToken !== undefined &&
|
||||||
|
[makerToken, takerToken].includes(c.metaToken)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
case ChainId.Polygon:
|
||||||
|
return Object.values(CURVE_POLYGON_INFOS).filter(c =>
|
||||||
|
[makerToken, takerToken].every(
|
||||||
|
t =>
|
||||||
|
(c.tokens.includes(t) && c.metaToken === undefined) ||
|
||||||
|
(c.tokens.includes(t) &&
|
||||||
|
c.metaToken !== undefined &&
|
||||||
|
[makerToken, takerToken].includes(c.metaToken)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSwerveInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
|
export function getSwerveInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
|
||||||
@@ -194,22 +232,42 @@ export function getSaddleInfosForPair(chainId: ChainId, takerToken: string, make
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getXSigmaInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
|
||||||
|
if (chainId !== ChainId.Mainnet) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return Object.values(XSIGMA_MAINNET_INFOS).filter(c =>
|
||||||
|
[makerToken, takerToken].every(
|
||||||
|
t =>
|
||||||
|
(c.tokens.includes(t) && c.metaToken === undefined) ||
|
||||||
|
(c.tokens.includes(t) && c.metaToken !== undefined && [makerToken, takerToken].includes(c.metaToken)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function getShellLikeInfosForPair(
|
export function getShellLikeInfosForPair(
|
||||||
chainId: ChainId,
|
chainId: ChainId,
|
||||||
takerToken: string,
|
takerToken: string,
|
||||||
makerToken: string,
|
makerToken: string,
|
||||||
source: ERC20BridgeSource.Shell | ERC20BridgeSource.Component,
|
source: ERC20BridgeSource.Shell | ERC20BridgeSource.Component | ERC20BridgeSource.MStable,
|
||||||
): string[] {
|
): string[] {
|
||||||
switch (source) {
|
switch (source) {
|
||||||
case ERC20BridgeSource.Shell:
|
case ERC20BridgeSource.Shell:
|
||||||
return getShellsForPair(chainId, takerToken, makerToken);
|
return getShellsForPair(chainId, takerToken, makerToken);
|
||||||
case ERC20BridgeSource.Component:
|
case ERC20BridgeSource.Component:
|
||||||
return getComponentForPair(chainId, takerToken, makerToken);
|
return getComponentForPair(chainId, takerToken, makerToken);
|
||||||
|
case ERC20BridgeSource.MStable:
|
||||||
|
return getMStableForPair(chainId, takerToken, makerToken);
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unknown Shell like source ${source}`);
|
throw new Error(`Unknown Shell like source ${source}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface CurveDetailedInfo extends CurveInfo {
|
||||||
|
makerTokenIdx: number;
|
||||||
|
takerTokenIdx: number;
|
||||||
|
}
|
||||||
|
|
||||||
export function getCurveLikeInfosForPair(
|
export function getCurveLikeInfosForPair(
|
||||||
chainId: ChainId,
|
chainId: ChainId,
|
||||||
takerToken: string,
|
takerToken: string,
|
||||||
@@ -222,28 +280,46 @@ export function getCurveLikeInfosForPair(
|
|||||||
| ERC20BridgeSource.Belt
|
| ERC20BridgeSource.Belt
|
||||||
| ERC20BridgeSource.Ellipsis
|
| ERC20BridgeSource.Ellipsis
|
||||||
| ERC20BridgeSource.Smoothy
|
| ERC20BridgeSource.Smoothy
|
||||||
| ERC20BridgeSource.Saddle,
|
| ERC20BridgeSource.Saddle
|
||||||
): CurveInfo[] {
|
| ERC20BridgeSource.XSigma,
|
||||||
|
): CurveDetailedInfo[] {
|
||||||
|
let pools: CurveInfo[] = [];
|
||||||
switch (source) {
|
switch (source) {
|
||||||
case ERC20BridgeSource.Curve:
|
case ERC20BridgeSource.Curve:
|
||||||
return getCurveInfosForPair(chainId, takerToken, makerToken);
|
pools = getCurveInfosForPair(chainId, takerToken, makerToken);
|
||||||
|
break;
|
||||||
case ERC20BridgeSource.Swerve:
|
case ERC20BridgeSource.Swerve:
|
||||||
return getSwerveInfosForPair(chainId, takerToken, makerToken);
|
pools = getSwerveInfosForPair(chainId, takerToken, makerToken);
|
||||||
|
break;
|
||||||
case ERC20BridgeSource.SnowSwap:
|
case ERC20BridgeSource.SnowSwap:
|
||||||
return getSnowSwapInfosForPair(chainId, takerToken, makerToken);
|
pools = getSnowSwapInfosForPair(chainId, takerToken, makerToken);
|
||||||
|
break;
|
||||||
case ERC20BridgeSource.Nerve:
|
case ERC20BridgeSource.Nerve:
|
||||||
return getNerveInfosForPair(chainId, takerToken, makerToken);
|
pools = getNerveInfosForPair(chainId, takerToken, makerToken);
|
||||||
|
break;
|
||||||
case ERC20BridgeSource.Belt:
|
case ERC20BridgeSource.Belt:
|
||||||
return getBeltInfosForPair(chainId, takerToken, makerToken);
|
pools = getBeltInfosForPair(chainId, takerToken, makerToken);
|
||||||
|
break;
|
||||||
case ERC20BridgeSource.Ellipsis:
|
case ERC20BridgeSource.Ellipsis:
|
||||||
return getEllipsisInfosForPair(chainId, takerToken, makerToken);
|
pools = getEllipsisInfosForPair(chainId, takerToken, makerToken);
|
||||||
|
break;
|
||||||
case ERC20BridgeSource.Smoothy:
|
case ERC20BridgeSource.Smoothy:
|
||||||
return getSmoothyInfosForPair(chainId, takerToken, makerToken);
|
pools = getSmoothyInfosForPair(chainId, takerToken, makerToken);
|
||||||
|
break;
|
||||||
case ERC20BridgeSource.Saddle:
|
case ERC20BridgeSource.Saddle:
|
||||||
return getSaddleInfosForPair(chainId, takerToken, makerToken);
|
pools = getSaddleInfosForPair(chainId, takerToken, makerToken);
|
||||||
|
break;
|
||||||
|
case ERC20BridgeSource.XSigma:
|
||||||
|
pools = getXSigmaInfosForPair(chainId, takerToken, makerToken);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unknown Curve like source ${source}`);
|
throw new Error(`Unknown Curve like source ${source}`);
|
||||||
}
|
}
|
||||||
|
return pools.map(pool => ({
|
||||||
|
...pool,
|
||||||
|
makerTokenIdx: pool.tokens.indexOf(makerToken),
|
||||||
|
takerTokenIdx: pool.tokens.indexOf(takerToken),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function uniswapV2LikeRouterAddress(
|
export function uniswapV2LikeRouterAddress(
|
||||||
@@ -253,9 +329,15 @@ export function uniswapV2LikeRouterAddress(
|
|||||||
| ERC20BridgeSource.SushiSwap
|
| ERC20BridgeSource.SushiSwap
|
||||||
| ERC20BridgeSource.CryptoCom
|
| ERC20BridgeSource.CryptoCom
|
||||||
| ERC20BridgeSource.PancakeSwap
|
| ERC20BridgeSource.PancakeSwap
|
||||||
|
| ERC20BridgeSource.PancakeSwapV2
|
||||||
| ERC20BridgeSource.BakerySwap
|
| ERC20BridgeSource.BakerySwap
|
||||||
| ERC20BridgeSource.KyberDmm
|
| ERC20BridgeSource.ApeSwap
|
||||||
| ERC20BridgeSource.PancakeSwapV2,
|
| ERC20BridgeSource.CafeSwap
|
||||||
|
| ERC20BridgeSource.CheeseSwap
|
||||||
|
| ERC20BridgeSource.JulSwap
|
||||||
|
| ERC20BridgeSource.QuickSwap
|
||||||
|
| ERC20BridgeSource.ComethSwap
|
||||||
|
| ERC20BridgeSource.Dfyn,
|
||||||
): string {
|
): string {
|
||||||
switch (source) {
|
switch (source) {
|
||||||
case ERC20BridgeSource.UniswapV2:
|
case ERC20BridgeSource.UniswapV2:
|
||||||
@@ -266,12 +348,24 @@ export function uniswapV2LikeRouterAddress(
|
|||||||
return CRYPTO_COM_ROUTER_BY_CHAIN_ID[chainId];
|
return CRYPTO_COM_ROUTER_BY_CHAIN_ID[chainId];
|
||||||
case ERC20BridgeSource.PancakeSwap:
|
case ERC20BridgeSource.PancakeSwap:
|
||||||
return PANCAKESWAP_ROUTER_BY_CHAIN_ID[chainId];
|
return PANCAKESWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||||
|
case ERC20BridgeSource.PancakeSwapV2:
|
||||||
|
return PANCAKESWAPV2_ROUTER_BY_CHAIN_ID[chainId];
|
||||||
case ERC20BridgeSource.BakerySwap:
|
case ERC20BridgeSource.BakerySwap:
|
||||||
return BAKERYSWAP_ROUTER_BY_CHAIN_ID[chainId];
|
return BAKERYSWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||||
case ERC20BridgeSource.KyberDmm:
|
case ERC20BridgeSource.ApeSwap:
|
||||||
return KYBER_DMM_ROUTER_BY_CHAIN_ID[chainId];
|
return APESWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||||
case ERC20BridgeSource.PancakeSwapV2:
|
case ERC20BridgeSource.CafeSwap:
|
||||||
return PANCAKESWAP_V2_ROUTER_BY_CHAIN_ID[chainId];
|
return CAFESWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||||
|
case ERC20BridgeSource.CheeseSwap:
|
||||||
|
return CHEESESWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||||
|
case ERC20BridgeSource.JulSwap:
|
||||||
|
return JULSWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||||
|
case ERC20BridgeSource.QuickSwap:
|
||||||
|
return QUICKSWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||||
|
case ERC20BridgeSource.ComethSwap:
|
||||||
|
return COMETHSWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||||
|
case ERC20BridgeSource.Dfyn:
|
||||||
|
return DFYN_ROUTER_BY_CHAIN_ID[chainId];
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unknown UniswapV2 like source ${source}`);
|
throw new Error(`Unknown UniswapV2 like source ${source}`);
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user