Compare commits
56 Commits
protocol@3
...
wip/markdo
Author | SHA1 | Date | |
---|---|---|---|
|
7f7d587974 | ||
|
7886d913fa | ||
|
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 | ||
|
c03a014740 | ||
|
84e6d788aa | ||
|
cd296b8767 | ||
|
5946d32a7d | ||
|
842dd8572b |
@@ -1,25 +1,25 @@
|
||||
version: 2
|
||||
version: 2.1
|
||||
|
||||
jobs:
|
||||
build:
|
||||
resource_class: medium+
|
||||
resource_class: xlarge
|
||||
docker:
|
||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
||||
- image: node:12
|
||||
environment:
|
||||
CONTRACTS_COMMIT_HASH: '9ed05f5'
|
||||
NODE_OPTIONS: '--max-old-space-size=16384'
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- checkout
|
||||
- run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV
|
||||
- run:
|
||||
name: install-yarn
|
||||
command: npm install --force --global yarn@1.17.0
|
||||
command: npm install --force --global yarn@1.22.0
|
||||
- run:
|
||||
name: yarn
|
||||
command: yarn --frozen-lockfile --ignore-engines install || yarn --frozen-lockfile --ignore-engines install
|
||||
- setup_remote_docker
|
||||
- run: yarn build:ci
|
||||
- run: yarn build:ts
|
||||
- run: yarn build:ci || yarn build:ci || yarn build:ci
|
||||
- run: yarn build:ts || yarn build:ts || yarn build:ts
|
||||
- save_cache:
|
||||
key: repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
@@ -31,57 +31,59 @@ jobs:
|
||||
test-exchange-ganache:
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
||||
- image: node:12
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun test:circleci @0x/contracts-exchange
|
||||
- run: yarn wsrun -p @0x/contracts-exchange -m --serial -c test:circleci
|
||||
test-integrations-ganache:
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
||||
- image: node:12
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun test:circleci @0x/contracts-integrations
|
||||
- run: yarn wsrun -p @0x/contracts-integrations -m --serial -c test:circleci
|
||||
test-contracts-staking-ganache:
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
||||
- image: node:12
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun test:circleci @0x/contracts-staking
|
||||
- run: yarn wsrun -p @0x/contracts-staking -m --serial -c test:circleci
|
||||
test-contracts-extra-ganache:
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
||||
- image: node:12
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun test:circleci @0x/contracts-exchange-forwarder @0x/contracts-coordinator
|
||||
- run: yarn wsrun -p @0x/contracts-exchange-forwarder -p @0x/contracts-coordinator -m --serial -c test:circleci
|
||||
test-contracts-rest-ganache:
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
||||
- image: node:12
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun test:circleci @0x/contracts-multisig @0x/contracts-utils @0x/contracts-exchange-libs @0x/contracts-erc20 @0x/contracts-erc721 @0x/contracts-erc1155 @0x/contracts-asset-proxy @0x/contracts-broker @0x/contracts-zero-ex
|
||||
- run: yarn wsrun -p @0x/contracts-multisig -p @0x/contracts-utils -p @0x/contracts-exchange-libs -p @0x/contracts-erc20 -p @0x/contracts-erc721 -p @0x/contracts-erc1155 -p @0x/contracts-asset-proxy -p @0x/contracts-broker -p @0x/contracts-zero-ex -m --serial -c test:circleci
|
||||
test-publish:
|
||||
resource_class: medium+
|
||||
resource_class: large
|
||||
environment:
|
||||
NODE_OPTIONS: '--max-old-space-size=6442'
|
||||
docker:
|
||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
||||
- image: node:12
|
||||
- image: 0xorg/verdaccio
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
@@ -95,7 +97,7 @@ jobs:
|
||||
path: ~/.npm/_logs
|
||||
test-doc-generation:
|
||||
docker:
|
||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
||||
- image: node:12
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
@@ -106,18 +108,18 @@ jobs:
|
||||
no_output_timeout: 1200
|
||||
test-rest:
|
||||
docker:
|
||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
||||
- image: node:12
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun test:circleci @0x/contracts-test-utils
|
||||
- run: yarn wsrun test:circleci @0x/contract-artifacts
|
||||
- run: yarn wsrun test:circleci @0x/contract-wrappers-test
|
||||
- run: yarn wsrun test:circleci @0x/migrations
|
||||
- run: yarn wsrun test:circleci @0x/order-utils
|
||||
- run: yarn wsrun test:circleci @0x/asset-swapper
|
||||
- run: yarn wsrun -p @0x/contracts-test-utils -m --serial -c test:circleci
|
||||
- run: yarn wsrun -p @0x/contract-artifacts -m --serial -c test:circleci
|
||||
- run: yarn wsrun -p @0x/contract-wrappers-test -m --serial -c test:circleci
|
||||
- run: yarn wsrun -p @0x/migrations -m --serial -c test:circleci
|
||||
- run: yarn wsrun -p @0x/order-utils -m --serial -c test:circleci
|
||||
- run: yarn wsrun -p @0x/asset-swapper -m --serial -c test:circleci
|
||||
- save_cache:
|
||||
key: coverage-contract-wrappers-test-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
@@ -134,7 +136,7 @@ jobs:
|
||||
resource_class: large
|
||||
working_directory: ~/repo
|
||||
docker:
|
||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
||||
- image: node:12
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
@@ -145,7 +147,7 @@ jobs:
|
||||
- run: yarn diff_md_docs:ci
|
||||
submit-coverage:
|
||||
docker:
|
||||
- image: nikolaik/python-nodejs:python3.7-nodejs10
|
||||
- image: node:12
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1620214333,
|
||||
"version": "3.7.11",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "3.7.10",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1617311315,
|
||||
"version": "3.7.9",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.7.11 - _May 5, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.7.10 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.7.9 - _April 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-asset-proxy",
|
||||
"version": "3.7.9",
|
||||
"version": "3.7.11",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -51,15 +51,15 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.21",
|
||||
"@0x/contract-wrappers": "^13.15.0",
|
||||
"@0x/contracts-gen": "^2.0.32",
|
||||
"@0x/contracts-test-utils": "^5.3.24",
|
||||
"@0x/contracts-utils": "^4.7.6",
|
||||
"@0x/dev-utils": "^4.2.1",
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contract-wrappers": "^13.16.1",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-test-utils": "^5.4.0",
|
||||
"@0x/contracts-utils": "^4.7.8",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "12.12.54",
|
||||
@@ -67,7 +67,7 @@
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^3.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"ethereumjs-util": "^7.0.10",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^6.2.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
@@ -79,17 +79,17 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.18",
|
||||
"@0x/contracts-erc1155": "^2.1.27",
|
||||
"@0x/contracts-erc20": "^3.3.6",
|
||||
"@0x/contracts-erc721": "^3.1.27",
|
||||
"@0x/contracts-exchange-libs": "^4.3.27",
|
||||
"@0x/order-utils": "^10.4.19",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"@0x/web3-wrapper": "^7.4.1",
|
||||
"ethereum-types": "^3.4.0",
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/contracts-erc1155": "^2.1.29",
|
||||
"@0x/contracts-erc20": "^3.3.8",
|
||||
"@0x/contracts-erc721": "^3.1.29",
|
||||
"@0x/contracts-exchange-libs": "^4.3.29",
|
||||
"@0x/order-utils": "^10.4.21",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"@0x/web3-wrapper": "^7.5.3",
|
||||
"ethereum-types": "^3.5.0",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -168,7 +168,7 @@ describe('StaticCallProxy', () => {
|
||||
it('should revert if the hash of the output is different than expected expected', async () => {
|
||||
const staticCallData = staticCallTarget.isOddNumber(new BigNumber(0)).getABIEncodedTransactionData();
|
||||
const trueAsBuffer = ethUtil.toBuffer('0x0000000000000000000000000000000000000000000000000000000000000001');
|
||||
const expectedResultHash = ethUtil.bufferToHex(ethUtil.sha3(trueAsBuffer));
|
||||
const expectedResultHash = ethUtil.bufferToHex(ethUtil.keccak256(trueAsBuffer));
|
||||
const assetData = assetDataInterface
|
||||
.StaticCall(staticCallTarget.address, staticCallData, expectedResultHash)
|
||||
.getABIEncodedTransactionData();
|
||||
@@ -199,7 +199,7 @@ describe('StaticCallProxy', () => {
|
||||
it('should be successful if a function call with one static input returns the correct value', async () => {
|
||||
const staticCallData = staticCallTarget.isOddNumber(new BigNumber(1)).getABIEncodedTransactionData();
|
||||
const trueAsBuffer = ethUtil.toBuffer('0x0000000000000000000000000000000000000000000000000000000000000001');
|
||||
const expectedResultHash = ethUtil.bufferToHex(ethUtil.sha3(trueAsBuffer));
|
||||
const expectedResultHash = ethUtil.bufferToHex(ethUtil.keccak256(trueAsBuffer));
|
||||
const assetData = assetDataInterface
|
||||
.StaticCall(staticCallTarget.address, staticCallData, expectedResultHash)
|
||||
.getABIEncodedTransactionData();
|
||||
@@ -232,7 +232,7 @@ describe('StaticCallProxy', () => {
|
||||
const offset = '0000000000000000000000000000000000000000000000000000000000000020';
|
||||
const encodedExpectedResultWithOffset = `0x${offset}${abiEncoder.encode(expectedResults).slice(2)}`;
|
||||
const expectedResultHash = ethUtil.bufferToHex(
|
||||
ethUtil.sha3(ethUtil.toBuffer(encodedExpectedResultWithOffset)),
|
||||
ethUtil.keccak256(ethUtil.toBuffer(encodedExpectedResultWithOffset)),
|
||||
);
|
||||
const assetData = assetDataInterface
|
||||
.StaticCall(staticCallTarget.address, staticCallData, expectedResultHash)
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1620214333,
|
||||
"version": "1.1.29",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "1.1.28",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1617311315,
|
||||
"version": "1.1.27",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.1.29 - _May 5, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.1.28 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.1.27 - _April 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-broker",
|
||||
"version": "1.1.27",
|
||||
"version": "1.1.29",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -51,20 +51,20 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.21",
|
||||
"@0x/contracts-asset-proxy": "^3.7.9",
|
||||
"@0x/contracts-erc20": "^3.3.6",
|
||||
"@0x/contracts-erc721": "^3.1.27",
|
||||
"@0x/contracts-exchange": "^3.2.28",
|
||||
"@0x/contracts-exchange-libs": "^4.3.27",
|
||||
"@0x/contracts-gen": "^2.0.32",
|
||||
"@0x/contracts-test-utils": "^5.3.24",
|
||||
"@0x/contracts-utils": "^4.7.6",
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.11",
|
||||
"@0x/contracts-erc20": "^3.3.8",
|
||||
"@0x/contracts-erc721": "^3.1.29",
|
||||
"@0x/contracts-exchange": "^3.2.30",
|
||||
"@0x/contracts-exchange-libs": "^4.3.29",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-test-utils": "^5.4.0",
|
||||
"@0x/contracts-utils": "^4.7.8",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/web3-wrapper": "^7.4.1",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/web3-wrapper": "^7.5.3",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "12.12.54",
|
||||
@@ -84,11 +84,11 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.18",
|
||||
"@0x/order-utils": "^10.4.19",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"ethereum-types": "^3.4.0"
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/order-utils": "^10.4.21",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"ethereum-types": "^3.5.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1620214333,
|
||||
"version": "3.1.30",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "3.1.29",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1617311315,
|
||||
"version": "3.1.28",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.1.30 - _May 5, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.1.29 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.1.28 - _April 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-coordinator",
|
||||
"version": "3.1.28",
|
||||
"version": "3.1.30",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -52,17 +52,17 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.21",
|
||||
"@0x/contracts-asset-proxy": "^3.7.9",
|
||||
"@0x/contracts-dev-utils": "^1.3.26",
|
||||
"@0x/contracts-erc20": "^3.3.6",
|
||||
"@0x/contracts-gen": "^2.0.32",
|
||||
"@0x/dev-utils": "^4.2.1",
|
||||
"@0x/order-utils": "^10.4.19",
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.11",
|
||||
"@0x/contracts-dev-utils": "^1.3.28",
|
||||
"@0x/contracts-erc20": "^3.3.8",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/order-utils": "^10.4.21",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/web3-wrapper": "^7.4.1",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/web3-wrapper": "^7.5.3",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "12.12.54",
|
||||
@@ -82,17 +82,17 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.21",
|
||||
"@0x/base-contract": "^6.2.18",
|
||||
"@0x/contract-addresses": "^6.0.0",
|
||||
"@0x/contracts-exchange": "^3.2.28",
|
||||
"@0x/contracts-test-utils": "^5.3.24",
|
||||
"@0x/contracts-utils": "^4.7.6",
|
||||
"@0x/json-schemas": "^5.4.1",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"ethereum-types": "^3.4.0",
|
||||
"@0x/assert": "^3.0.27",
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/contract-addresses": "^6.1.0",
|
||||
"@0x/contracts-exchange": "^3.2.30",
|
||||
"@0x/contracts-test-utils": "^5.4.0",
|
||||
"@0x/contracts-utils": "^4.7.8",
|
||||
"@0x/json-schemas": "^6.1.3",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"ethereum-types": "^3.5.0",
|
||||
"http-status-codes": "^1.3.2"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -1,8 +1,4 @@
|
||||
import { assert as sharedAssert } from '@0x/assert';
|
||||
// HACK: We need those two unused imports because they're actually used by sharedAssert which gets injected here
|
||||
import { Schema } from '@0x/json-schemas'; // tslint:disable-line:no-unused-variable
|
||||
import { Order } from '@0x/types'; // tslint:disable-line:no-unused-variable
|
||||
import { BigNumber } from '@0x/utils'; // tslint:disable-line:no-unused-variable
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
|
||||
export const assert = {
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1620214333,
|
||||
"version": "1.3.28",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "1.3.27",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1617311315,
|
||||
"version": "1.3.26",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.3.28 - _May 5, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.3.27 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.3.26 - _April 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-dev-utils",
|
||||
"version": "1.3.26",
|
||||
"version": "1.3.28",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -41,18 +41,18 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/dev-utils",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.21",
|
||||
"@0x/assert": "^3.0.21",
|
||||
"@0x/contracts-asset-proxy": "^3.7.9",
|
||||
"@0x/contracts-erc20": "^3.3.6",
|
||||
"@0x/contracts-gen": "^2.0.32",
|
||||
"@0x/contracts-test-utils": "^5.3.24",
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/assert": "^3.0.27",
|
||||
"@0x/contracts-asset-proxy": "^3.7.11",
|
||||
"@0x/contracts-erc20": "^3.3.8",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-test-utils": "^5.4.0",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"ethereum-types": "^3.4.0",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"ethereum-types": "^3.5.0",
|
||||
"ethers": "~4.0.4",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
@@ -63,7 +63,7 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.18",
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@types/node": "12.12.54"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1620214333,
|
||||
"version": "2.1.29",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "2.1.28",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1617311315,
|
||||
"version": "2.1.27",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v2.1.29 - _May 5, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.1.28 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.1.27 - _April 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-erc1155",
|
||||
"version": "2.1.27",
|
||||
"version": "2.1.29",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -52,15 +52,15 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.21",
|
||||
"@0x/contracts-gen": "^2.0.32",
|
||||
"@0x/contracts-utils": "^4.7.6",
|
||||
"@0x/dev-utils": "^4.2.1",
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-utils": "^4.7.8",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "12.12.54",
|
||||
@@ -68,7 +68,7 @@
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^3.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"ethereum-types": "^3.4.0",
|
||||
"ethereum-types": "^3.5.0",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^6.2.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
@@ -80,10 +80,10 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.18",
|
||||
"@0x/contracts-test-utils": "^5.3.24",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"@0x/web3-wrapper": "^7.4.1",
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/contracts-test-utils": "^5.4.0",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"@0x/web3-wrapper": "^7.5.3",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1620214333,
|
||||
"version": "3.3.8",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "3.3.7",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1617311315,
|
||||
"version": "3.3.6",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.3.8 - _May 5, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.3.7 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.3.6 - _April 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-erc20",
|
||||
"version": "3.3.6",
|
||||
"version": "3.3.8",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -51,18 +51,18 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.21",
|
||||
"@0x/contracts-gen": "^2.0.32",
|
||||
"@0x/contracts-test-utils": "^5.3.24",
|
||||
"@0x/contracts-utils": "^4.7.6",
|
||||
"@0x/dev-utils": "^4.2.1",
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-test-utils": "^5.4.0",
|
||||
"@0x/contracts-utils": "^4.7.8",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"@0x/web3-wrapper": "^7.4.1",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"@0x/web3-wrapper": "^7.5.3",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "12.12.54",
|
||||
@@ -70,7 +70,7 @@
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^3.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"ethereum-types": "^3.4.0",
|
||||
"ethereum-types": "^3.5.0",
|
||||
"lodash": "^4.17.11",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^6.2.0",
|
||||
@@ -82,7 +82,7 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.18"
|
||||
"@0x/base-contract": "^6.4.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1620214333,
|
||||
"version": "3.1.29",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "3.1.28",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1617311315,
|
||||
"version": "3.1.27",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.1.29 - _May 5, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.1.28 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.1.27 - _April 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-erc721",
|
||||
"version": "3.1.27",
|
||||
"version": "3.1.29",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -52,18 +52,18 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.21",
|
||||
"@0x/contracts-gen": "^2.0.32",
|
||||
"@0x/contracts-test-utils": "^5.3.24",
|
||||
"@0x/contracts-utils": "^4.7.6",
|
||||
"@0x/dev-utils": "^4.2.1",
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-test-utils": "^5.4.0",
|
||||
"@0x/contracts-utils": "^4.7.8",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"@0x/web3-wrapper": "^7.4.1",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"@0x/web3-wrapper": "^7.5.3",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "12.12.54",
|
||||
@@ -71,7 +71,7 @@
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^3.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"ethereum-types": "^3.4.0",
|
||||
"ethereum-types": "^3.5.0",
|
||||
"lodash": "^4.17.11",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^6.2.0",
|
||||
@@ -84,7 +84,7 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.18"
|
||||
"@0x/base-contract": "^6.4.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1620214333,
|
||||
"version": "4.2.30",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "4.2.29",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1617311315,
|
||||
"version": "4.2.28",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v4.2.30 - _May 5, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.2.29 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.2.28 - _April 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-exchange-forwarder",
|
||||
"version": "4.2.28",
|
||||
"version": "4.2.30",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -52,25 +52,25 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.21",
|
||||
"@0x/contracts-asset-proxy": "^3.7.9",
|
||||
"@0x/contracts-dev-utils": "^1.3.26",
|
||||
"@0x/contracts-erc1155": "^2.1.27",
|
||||
"@0x/contracts-erc20": "^3.3.6",
|
||||
"@0x/contracts-erc721": "^3.1.27",
|
||||
"@0x/contracts-exchange": "^3.2.28",
|
||||
"@0x/contracts-exchange-libs": "^4.3.27",
|
||||
"@0x/contracts-gen": "^2.0.32",
|
||||
"@0x/contracts-test-utils": "^5.3.24",
|
||||
"@0x/contracts-utils": "^4.7.6",
|
||||
"@0x/dev-utils": "^4.2.1",
|
||||
"@0x/order-utils": "^10.4.19",
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.11",
|
||||
"@0x/contracts-dev-utils": "^1.3.28",
|
||||
"@0x/contracts-erc1155": "^2.1.29",
|
||||
"@0x/contracts-erc20": "^3.3.8",
|
||||
"@0x/contracts-erc721": "^3.1.29",
|
||||
"@0x/contracts-exchange": "^3.2.30",
|
||||
"@0x/contracts-exchange-libs": "^4.3.29",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-test-utils": "^5.4.0",
|
||||
"@0x/contracts-utils": "^4.7.8",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/order-utils": "^10.4.21",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"@0x/web3-wrapper": "^7.4.1",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"@0x/web3-wrapper": "^7.5.3",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "12.12.54",
|
||||
@@ -90,9 +90,9 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.18",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"ethereum-types": "^3.4.0"
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
"ethereum-types": "^3.5.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1620214333,
|
||||
"version": "4.3.29",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "4.3.28",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1617311315,
|
||||
"version": "4.3.27",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v4.3.29 - _May 5, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.3.28 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.3.27 - _April 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-exchange-libs",
|
||||
"version": "4.3.27",
|
||||
"version": "4.3.29",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -52,14 +52,14 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/libs",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.21",
|
||||
"@0x/contracts-gen": "^2.0.32",
|
||||
"@0x/dev-utils": "^4.2.1",
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/subproviders": "^6.4.1",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/subproviders": "^6.5.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/web3-wrapper": "^7.4.1",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/web3-wrapper": "^7.5.3",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "12.12.54",
|
||||
@@ -67,7 +67,7 @@
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^3.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"ethereumjs-util": "^7.0.10",
|
||||
"lodash": "^4.17.11",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^6.2.0",
|
||||
@@ -80,14 +80,14 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.18",
|
||||
"@0x/contracts-test-utils": "^5.3.24",
|
||||
"@0x/contracts-utils": "^4.7.6",
|
||||
"@0x/order-utils": "^10.4.19",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"ethereum-types": "^3.4.0"
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/contracts-test-utils": "^5.4.0",
|
||||
"@0x/contracts-utils": "^4.7.8",
|
||||
"@0x/order-utils": "^10.4.21",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"ethereum-types": "^3.5.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1620214333,
|
||||
"version": "3.2.30",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "3.2.29",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1617311315,
|
||||
"version": "3.2.28",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.2.30 - _May 5, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.2.29 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.2.28 - _April 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-exchange",
|
||||
"version": "3.2.28",
|
||||
"version": "3.2.30",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -52,21 +52,21 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.21",
|
||||
"@0x/contracts-asset-proxy": "^3.7.9",
|
||||
"@0x/contracts-exchange-libs": "^4.3.27",
|
||||
"@0x/contracts-gen": "^2.0.32",
|
||||
"@0x/contracts-multisig": "^4.1.28",
|
||||
"@0x/contracts-staking": "^2.0.35",
|
||||
"@0x/contracts-test-utils": "^5.3.24",
|
||||
"@0x/contracts-utils": "^4.7.6",
|
||||
"@0x/dev-utils": "^4.2.1",
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.11",
|
||||
"@0x/contracts-exchange-libs": "^4.3.29",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-multisig": "^4.1.30",
|
||||
"@0x/contracts-staking": "^2.0.37",
|
||||
"@0x/contracts-test-utils": "^5.4.0",
|
||||
"@0x/contracts-utils": "^4.7.8",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/web3-wrapper": "^7.4.1",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
"@0x/web3-wrapper": "^7.5.3",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "12.12.54",
|
||||
@@ -74,8 +74,8 @@
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^3.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"ethereum-types": "^3.4.0",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"ethereum-types": "^3.5.0",
|
||||
"ethereumjs-util": "^7.0.10",
|
||||
"js-combinatorics": "^0.5.3",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^6.2.0",
|
||||
@@ -88,13 +88,13 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.18",
|
||||
"@0x/contracts-dev-utils": "^1.3.26",
|
||||
"@0x/contracts-erc1155": "^2.1.27",
|
||||
"@0x/contracts-erc20": "^3.3.6",
|
||||
"@0x/contracts-erc721": "^3.1.27",
|
||||
"@0x/order-utils": "^10.4.19",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/contracts-dev-utils": "^1.3.28",
|
||||
"@0x/contracts-erc1155": "^2.1.29",
|
||||
"@0x/contracts-erc20": "^3.3.8",
|
||||
"@0x/contracts-erc721": "^3.1.29",
|
||||
"@0x/order-utils": "^10.4.21",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -86,7 +86,7 @@ blockchainTests.resets('MixinSignatureValidator', env => {
|
||||
|
||||
const SIGNATURE_LENGTH = 65;
|
||||
const generateRandomSignature = (): string => hexUtils.random(SIGNATURE_LENGTH);
|
||||
const hashBytes = (bytesHex: string): string => ethUtil.bufferToHex(ethUtil.sha3(ethUtil.toBuffer(bytesHex)));
|
||||
const hashBytes = (bytesHex: string): string => hexUtils.hash(bytesHex);
|
||||
const signDataHex = (dataHex: string, privateKey: Buffer): string => {
|
||||
const ecSignature = ethUtil.ecsign(ethUtil.toBuffer(dataHex), privateKey);
|
||||
return hexUtils.concat(ecSignature.v, ecSignature.r, ecSignature.s);
|
||||
|
@@ -12,7 +12,6 @@ import { ReferenceFunctions as UtilReferenceFunctions, SafeMathRevertErrors } fr
|
||||
import { FillResults, Order } from '@0x/types';
|
||||
import { AnyRevertError, BigNumber, ExchangeRevertErrors, hexUtils, StringRevertError } from '@0x/utils';
|
||||
import { LogEntry, LogWithDecodedArgs } from 'ethereum-types';
|
||||
import * as ethjs from 'ethereumjs-util';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { artifacts } from './artifacts';
|
||||
@@ -104,7 +103,7 @@ blockchainTests('Exchange wrapper functions unit tests.', env => {
|
||||
// Creates a deterministic order signature, even though no signature validation
|
||||
// actually occurs in the test contract.
|
||||
function createOrderSignature(order: Order): string {
|
||||
return ethjs.bufferToHex(ethjs.sha3(ethjs.toBuffer(orderHashUtils.getOrderHashHex(order))));
|
||||
return hexUtils.hash(orderHashUtils.getOrderHashHex(order));
|
||||
}
|
||||
|
||||
// Asserts that `_fillOrder()` was called in the same order and with the same
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1620214333,
|
||||
"version": "6.2.24",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "6.2.23",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1617311315,
|
||||
"version": "6.2.22",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v6.2.24 - _May 5, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.2.23 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.2.22 - _April 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-extensions",
|
||||
"version": "6.2.22",
|
||||
"version": "6.2.24",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -52,23 +52,23 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.21",
|
||||
"@0x/contracts-asset-proxy": "^3.7.9",
|
||||
"@0x/contracts-dev-utils": "^1.3.26",
|
||||
"@0x/contracts-erc20": "^3.3.6",
|
||||
"@0x/contracts-erc721": "^3.1.27",
|
||||
"@0x/contracts-exchange": "^3.2.28",
|
||||
"@0x/contracts-exchange-libs": "^4.3.27",
|
||||
"@0x/contracts-gen": "^2.0.32",
|
||||
"@0x/contracts-utils": "^4.7.6",
|
||||
"@0x/dev-utils": "^4.2.1",
|
||||
"@0x/order-utils": "^10.4.19",
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.11",
|
||||
"@0x/contracts-dev-utils": "^1.3.28",
|
||||
"@0x/contracts-erc20": "^3.3.8",
|
||||
"@0x/contracts-erc721": "^3.1.29",
|
||||
"@0x/contracts-exchange": "^3.2.30",
|
||||
"@0x/contracts-exchange-libs": "^4.3.29",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-utils": "^4.7.8",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/order-utils": "^10.4.21",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"@0x/web3-wrapper": "^7.4.1",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"@0x/web3-wrapper": "^7.5.3",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "12.12.54",
|
||||
@@ -77,7 +77,7 @@
|
||||
"chai-bignumber": "^3.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"ethereumjs-abi": "0.6.5",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"ethereumjs-util": "^7.0.10",
|
||||
"lodash": "^4.17.11",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^6.2.0",
|
||||
@@ -90,10 +90,10 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.18",
|
||||
"@0x/contracts-test-utils": "^5.3.24",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"ethereum-types": "^3.4.0"
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/contracts-test-utils": "^5.4.0",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
"ethereum-types": "^3.5.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-integrations",
|
||||
"version": "2.7.36",
|
||||
"version": "2.7.44",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
@@ -52,25 +52,25 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.21",
|
||||
"@0x/contract-addresses": "^6.0.0",
|
||||
"@0x/contract-wrappers": "^13.15.0",
|
||||
"@0x/contracts-broker": "^1.1.27",
|
||||
"@0x/contracts-coordinator": "^3.1.28",
|
||||
"@0x/contracts-dev-utils": "^1.3.26",
|
||||
"@0x/contracts-exchange-forwarder": "^4.2.28",
|
||||
"@0x/contracts-exchange-libs": "^4.3.27",
|
||||
"@0x/contracts-extensions": "^6.2.22",
|
||||
"@0x/contracts-gen": "^2.0.32",
|
||||
"@0x/contracts-utils": "^4.7.6",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contract-addresses": "^6.1.0",
|
||||
"@0x/contract-wrappers": "^13.16.1",
|
||||
"@0x/contracts-broker": "^1.1.29",
|
||||
"@0x/contracts-coordinator": "^3.1.30",
|
||||
"@0x/contracts-dev-utils": "^1.3.28",
|
||||
"@0x/contracts-exchange-forwarder": "^4.2.30",
|
||||
"@0x/contracts-exchange-libs": "^4.3.29",
|
||||
"@0x/contracts-extensions": "^6.2.24",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-utils": "^4.7.8",
|
||||
"@0x/coordinator-server": "^1.0.5",
|
||||
"@0x/dev-utils": "^4.2.1",
|
||||
"@0x/migrations": "^8.0.2",
|
||||
"@0x/order-utils": "^10.4.19",
|
||||
"@0x/protocol-utils": "^1.5.0",
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/web3-wrapper": "^7.4.1",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/migrations": "^8.0.6",
|
||||
"@0x/order-utils": "^10.4.21",
|
||||
"@0x/protocol-utils": "^1.6.0",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/web3-wrapper": "^7.5.3",
|
||||
"@azure/core-asynciterator-polyfill": "^1.0.0",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
@@ -93,23 +93,23 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/asset-swapper": "^6.7.0",
|
||||
"@0x/base-contract": "^6.2.18",
|
||||
"@0x/contracts-asset-proxy": "^3.7.9",
|
||||
"@0x/contracts-erc1155": "^2.1.27",
|
||||
"@0x/contracts-erc20": "^3.3.6",
|
||||
"@0x/contracts-erc721": "^3.1.27",
|
||||
"@0x/contracts-exchange": "^3.2.28",
|
||||
"@0x/contracts-multisig": "^4.1.28",
|
||||
"@0x/contracts-staking": "^2.0.35",
|
||||
"@0x/contracts-test-utils": "^5.3.24",
|
||||
"@0x/contracts-zero-ex": "^0.22.0",
|
||||
"@0x/subproviders": "^6.4.1",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"ethereum-types": "^3.4.0",
|
||||
"ethereumjs-util": "^6.2.0",
|
||||
"@0x/asset-swapper": "^6.14.0",
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.11",
|
||||
"@0x/contracts-erc1155": "^2.1.29",
|
||||
"@0x/contracts-erc20": "^3.3.8",
|
||||
"@0x/contracts-erc721": "^3.1.29",
|
||||
"@0x/contracts-exchange": "^3.2.30",
|
||||
"@0x/contracts-multisig": "^4.1.30",
|
||||
"@0x/contracts-staking": "^2.0.37",
|
||||
"@0x/contracts-test-utils": "^5.4.0",
|
||||
"@0x/contracts-zero-ex": "^0.23.0",
|
||||
"@0x/subproviders": "^6.5.3",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"ethereum-types": "^3.5.0",
|
||||
"ethereumjs-util": "^7.0.10",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1620214333,
|
||||
"version": "4.1.30",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "4.1.29",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1617311315,
|
||||
"version": "4.1.28",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v4.1.30 - _May 5, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.1.29 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.1.28 - _April 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-multisig",
|
||||
"version": "4.1.28",
|
||||
"version": "4.1.30",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -49,18 +49,18 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/multisig",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.21",
|
||||
"@0x/contracts-asset-proxy": "^3.7.9",
|
||||
"@0x/contracts-erc20": "^3.3.6",
|
||||
"@0x/contracts-gen": "^2.0.32",
|
||||
"@0x/contracts-test-utils": "^5.3.24",
|
||||
"@0x/contracts-utils": "^4.7.6",
|
||||
"@0x/dev-utils": "^4.2.1",
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"@0x/web3-wrapper": "^7.4.1",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.11",
|
||||
"@0x/contracts-erc20": "^3.3.8",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-test-utils": "^5.4.0",
|
||||
"@0x/contracts-utils": "^4.7.8",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"@0x/web3-wrapper": "^7.5.3",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "12.12.54",
|
||||
@@ -78,9 +78,9 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.18",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"ethereum-types": "^3.4.0"
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
"ethereum-types": "^3.5.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -1,4 +1,23 @@
|
||||
[
|
||||
{
|
||||
"version": "2.0.37",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Patch epoch finalization issue",
|
||||
"pr": 221
|
||||
}
|
||||
],
|
||||
"timestamp": 1620214333
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "2.0.36",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1617311315,
|
||||
"version": "2.0.35",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v2.0.37 - _May 5, 2021_
|
||||
|
||||
* Patch epoch finalization issue (#221)
|
||||
|
||||
## v2.0.36 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.0.35 - _April 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
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);
|
||||
|
||||
if (protocolFee == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Transfer the protocol fee to this address if it should be paid in
|
||||
// WETH.
|
||||
if (msg.value == 0) {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-staking",
|
||||
"version": "2.0.35",
|
||||
"version": "2.0.37",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -41,7 +41,7 @@
|
||||
"config": {
|
||||
"publicInterfaceContracts": "IStaking,IStakingEvents,IStakingProxy,IZrxVault,LibStakingRichErrors,Staking,StakingProxy,ZrxVault,TestStaking",
|
||||
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
|
||||
"abis": "./test/generated-artifacts/@(IStaking|IStakingEvents|IStakingProxy|IStorage|IStorageInit|IStructs|IZrxVault|LibCobbDouglas|LibFixedMath|LibFixedMathRichErrors|LibSafeDowncast|LibStakingRichErrors|MixinAbstract|MixinConstants|MixinCumulativeRewards|MixinDeploymentConstants|MixinExchangeFees|MixinExchangeManager|MixinFinalizer|MixinParams|MixinScheduler|MixinStake|MixinStakeBalances|MixinStakeStorage|MixinStakingPool|MixinStakingPoolRewards|MixinStorage|Staking|StakingProxy|TestAssertStorageParams|TestCobbDouglas|TestCumulativeRewardTracking|TestDelegatorRewards|TestExchangeManager|TestFinalizer|TestInitTarget|TestLibFixedMath|TestLibSafeDowncast|TestMixinCumulativeRewards|TestMixinParams|TestMixinScheduler|TestMixinStake|TestMixinStakeBalances|TestMixinStakeStorage|TestMixinStakingPool|TestMixinStakingPoolRewards|TestProtocolFees|TestProxyDestination|TestStaking|TestStakingNoWETH|TestStakingProxy|TestStakingProxyUnit|TestStorageLayoutAndConstants|ZrxVault).json"
|
||||
"abis": "./test/generated-artifacts/@(IStaking|IStakingEvents|IStakingProxy|IStorage|IStorageInit|IStructs|IZrxVault|LibCobbDouglas|LibFixedMath|LibFixedMathRichErrors|LibSafeDowncast|LibStakingRichErrors|MixinAbstract|MixinConstants|MixinCumulativeRewards|MixinDeploymentConstants|MixinExchangeFees|MixinExchangeManager|MixinFinalizer|MixinParams|MixinScheduler|MixinStake|MixinStakeBalances|MixinStakeStorage|MixinStakingPool|MixinStakingPoolRewards|MixinStorage|Staking|StakingPatch|StakingProxy|TestAssertStorageParams|TestCobbDouglas|TestCumulativeRewardTracking|TestDelegatorRewards|TestExchangeManager|TestFinalizer|TestInitTarget|TestLibFixedMath|TestLibSafeDowncast|TestMixinCumulativeRewards|TestMixinParams|TestMixinScheduler|TestMixinStake|TestMixinStakeBalances|TestMixinStakeStorage|TestMixinStakingPool|TestMixinStakingPoolRewards|TestProtocolFees|TestProxyDestination|TestStaking|TestStakingNoWETH|TestStakingProxy|TestStakingProxyUnit|TestStorageLayoutAndConstants|ZrxVault).json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -53,20 +53,20 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.21",
|
||||
"@0x/contracts-asset-proxy": "^3.7.9",
|
||||
"@0x/contracts-dev-utils": "^1.3.26",
|
||||
"@0x/contracts-erc20": "^3.3.6",
|
||||
"@0x/contracts-exchange-libs": "^4.3.27",
|
||||
"@0x/contracts-gen": "^2.0.32",
|
||||
"@0x/contracts-utils": "^4.7.6",
|
||||
"@0x/dev-utils": "^4.2.1",
|
||||
"@0x/order-utils": "^10.4.19",
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.11",
|
||||
"@0x/contracts-dev-utils": "^1.3.28",
|
||||
"@0x/contracts-erc20": "^3.3.8",
|
||||
"@0x/contracts-exchange-libs": "^4.3.29",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-utils": "^4.7.8",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/order-utils": "^10.4.21",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/web3-wrapper": "^7.4.1",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/web3-wrapper": "^7.5.3",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "12.12.54",
|
||||
"chai": "^4.0.1",
|
||||
@@ -87,12 +87,12 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.18",
|
||||
"@0x/contracts-test-utils": "^5.3.24",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"ethereum-types": "^3.4.0",
|
||||
"ethereumjs-util": "^5.1.1"
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/contracts-test-utils": "^5.4.0",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"ethereum-types": "^3.5.0",
|
||||
"ethereumjs-util": "^7.0.10"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -33,6 +33,7 @@ import * as MixinStakingPool from '../test/generated-artifacts/MixinStakingPool.
|
||||
import * as MixinStakingPoolRewards from '../test/generated-artifacts/MixinStakingPoolRewards.json';
|
||||
import * as MixinStorage from '../test/generated-artifacts/MixinStorage.json';
|
||||
import * as Staking from '../test/generated-artifacts/Staking.json';
|
||||
import * as StakingPatch from '../test/generated-artifacts/StakingPatch.json';
|
||||
import * as StakingProxy from '../test/generated-artifacts/StakingProxy.json';
|
||||
import * as TestAssertStorageParams from '../test/generated-artifacts/TestAssertStorageParams.json';
|
||||
import * as TestCobbDouglas from '../test/generated-artifacts/TestCobbDouglas.json';
|
||||
@@ -61,6 +62,7 @@ import * as TestStorageLayoutAndConstants from '../test/generated-artifacts/Test
|
||||
import * as ZrxVault from '../test/generated-artifacts/ZrxVault.json';
|
||||
export const artifacts = {
|
||||
Staking: Staking as ContractArtifact,
|
||||
StakingPatch: StakingPatch as ContractArtifact,
|
||||
StakingProxy: StakingProxy as ContractArtifact,
|
||||
ZrxVault: ZrxVault as ContractArtifact,
|
||||
MixinExchangeFees: MixinExchangeFees as ContractArtifact,
|
||||
|
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_storage';
|
||||
export * from '../test/generated-wrappers/staking';
|
||||
export * from '../test/generated-wrappers/staking_patch';
|
||||
export * from '../test/generated-wrappers/staking_proxy';
|
||||
export * from '../test/generated-wrappers/test_assert_storage_params';
|
||||
export * from '../test/generated-wrappers/test_cobb_douglas';
|
||||
|
@@ -40,6 +40,7 @@
|
||||
"test/generated-artifacts/MixinStakingPoolRewards.json",
|
||||
"test/generated-artifacts/MixinStorage.json",
|
||||
"test/generated-artifacts/Staking.json",
|
||||
"test/generated-artifacts/StakingPatch.json",
|
||||
"test/generated-artifacts/StakingProxy.json",
|
||||
"test/generated-artifacts/TestAssertStorageParams.json",
|
||||
"test/generated-artifacts/TestCobbDouglas.json",
|
||||
|
@@ -1,4 +1,23 @@
|
||||
[
|
||||
{
|
||||
"version": "5.4.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Set default ganache gas limit to 100e6",
|
||||
"pr": 197
|
||||
}
|
||||
],
|
||||
"timestamp": 1620214333
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "5.3.25",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1617311315,
|
||||
"version": "5.3.24",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v5.4.0 - _May 5, 2021_
|
||||
|
||||
* Set default ganache gas limit to 100e6 (#197)
|
||||
|
||||
## v5.3.25 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v5.3.24 - _April 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-test-utils",
|
||||
"version": "5.3.24",
|
||||
"version": "5.4.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -34,28 +34,28 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/test-utils",
|
||||
"devDependencies": {
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
"tslint": "5.11.0",
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.21",
|
||||
"@0x/base-contract": "^6.2.18",
|
||||
"@0x/contract-addresses": "^6.0.0",
|
||||
"@0x/dev-utils": "^4.2.1",
|
||||
"@0x/json-schemas": "^5.4.1",
|
||||
"@0x/order-utils": "^10.4.19",
|
||||
"@0x/sol-coverage": "^4.0.31",
|
||||
"@0x/sol-profiler": "^4.1.21",
|
||||
"@0x/sol-trace": "^3.0.31",
|
||||
"@0x/subproviders": "^6.4.1",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"@0x/web3-wrapper": "^7.4.1",
|
||||
"@0x/assert": "^3.0.27",
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/contract-addresses": "^6.1.0",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/json-schemas": "^6.1.3",
|
||||
"@0x/order-utils": "^10.4.21",
|
||||
"@0x/sol-coverage": "^4.0.37",
|
||||
"@0x/sol-profiler": "^4.1.27",
|
||||
"@0x/sol-trace": "^3.0.37",
|
||||
"@0x/subproviders": "^6.5.3",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"@0x/web3-wrapper": "^7.5.3",
|
||||
"@types/bn.js": "^4.11.0",
|
||||
"@types/js-combinatorics": "^0.5.29",
|
||||
"@types/lodash": "4.14.104",
|
||||
@@ -67,8 +67,8 @@
|
||||
"chai-bignumber": "^3.0.0",
|
||||
"decimal.js": "^10.2.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"ethereum-types": "^3.4.0",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"ethereum-types": "^3.5.0",
|
||||
"ethereumjs-util": "^7.0.10",
|
||||
"ethers": "~4.0.4",
|
||||
"js-combinatorics": "^0.5.3",
|
||||
"lodash": "^4.17.11",
|
||||
|
@@ -77,7 +77,7 @@ export const constants = {
|
||||
ZERO_AMOUNT: new BigNumber(0),
|
||||
PERCENTAGE_DENOMINATOR: new BigNumber(10).pow(18),
|
||||
TIME_BUFFER: new BigNumber(1000),
|
||||
KECCAK256_NULL: ethUtil.addHexPrefix(ethUtil.bufferToHex(ethUtil.SHA3_NULL)),
|
||||
KECCAK256_NULL: ethUtil.bufferToHex(ethUtil.keccak256(Buffer.alloc(0))),
|
||||
MAX_UINT256_ROOT: new BigNumber('340282366920938463463374607431768211456'),
|
||||
ONE_ETHER: new BigNumber(1e18),
|
||||
EIP712_DOMAIN_NAME: '0x Protocol',
|
||||
|
@@ -20,6 +20,7 @@ export let providerConfigs: Web3Config = {
|
||||
shouldUseInProcessGanache: true,
|
||||
shouldAllowUnlimitedContractSize: true,
|
||||
hardfork: 'istanbul',
|
||||
gasLimit: 100e6,
|
||||
unlocked_accounts: [
|
||||
'0x6cc5f688a315f3dc28a7781717a9a798a59fda7b',
|
||||
'0x55dc8f21d20d4c6ed3c82916a438a413ca68e335',
|
||||
|
@@ -57,9 +57,7 @@ describe('Order hashing', () => {
|
||||
...order,
|
||||
takerAddress: (null as any) as string,
|
||||
};
|
||||
const expectedErrorMessage = `Order taker must be of type string. If you want anyone to be able to fill an order - pass ${
|
||||
constants.NULL_ADDRESS
|
||||
}`;
|
||||
const expectedErrorMessage = `Expected order to conform to schema`;
|
||||
expect(() => orderHashUtils.getOrderHashHex(orderWithInvalidtakerFormat)).to.throw(expectedErrorMessage);
|
||||
});
|
||||
});
|
||||
|
@@ -1,4 +1,32 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1620214333,
|
||||
"version": "1.1.6",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "1.1.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Patched votingPower logic",
|
||||
"pr": 214
|
||||
}
|
||||
],
|
||||
"timestamp": 1619825976
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "1.1.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619481586,
|
||||
"version": "1.1.3",
|
||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.1.6 - _May 5, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.1.5 - _April 30, 2021_
|
||||
|
||||
* Patched votingPower logic (#214)
|
||||
|
||||
## v1.1.4 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.1.3 - _April 26, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -30,6 +30,7 @@ interface IZrxTreasury {
|
||||
uint256 votingPeriod;
|
||||
uint256 proposalThreshold;
|
||||
uint256 quorumThreshold;
|
||||
bytes32 defaultPoolId;
|
||||
}
|
||||
|
||||
struct ProposedAction {
|
||||
|
@@ -20,8 +20,6 @@
|
||||
pragma solidity ^0.6.12;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
|
||||
import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
|
||||
import "@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol";
|
||||
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
|
||||
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
|
||||
@@ -32,7 +30,6 @@ import "./IZrxTreasury.sol";
|
||||
contract ZrxTreasury is
|
||||
IZrxTreasury
|
||||
{
|
||||
using LibERC20TokenV06 for IERC20TokenV06;
|
||||
using LibSafeMathV06 for uint256;
|
||||
using LibRichErrorsV06 for bytes;
|
||||
using LibBytesV06 for bytes;
|
||||
@@ -52,11 +49,9 @@ contract ZrxTreasury is
|
||||
/// @dev Initializes the ZRX treasury and creates the default
|
||||
/// staking pool.
|
||||
/// @param stakingProxy_ The 0x staking proxy contract.
|
||||
/// @param weth_ The WETH token contract.
|
||||
/// @param params Immutable treasury parameters.
|
||||
constructor(
|
||||
IStaking stakingProxy_,
|
||||
IERC20TokenV06 weth_,
|
||||
TreasuryParameters memory params
|
||||
)
|
||||
public
|
||||
@@ -66,15 +61,12 @@ contract ZrxTreasury is
|
||||
"VOTING_PERIOD_TOO_LONG"
|
||||
);
|
||||
stakingProxy = stakingProxy_;
|
||||
DefaultPoolOperator defaultPoolOperator_ = new DefaultPoolOperator(
|
||||
stakingProxy_,
|
||||
weth_
|
||||
);
|
||||
defaultPoolOperator = defaultPoolOperator_;
|
||||
defaultPoolId = defaultPoolOperator_.poolId();
|
||||
votingPeriod = params.votingPeriod;
|
||||
proposalThreshold = params.proposalThreshold;
|
||||
quorumThreshold = params.quorumThreshold;
|
||||
defaultPoolId = params.defaultPoolId;
|
||||
IStaking.Pool memory defaultPool = stakingProxy_.getStakingPool(params.defaultPoolId);
|
||||
defaultPoolOperator = DefaultPoolOperator(defaultPool.operator);
|
||||
}
|
||||
|
||||
// solhint-disable
|
||||
@@ -286,6 +278,12 @@ contract ZrxTreasury is
|
||||
|
||||
// Add voting power for operated staking pools.
|
||||
for (uint256 i = 0; i != operatedPoolIds.length; i++) {
|
||||
for (uint256 j = 0; j != i; j++) {
|
||||
require(
|
||||
operatedPoolIds[i] != operatedPoolIds[j],
|
||||
"getVotingPower/DUPLICATE_POOL_ID"
|
||||
);
|
||||
}
|
||||
IStaking.Pool memory pool = stakingProxy.getStakingPool(operatedPoolIds[i]);
|
||||
require(
|
||||
pool.operator == account,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-treasury",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.6",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -46,16 +46,16 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.21",
|
||||
"@0x/contract-addresses": "^6.0.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.9",
|
||||
"@0x/contracts-erc20": "^3.3.6",
|
||||
"@0x/contracts-gen": "^2.0.32",
|
||||
"@0x/contracts-staking": "^2.0.35",
|
||||
"@0x/contracts-test-utils": "^5.3.24",
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contract-addresses": "^6.1.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.11",
|
||||
"@0x/contracts-erc20": "^3.3.8",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-staking": "^2.0.37",
|
||||
"@0x/contracts-test-utils": "^5.4.0",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@types/isomorphic-fetch": "^0.0.35",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
@@ -72,15 +72,15 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.18",
|
||||
"@0x/protocol-utils": "^1.5.0",
|
||||
"@0x/subproviders": "^6.4.1",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"@0x/web3-wrapper": "^7.4.1",
|
||||
"ethereum-types": "^3.4.0",
|
||||
"ethereumjs-util": "^5.1.1"
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/protocol-utils": "^1.6.0",
|
||||
"@0x/subproviders": "^6.5.3",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"@0x/web3-wrapper": "^7.5.3",
|
||||
"ethereum-types": "^3.5.0",
|
||||
"ethereumjs-util": "^7.0.10"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -28,6 +28,7 @@ blockchainTests.resets('Treasury governance', env => {
|
||||
votingPeriod: new BigNumber(3).times(stakingConstants.ONE_DAY_IN_SECONDS),
|
||||
proposalThreshold: new BigNumber(100),
|
||||
quorumThreshold: new BigNumber(1000),
|
||||
defaultPoolId: stakingConstants.INITIAL_POOL_ID,
|
||||
};
|
||||
const PROPOSAL_DESCRIPTION = 'A very compelling proposal!';
|
||||
const TREASURY_BALANCE = constants.INITIAL_ERC20_BALANCE;
|
||||
@@ -135,6 +136,16 @@ blockchainTests.resets('Treasury governance', env => {
|
||||
.approve(erc20ProxyContract.address, constants.INITIAL_ERC20_ALLOWANCE)
|
||||
.awaitTransactionSuccessAsync({ from: delegator });
|
||||
|
||||
defaultPoolOperator = await DefaultPoolOperatorContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DefaultPoolOperator,
|
||||
env.provider,
|
||||
env.txDefaults,
|
||||
{ ...artifacts, ...erc20Artifacts },
|
||||
staking.address,
|
||||
weth.address,
|
||||
);
|
||||
defaultPoolId = stakingConstants.INITIAL_POOL_ID;
|
||||
|
||||
const createStakingPoolTx = staking.createStakingPool(stakingConstants.PPM, false);
|
||||
nonDefaultPoolId = await createStakingPoolTx.callAsync({ from: poolOperator });
|
||||
await createStakingPoolTx.awaitTransactionSuccessAsync({ from: poolOperator });
|
||||
@@ -145,9 +156,9 @@ blockchainTests.resets('Treasury governance', env => {
|
||||
env.txDefaults,
|
||||
{ ...artifacts, ...erc20Artifacts },
|
||||
staking.address,
|
||||
weth.address,
|
||||
TREASURY_PARAMS,
|
||||
);
|
||||
|
||||
await zrx.mint(TREASURY_BALANCE).awaitTransactionSuccessAsync();
|
||||
await zrx.transfer(treasury.address, TREASURY_BALANCE).awaitTransactionSuccessAsync();
|
||||
actions = [
|
||||
@@ -166,10 +177,6 @@ blockchainTests.resets('Treasury governance', env => {
|
||||
value: constants.ZERO_AMOUNT,
|
||||
},
|
||||
];
|
||||
|
||||
defaultPoolId = await treasury.defaultPoolId().callAsync();
|
||||
const defaultPoolOperatorAddress = await treasury.defaultPoolOperator().callAsync();
|
||||
defaultPoolOperator = new DefaultPoolOperatorContract(defaultPoolOperatorAddress, env.provider, env.txDefaults);
|
||||
});
|
||||
describe('getVotingPower()', () => {
|
||||
it('Unstaked ZRX has no voting power', async () => {
|
||||
@@ -222,6 +229,19 @@ blockchainTests.resets('Treasury governance', env => {
|
||||
const operatorVotingPower = await treasury.getVotingPower(poolOperator, [nonDefaultPoolId]).callAsync();
|
||||
expect(operatorVotingPower).to.bignumber.equal(TREASURY_PARAMS.proposalThreshold.dividedBy(2));
|
||||
});
|
||||
it('Reverts if given duplicate pool IDs', async () => {
|
||||
await staking.stake(TREASURY_PARAMS.proposalThreshold).awaitTransactionSuccessAsync({ from: delegator });
|
||||
await staking
|
||||
.moveStake(
|
||||
new StakeInfo(StakeStatus.Undelegated),
|
||||
new StakeInfo(StakeStatus.Delegated, nonDefaultPoolId),
|
||||
TREASURY_PARAMS.proposalThreshold,
|
||||
)
|
||||
.awaitTransactionSuccessAsync({ from: delegator });
|
||||
await fastForwardToNextEpochAsync();
|
||||
const tx = treasury.getVotingPower(poolOperator, [nonDefaultPoolId, nonDefaultPoolId]).callAsync();
|
||||
return expect(tx).to.revertWith('getVotingPower/DUPLICATE_POOL_ID');
|
||||
});
|
||||
it('Correctly sums voting power delegated to multiple pools', async () => {
|
||||
await staking
|
||||
.stake(TREASURY_PARAMS.proposalThreshold.times(2))
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1620214333,
|
||||
"version": "4.7.8",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "4.7.7",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1617311315,
|
||||
"version": "4.7.6",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v4.7.8 - _May 5, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.7.7 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.7.6 - _April 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-utils",
|
||||
"version": "4.7.6",
|
||||
"version": "4.7.8",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -50,15 +50,15 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/utils",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.21",
|
||||
"@0x/contracts-gen": "^2.0.32",
|
||||
"@0x/contracts-test-utils": "^5.3.24",
|
||||
"@0x/dev-utils": "^4.2.1",
|
||||
"@0x/order-utils": "^10.4.19",
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/web3-wrapper": "^7.4.1",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-test-utils": "^5.4.0",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/order-utils": "^10.4.21",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/web3-wrapper": "^7.5.3",
|
||||
"@types/bn.js": "^4.11.0",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
@@ -67,7 +67,7 @@
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^3.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"ethereumjs-util": "^7.0.10",
|
||||
"lodash": "^4.17.11",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^6.2.0",
|
||||
@@ -79,11 +79,11 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.18",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"bn.js": "^4.11.8",
|
||||
"ethereum-types": "^3.4.0"
|
||||
"ethereum-types": "^3.5.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -2,7 +2,6 @@ import { chaiSetup, constants, provider, txDefaults, web3Wrapper } from '@0x/con
|
||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||
import { BigNumber, hexUtils, signTypedDataUtils } from '@0x/utils';
|
||||
import * as chai from 'chai';
|
||||
import * as ethUtil from 'ethereumjs-util';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { artifacts } from './artifacts';
|
||||
@@ -78,7 +77,7 @@ describe('LibEIP712', () => {
|
||||
|
||||
// Hash the provided input to get the expected hash
|
||||
const input = '0x1901'.concat(unprefixedDomainHash.concat(unprefixedHashStruct));
|
||||
const expectedHash = '0x'.concat(ethUtil.sha3(input).toString('hex'));
|
||||
const expectedHash = hexUtils.hash(input);
|
||||
|
||||
// Get the actual hash by calling the smart contract
|
||||
const actualHash = await lib.externalHashEIP712Message(domainHash, hashStruct).callAsync();
|
||||
|
@@ -1,4 +1,55 @@
|
||||
[
|
||||
{
|
||||
"version": "0.24.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Add special selectors to selector collision test",
|
||||
"pr": 243
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.23.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Added ETH support to `MixinCurve`",
|
||||
"pr": 220
|
||||
},
|
||||
{
|
||||
"note": "Add Balancer V2 integration",
|
||||
"pr": 206
|
||||
}
|
||||
],
|
||||
"timestamp": 1620214333
|
||||
},
|
||||
{
|
||||
"timestamp": 1619830995,
|
||||
"version": "0.22.3",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619825976,
|
||||
"version": "0.22.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.22.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "bump feature version to 1.2",
|
||||
"pr": 213
|
||||
}
|
||||
],
|
||||
"timestamp": 1619596077
|
||||
},
|
||||
{
|
||||
"version": "0.22.0",
|
||||
"changes": [
|
||||
@@ -15,6 +66,10 @@
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
},
|
||||
{
|
||||
"note": "BSC Uniswap clones (ApeSwap, CafeSwap, CheeseSwap, JulSwap)",
|
||||
"pr": 208
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@@ -5,6 +5,23 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.23.0 - _May 5, 2021_
|
||||
|
||||
* Added ETH support to `MixinCurve` (#220)
|
||||
* Add Balancer V2 integration (#206)
|
||||
|
||||
## v0.22.3 - _May 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.22.2 - _April 30, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.22.1 - _April 28, 2021_
|
||||
|
||||
* bump feature version to 1.2 (#213)
|
||||
|
||||
## v0.22.0 - _April 26, 2021_
|
||||
|
||||
* Add order signer registry to NativeOrdersFeature (#195)
|
||||
@@ -12,6 +29,7 @@ CHANGELOG
|
||||
## v0.21.1 - _April 12, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
* BSC Uniswap clones (ApeSwap, CafeSwap, CheeseSwap, JulSwap) (#208)
|
||||
|
||||
## v0.21.0 - _April 1, 2021_
|
||||
|
||||
|
@@ -34,7 +34,7 @@ contract NativeOrdersFeature is
|
||||
/// @dev Name of this feature.
|
||||
string public constant override FEATURE_NAME = "LimitOrders";
|
||||
/// @dev Version of this feature.
|
||||
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 1, 0);
|
||||
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 2, 0);
|
||||
|
||||
constructor(
|
||||
address zeroExAddress,
|
||||
|
@@ -37,22 +37,44 @@ contract PancakeSwapFeature is
|
||||
/// @dev Name of this feature.
|
||||
string public constant override FEATURE_NAME = "PancakeSwapFeature";
|
||||
/// @dev Version of this feature.
|
||||
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 1);
|
||||
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 2);
|
||||
/// @dev WBNB contract.
|
||||
IEtherTokenV06 private immutable WBNB;
|
||||
|
||||
// 0xFF + address of the PancakeSwap factory contract.
|
||||
uint256 constant private FF_PANCAKESWAP_FACTORY = 0xffbcfccbde45ce874adcb698cc183debcf179528120000000000000000000000;
|
||||
// 0xFF + address of the PancakeSwapV2 factory contract.
|
||||
uint256 constant private FF_PANCAKESWAPV2_FACTORY = 0xffca143ce32fe78f1f7019d7d551a6402fc5350c730000000000000000000000;
|
||||
// 0xFF + address of the BakerySwap factory contract.
|
||||
uint256 constant private FF_BAKERYSWAP_FACTORY = 0xff01bf7c66c6bd861915cdaae475042d3c4bae16a70000000000000000000000;
|
||||
// 0xFF + address of the SushiSwap factory contract.
|
||||
uint256 constant private FF_SUSHISWAP_FACTORY = 0xffc35DADB65012eC5796536bD9864eD8773aBc74C40000000000000000000000;
|
||||
// 0xFF + address of the ApeSwap factory contract.
|
||||
uint256 constant private FF_APESWAP_FACTORY = 0xff0841bd0b734e4f5853f0dd8d7ea041c241fb0da60000000000000000000000;
|
||||
// 0xFF + address of the CafeSwap factory contract.
|
||||
uint256 constant private FF_CAFESWAP_FACTORY = 0xff3e708fdbe3ada63fc94f8f61811196f1302137ad0000000000000000000000;
|
||||
// 0xFF + address of the CheeseSwap factory contract.
|
||||
uint256 constant private FF_CHEESESWAP_FACTORY = 0xffdd538e4fd1b69b7863e1f741213276a6cf1efb3b0000000000000000000000;
|
||||
// 0xFF + address of the JulSwap factory contract.
|
||||
uint256 constant private FF_JULSWAP_FACTORY = 0xff553990f2cba90272390f62c5bdb1681ffc8996750000000000000000000000;
|
||||
|
||||
// Init code hash of the PancakeSwap pair contract.
|
||||
uint256 constant private PANCAKESWAP_PAIR_INIT_CODE_HASH = 0xd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66;
|
||||
// Init code hash of the PancakeSwapV2 pair contract.
|
||||
uint256 constant private PANCAKESWAPV2_PAIR_INIT_CODE_HASH = 0x00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5;
|
||||
// Init code hash of the BakerySwap pair contract.
|
||||
uint256 constant private BAKERYSWAP_PAIR_INIT_CODE_HASH = 0xe2e87433120e32c4738a7d8f3271f3d872cbe16241d67537139158d90bac61d3;
|
||||
// Init code hash of the SushiSwap pair contract.
|
||||
uint256 constant private SUSHISWAP_PAIR_INIT_CODE_HASH = 0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303;
|
||||
// Init code hash of the ApeSwap pair contract.
|
||||
uint256 constant private APESWAP_PAIR_INIT_CODE_HASH = 0xf4ccce374816856d11f00e4069e7cada164065686fbef53c6167a63ec2fd8c5b;
|
||||
// Init code hash of the CafeSwap pair contract.
|
||||
uint256 constant private CAFESWAP_PAIR_INIT_CODE_HASH = 0x90bcdb5d0bf0e8db3852b0b7d7e05cc8f7c6eb6d511213c5ba02d1d1dbeda8d3;
|
||||
// Init code hash of the CheeseSwap pair contract.
|
||||
uint256 constant private CHEESESWAP_PAIR_INIT_CODE_HASH = 0xf52c5189a89e7ca2ef4f19f2798e3900fba7a316de7cef6c5a9446621ba86286;
|
||||
// Init code hash of the JulSwap pair contract.
|
||||
uint256 constant private JULSWAP_PAIR_INIT_CODE_HASH = 0xb1e98e21a5335633815a8cfb3b580071c2e4561c50afd57a8746def9ed890b18;
|
||||
|
||||
// Mask of the lower 20 bytes of a bytes32.
|
||||
uint256 constant private ADDRESS_MASK = 0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff;
|
||||
// BNB pseudo-token address.
|
||||
@@ -258,7 +280,7 @@ contract PancakeSwapFeature is
|
||||
|
||||
// Call pair.swap()
|
||||
switch mload(0xA20) // fork
|
||||
case 1 {
|
||||
case 2 {
|
||||
mstore(0xB00, BAKERYSWAP_PAIR_SWAP_CALL_SELECTOR_32)
|
||||
}
|
||||
default {
|
||||
@@ -352,15 +374,40 @@ contract PancakeSwapFeature is
|
||||
mstore(0xB35, PANCAKESWAP_PAIR_INIT_CODE_HASH)
|
||||
}
|
||||
case 1 {
|
||||
mstore(0xB00, FF_PANCAKESWAPV2_FACTORY)
|
||||
mstore(0xB15, salt)
|
||||
mstore(0xB35, PANCAKESWAPV2_PAIR_INIT_CODE_HASH)
|
||||
}
|
||||
case 2 {
|
||||
mstore(0xB00, FF_BAKERYSWAP_FACTORY)
|
||||
mstore(0xB15, salt)
|
||||
mstore(0xB35, BAKERYSWAP_PAIR_INIT_CODE_HASH)
|
||||
}
|
||||
default {
|
||||
case 3 {
|
||||
mstore(0xB00, FF_SUSHISWAP_FACTORY)
|
||||
mstore(0xB15, salt)
|
||||
mstore(0xB35, SUSHISWAP_PAIR_INIT_CODE_HASH)
|
||||
}
|
||||
case 4 {
|
||||
mstore(0xB00, FF_APESWAP_FACTORY)
|
||||
mstore(0xB15, salt)
|
||||
mstore(0xB35, APESWAP_PAIR_INIT_CODE_HASH)
|
||||
}
|
||||
case 5 {
|
||||
mstore(0xB00, FF_CAFESWAP_FACTORY)
|
||||
mstore(0xB15, salt)
|
||||
mstore(0xB35, CAFESWAP_PAIR_INIT_CODE_HASH)
|
||||
}
|
||||
case 6 {
|
||||
mstore(0xB00, FF_CHEESESWAP_FACTORY)
|
||||
mstore(0xB15, salt)
|
||||
mstore(0xB35, CHEESESWAP_PAIR_INIT_CODE_HASH)
|
||||
}
|
||||
default {
|
||||
mstore(0xB00, FF_JULSWAP_FACTORY)
|
||||
mstore(0xB15, salt)
|
||||
mstore(0xB35, JULSWAP_PAIR_INIT_CODE_HASH)
|
||||
}
|
||||
pair := and(ADDRESS_MASK, keccak256(0xB00, 0x55))
|
||||
}
|
||||
|
||||
|
@@ -23,16 +23,21 @@ pragma experimental ABIEncoderV2;
|
||||
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
|
||||
|
||||
|
||||
/// @dev VIP PancakeSwap/BakerySwap/SushiSwap fill functions.
|
||||
/// @dev VIP PancakeSwap (and forks) fill functions.
|
||||
interface IPancakeSwapFeature {
|
||||
|
||||
enum ProtocolFork {
|
||||
PancakeSwap,
|
||||
PancakeSwapV2,
|
||||
BakerySwap,
|
||||
SushiSwap
|
||||
SushiSwap,
|
||||
ApeSwap,
|
||||
CafeSwap,
|
||||
CheeseSwap,
|
||||
JulSwap
|
||||
}
|
||||
|
||||
/// @dev Efficiently sell directly to PancakeSwap/BakerySwap/Sushiswap.
|
||||
/// @dev Efficiently sell directly to PancakeSwap (and forks).
|
||||
/// @param tokens Sell path.
|
||||
/// @param sellAmount of `tokens[0]` Amount to sell.
|
||||
/// @param minBuyAmount Minimum amount of `tokens[-1]` to buy.
|
||||
|
@@ -23,6 +23,7 @@ pragma experimental ABIEncoderV2;
|
||||
import "./IBridgeAdapter.sol";
|
||||
import "./BridgeProtocols.sol";
|
||||
import "./mixins/MixinBalancer.sol";
|
||||
import "./mixins/MixinBalancerV2.sol";
|
||||
import "./mixins/MixinBancor.sol";
|
||||
import "./mixins/MixinCoFiX.sol";
|
||||
import "./mixins/MixinCurve.sol";
|
||||
@@ -30,6 +31,7 @@ import "./mixins/MixinCryptoCom.sol";
|
||||
import "./mixins/MixinDodo.sol";
|
||||
import "./mixins/MixinDodoV2.sol";
|
||||
import "./mixins/MixinKyber.sol";
|
||||
import "./mixins/MixinKyberDmm.sol";
|
||||
import "./mixins/MixinMakerPSM.sol";
|
||||
import "./mixins/MixinMooniswap.sol";
|
||||
import "./mixins/MixinMStable.sol";
|
||||
@@ -38,11 +40,13 @@ import "./mixins/MixinOasis.sol";
|
||||
import "./mixins/MixinShell.sol";
|
||||
import "./mixins/MixinUniswap.sol";
|
||||
import "./mixins/MixinUniswapV2.sol";
|
||||
import "./mixins/MixinUniswapV3.sol";
|
||||
import "./mixins/MixinZeroExBridge.sol";
|
||||
|
||||
contract BridgeAdapter is
|
||||
IBridgeAdapter,
|
||||
MixinBalancer,
|
||||
MixinBalancerV2,
|
||||
MixinBancor,
|
||||
MixinCoFiX,
|
||||
MixinCurve,
|
||||
@@ -50,6 +54,7 @@ contract BridgeAdapter is
|
||||
MixinDodo,
|
||||
MixinDodoV2,
|
||||
MixinKyber,
|
||||
MixinKyberDmm,
|
||||
MixinMakerPSM,
|
||||
MixinMooniswap,
|
||||
MixinMStable,
|
||||
@@ -58,14 +63,16 @@ contract BridgeAdapter is
|
||||
MixinShell,
|
||||
MixinUniswap,
|
||||
MixinUniswapV2,
|
||||
MixinUniswapV3,
|
||||
MixinZeroExBridge
|
||||
{
|
||||
constructor(IEtherTokenV06 weth)
|
||||
public
|
||||
MixinBalancer()
|
||||
MixinBalancerV2()
|
||||
MixinBancor(weth)
|
||||
MixinCoFiX()
|
||||
MixinCurve()
|
||||
MixinCurve(weth)
|
||||
MixinCryptoCom()
|
||||
MixinDodo()
|
||||
MixinDodoV2()
|
||||
@@ -78,6 +85,7 @@ contract BridgeAdapter is
|
||||
MixinShell()
|
||||
MixinUniswap(weth)
|
||||
MixinUniswapV2()
|
||||
MixinUniswapV3()
|
||||
MixinZeroExBridge()
|
||||
{}
|
||||
|
||||
@@ -99,6 +107,12 @@ contract BridgeAdapter is
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.UNISWAPV3) {
|
||||
boughtAmount = _tradeUniswapV3(
|
||||
sellToken,
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.UNISWAPV2) {
|
||||
boughtAmount = _tradeUniswapV2(
|
||||
buyToken,
|
||||
@@ -119,6 +133,13 @@ contract BridgeAdapter is
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.BALANCERV2) {
|
||||
boughtAmount = _tradeBalancerV2(
|
||||
sellToken,
|
||||
buyToken,
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.KYBER) {
|
||||
boughtAmount = _tradeKyber(
|
||||
sellToken,
|
||||
@@ -198,6 +219,12 @@ contract BridgeAdapter is
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.KYBERDMM) {
|
||||
boughtAmount = _tradeKyberDmm(
|
||||
buyToken,
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else {
|
||||
boughtAmount = _tradeZeroExBridge(
|
||||
sellToken,
|
||||
|
@@ -44,4 +44,7 @@ library BridgeProtocols {
|
||||
uint128 internal constant COFIX = 14;
|
||||
uint128 internal constant NERVE = 15;
|
||||
uint128 internal constant MAKERPSM = 16;
|
||||
uint128 internal constant BALANCERV2 = 17;
|
||||
uint128 internal constant UNISWAPV3 = 18;
|
||||
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;
|
||||
|
||||
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
|
||||
import "@0x/contracts-erc20/contracts/src/v06/IEtherTokenV06.sol";
|
||||
import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
|
||||
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
|
||||
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
|
||||
@@ -31,6 +32,15 @@ contract MixinCurve {
|
||||
using LibSafeMathV06 for uint256;
|
||||
using LibRichErrorsV06 for bytes;
|
||||
|
||||
/// @dev Mainnet address of the WETH contract.
|
||||
IEtherTokenV06 private immutable WETH;
|
||||
|
||||
constructor(IEtherTokenV06 weth)
|
||||
public
|
||||
{
|
||||
WETH = weth;
|
||||
}
|
||||
|
||||
|
||||
struct CurveBridgeData {
|
||||
address curveAddress;
|
||||
@@ -50,10 +60,17 @@ contract MixinCurve {
|
||||
{
|
||||
// Decode the bridge data to get the Curve metadata.
|
||||
CurveBridgeData memory data = abi.decode(bridgeData, (CurveBridgeData));
|
||||
sellToken.approveIfBelow(data.curveAddress, sellAmount);
|
||||
uint256 payableAmount;
|
||||
if (sellToken == WETH) {
|
||||
payableAmount = sellAmount;
|
||||
WETH.withdraw(sellAmount);
|
||||
} else {
|
||||
sellToken.approveIfBelow(data.curveAddress, sellAmount);
|
||||
}
|
||||
|
||||
uint256 beforeBalance = buyToken.balanceOf(address(this));
|
||||
(bool success, bytes memory resultData) =
|
||||
data.curveAddress.call(abi.encodeWithSelector(
|
||||
data.curveAddress.call{value: payableAmount}(abi.encodeWithSelector(
|
||||
data.exchangeFunctionSelector,
|
||||
data.fromCoinIdx,
|
||||
data.toCoinIdx,
|
||||
@@ -65,6 +82,12 @@ contract MixinCurve {
|
||||
if (!success) {
|
||||
resultData.rrevert();
|
||||
}
|
||||
|
||||
if (buyToken == WETH) {
|
||||
boughtAmount = address(this).balance;
|
||||
WETH.deposit{ value: boughtAmount }();
|
||||
}
|
||||
|
||||
return buyToken.balanceOf(address(this)).safeSub(beforeBalance);
|
||||
}
|
||||
}
|
||||
|
@@ -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 buyToken,
|
||||
uint256 sellAmount,
|
||||
uint256 minBoughtAmount,
|
||||
address recipient
|
||||
)
|
||||
external
|
||||
@@ -59,6 +60,8 @@ contract MixinMStable {
|
||||
sellToken,
|
||||
buyToken,
|
||||
sellAmount,
|
||||
// Minimum buy amount.
|
||||
1,
|
||||
address(this)
|
||||
);
|
||||
}
|
||||
|
@@ -69,7 +69,7 @@ contract MixinUniswapV2 {
|
||||
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(
|
||||
path[path.length - 1] == buyToken,
|
||||
"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",
|
||||
"version": "0.22.0",
|
||||
"version": "0.23.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -43,7 +43,7 @@
|
||||
"config": {
|
||||
"publicInterfaceContracts": "IZeroEx,ZeroEx,FullMigration,InitialMigration,IFlashWallet,IERC20Transformer,IOwnableFeature,ISimpleFunctionRegistryFeature,ITransformERC20Feature,FillQuoteTransformer,PayTakerTransformer,PositiveSlippageFeeTransformer,WethTransformer,OwnableFeature,SimpleFunctionRegistryFeature,TransformERC20Feature,AffiliateFeeTransformer,MetaTransactionsFeature,LogMetadataTransformer,BridgeAdapter,LiquidityProviderFeature,ILiquidityProviderFeature,NativeOrdersFeature,INativeOrdersFeature,FeeCollectorController,FeeCollector,CurveLiquidityProvider,BatchFillNativeOrdersFeature,IBatchFillNativeOrdersFeature,MultiplexFeature,IMultiplexFeature",
|
||||
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
|
||||
"abis": "./test/generated-artifacts/@(AffiliateFeeTransformer|BatchFillNativeOrdersFeature|BootstrapFeature|BridgeAdapter|BridgeProtocols|CurveLiquidityProvider|FeeCollector|FeeCollectorController|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinProtocolFees|FixinReentrancyGuard|FixinTokenSpender|FlashWallet|FullMigration|IBatchFillNativeOrdersFeature|IBootstrapFeature|IBridgeAdapter|IERC20Bridge|IERC20Transformer|IFeature|IFlashWallet|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IMooniswapPool|IMultiplexFeature|INativeOrdersEvents|INativeOrdersFeature|IOwnableFeature|IPancakeSwapFeature|ISimpleFunctionRegistryFeature|IStaking|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IUniswapV2Pair|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC20Transformer|LibFeeCollector|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibNativeOrder|LibNativeOrdersRichErrors|LibNativeOrdersStorage|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinBalancer|MixinBancor|MixinCoFiX|MixinCryptoCom|MixinCurve|MixinDodo|MixinDodoV2|MixinKyber|MixinMStable|MixinMakerPSM|MixinMooniswap|MixinNerve|MixinOasis|MixinShell|MixinUniswap|MixinUniswapV2|MixinZeroExBridge|MooniswapLiquidityProvider|MultiplexFeature|NativeOrdersCancellation|NativeOrdersFeature|NativeOrdersInfo|NativeOrdersProtocolFees|NativeOrdersSettlement|OwnableFeature|PancakeSwapFeature|PayTakerTransformer|PermissionlessTransformerDeployer|PositiveSlippageFeeTransformer|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestCurve|TestDelegateCaller|TestFeeCollectorController|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFixinProtocolFees|TestFixinTokenSpender|TestFullMigration|TestInitialMigration|TestLibNativeOrder|TestLibSignature|TestLiquidityProvider|TestMetaTransactionsNativeOrdersFeature|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC20Token|TestMooniswap|TestNativeOrdersFeature|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": {
|
||||
"type": "git",
|
||||
@@ -55,16 +55,16 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.21",
|
||||
"@0x/contract-addresses": "^6.0.0",
|
||||
"@0x/contracts-erc20": "^3.3.6",
|
||||
"@0x/contracts-gen": "^2.0.32",
|
||||
"@0x/contracts-test-utils": "^5.3.24",
|
||||
"@0x/dev-utils": "^4.2.1",
|
||||
"@0x/order-utils": "^10.4.19",
|
||||
"@0x/sol-compiler": "^4.6.1",
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contract-addresses": "^6.1.0",
|
||||
"@0x/contracts-erc20": "^3.3.8",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-test-utils": "^5.4.0",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/order-utils": "^10.4.21",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@types/isomorphic-fetch": "^0.0.35",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
@@ -82,15 +82,15 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.18",
|
||||
"@0x/protocol-utils": "^1.5.0",
|
||||
"@0x/subproviders": "^6.4.1",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/utils": "^6.2.0",
|
||||
"@0x/web3-wrapper": "^7.4.1",
|
||||
"ethereum-types": "^3.4.0",
|
||||
"ethereumjs-util": "^5.1.1"
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/protocol-utils": "^1.6.0",
|
||||
"@0x/subproviders": "^6.5.3",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
"@0x/utils": "^6.4.3",
|
||||
"@0x/web3-wrapper": "^7.5.3",
|
||||
"ethereum-types": "^3.5.0",
|
||||
"ethereumjs-util": "^7.0.10"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -20,6 +20,7 @@ export function rlpEncodeNonce(nonce: number): string {
|
||||
return ethjs.bufferToHex(ethjs.toBuffer(nonce));
|
||||
} else {
|
||||
const rlpNonce = ethjs.toBuffer(nonce);
|
||||
// tslint:disable-next-line: restrict-plus-operands
|
||||
return hexUtils.concat(rlpNonce.length + 0x80, ethjs.bufferToHex(rlpNonce));
|
||||
}
|
||||
}
|
||||
|
@@ -76,6 +76,7 @@ import * as LiquidityProviderSandbox from '../test/generated-artifacts/Liquidity
|
||||
import * as LogMetadataTransformer from '../test/generated-artifacts/LogMetadataTransformer.json';
|
||||
import * as MetaTransactionsFeature from '../test/generated-artifacts/MetaTransactionsFeature.json';
|
||||
import * as MixinBalancer from '../test/generated-artifacts/MixinBalancer.json';
|
||||
import * as MixinBalancerV2 from '../test/generated-artifacts/MixinBalancerV2.json';
|
||||
import * as MixinBancor from '../test/generated-artifacts/MixinBancor.json';
|
||||
import * as MixinCoFiX from '../test/generated-artifacts/MixinCoFiX.json';
|
||||
import * as MixinCryptoCom from '../test/generated-artifacts/MixinCryptoCom.json';
|
||||
@@ -83,6 +84,7 @@ import * as MixinCurve from '../test/generated-artifacts/MixinCurve.json';
|
||||
import * as MixinDodo from '../test/generated-artifacts/MixinDodo.json';
|
||||
import * as MixinDodoV2 from '../test/generated-artifacts/MixinDodoV2.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 MixinMooniswap from '../test/generated-artifacts/MixinMooniswap.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 MixinUniswap from '../test/generated-artifacts/MixinUniswap.json';
|
||||
import * as MixinUniswapV2 from '../test/generated-artifacts/MixinUniswapV2.json';
|
||||
import * as MixinUniswapV3 from '../test/generated-artifacts/MixinUniswapV3.json';
|
||||
import * as MixinZeroExBridge from '../test/generated-artifacts/MixinZeroExBridge.json';
|
||||
import * as MooniswapLiquidityProvider from '../test/generated-artifacts/MooniswapLiquidityProvider.json';
|
||||
import * as MultiplexFeature from '../test/generated-artifacts/MultiplexFeature.json';
|
||||
@@ -235,6 +238,7 @@ export const artifacts = {
|
||||
BridgeProtocols: BridgeProtocols as ContractArtifact,
|
||||
IBridgeAdapter: IBridgeAdapter as ContractArtifact,
|
||||
MixinBalancer: MixinBalancer as ContractArtifact,
|
||||
MixinBalancerV2: MixinBalancerV2 as ContractArtifact,
|
||||
MixinBancor: MixinBancor as ContractArtifact,
|
||||
MixinCoFiX: MixinCoFiX as ContractArtifact,
|
||||
MixinCryptoCom: MixinCryptoCom as ContractArtifact,
|
||||
@@ -242,6 +246,7 @@ export const artifacts = {
|
||||
MixinDodo: MixinDodo as ContractArtifact,
|
||||
MixinDodoV2: MixinDodoV2 as ContractArtifact,
|
||||
MixinKyber: MixinKyber as ContractArtifact,
|
||||
MixinKyberDmm: MixinKyberDmm as ContractArtifact,
|
||||
MixinMStable: MixinMStable as ContractArtifact,
|
||||
MixinMakerPSM: MixinMakerPSM as ContractArtifact,
|
||||
MixinMooniswap: MixinMooniswap as ContractArtifact,
|
||||
@@ -250,6 +255,7 @@ export const artifacts = {
|
||||
MixinShell: MixinShell as ContractArtifact,
|
||||
MixinUniswap: MixinUniswap as ContractArtifact,
|
||||
MixinUniswapV2: MixinUniswapV2 as ContractArtifact,
|
||||
MixinUniswapV3: MixinUniswapV3 as ContractArtifact,
|
||||
MixinZeroExBridge: MixinZeroExBridge as ContractArtifact,
|
||||
ILiquidityProvider: ILiquidityProvider as ContractArtifact,
|
||||
IMooniswapPool: IMooniswapPool as ContractArtifact,
|
||||
|
@@ -3,9 +3,14 @@ import { MethodAbi } from 'ethereum-types';
|
||||
|
||||
import * as wrappers from '../../src/wrappers';
|
||||
|
||||
// tslint:disable:no-string-literal
|
||||
|
||||
blockchainTests('Selector collision test', env => {
|
||||
it('Function selectors do not collide', () => {
|
||||
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)) {
|
||||
if (typeof wrapper === 'function') {
|
||||
const contract = new wrapper(constants.NULL_ADDRESS, env.provider, env.txDefaults);
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { blockchainTests, expect, verifyEventsFromLogs } from '@0x/contracts-test-utils';
|
||||
import { BigNumber, hexUtils } from '@0x/utils';
|
||||
import * as ethjs from 'ethereumjs-util';
|
||||
|
||||
import { artifacts } from './artifacts';
|
||||
import {
|
||||
@@ -41,9 +40,9 @@ blockchainTests.resets('PermissionlessTransformerDeployer', env => {
|
||||
it('deploys at predictable address', async () => {
|
||||
const salt = hexUtils.random();
|
||||
const targetAddress = await deployer.deploy(deployBytes, salt).callAsync();
|
||||
const initCodeHash = hexUtils.toHex(ethjs.sha3(deployBytes));
|
||||
const initCodeHash = hexUtils.hash(deployBytes);
|
||||
const expectedAddress = hexUtils.slice(
|
||||
hexUtils.toHex(ethjs.sha3(hexUtils.concat('0xFF', deployer.address, salt, initCodeHash))),
|
||||
hexUtils.hash(hexUtils.concat('0xFF', deployer.address, salt, initCodeHash)),
|
||||
12,
|
||||
);
|
||||
|
||||
@@ -94,7 +93,7 @@ blockchainTests.resets('PermissionlessTransformerDeployer', env => {
|
||||
const targetAddress = await deployer.deploy(deployBytes, salt).callAsync({ from: sender });
|
||||
await deployer.deploy(deployBytes, salt).awaitTransactionSuccessAsync({ from: sender });
|
||||
expect(hexUtils.toHex(await deployer.toInitCodeHash(targetAddress).callAsync())).to.eq(
|
||||
hexUtils.toHex(ethjs.sha3(deployBytes)),
|
||||
hexUtils.hash(deployBytes),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@@ -74,6 +74,7 @@ export * from '../test/generated-wrappers/liquidity_provider_sandbox';
|
||||
export * from '../test/generated-wrappers/log_metadata_transformer';
|
||||
export * from '../test/generated-wrappers/meta_transactions_feature';
|
||||
export * from '../test/generated-wrappers/mixin_balancer';
|
||||
export * from '../test/generated-wrappers/mixin_balancer_v2';
|
||||
export * from '../test/generated-wrappers/mixin_bancor';
|
||||
export * from '../test/generated-wrappers/mixin_co_fi_x';
|
||||
export * from '../test/generated-wrappers/mixin_crypto_com';
|
||||
@@ -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_v2';
|
||||
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_maker_p_s_m';
|
||||
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_uniswap';
|
||||
export * from '../test/generated-wrappers/mixin_uniswap_v2';
|
||||
export * from '../test/generated-wrappers/mixin_uniswap_v3';
|
||||
export * from '../test/generated-wrappers/mixin_zero_ex_bridge';
|
||||
export * from '../test/generated-wrappers/mooniswap_liquidity_provider';
|
||||
export * from '../test/generated-wrappers/multiplex_feature';
|
||||
|
@@ -105,6 +105,7 @@
|
||||
"test/generated-artifacts/LogMetadataTransformer.json",
|
||||
"test/generated-artifacts/MetaTransactionsFeature.json",
|
||||
"test/generated-artifacts/MixinBalancer.json",
|
||||
"test/generated-artifacts/MixinBalancerV2.json",
|
||||
"test/generated-artifacts/MixinBancor.json",
|
||||
"test/generated-artifacts/MixinCoFiX.json",
|
||||
"test/generated-artifacts/MixinCryptoCom.json",
|
||||
@@ -112,6 +113,7 @@
|
||||
"test/generated-artifacts/MixinDodo.json",
|
||||
"test/generated-artifacts/MixinDodoV2.json",
|
||||
"test/generated-artifacts/MixinKyber.json",
|
||||
"test/generated-artifacts/MixinKyberDmm.json",
|
||||
"test/generated-artifacts/MixinMStable.json",
|
||||
"test/generated-artifacts/MixinMakerPSM.json",
|
||||
"test/generated-artifacts/MixinMooniswap.json",
|
||||
@@ -120,6 +122,7 @@
|
||||
"test/generated-artifacts/MixinShell.json",
|
||||
"test/generated-artifacts/MixinUniswap.json",
|
||||
"test/generated-artifacts/MixinUniswapV2.json",
|
||||
"test/generated-artifacts/MixinUniswapV3.json",
|
||||
"test/generated-artifacts/MixinZeroExBridge.json",
|
||||
"test/generated-artifacts/MooniswapLiquidityProvider.json",
|
||||
"test/generated-artifacts/MultiplexFeature.json",
|
||||
|
46
docs/additional/audits.md
Normal file
46
docs/additional/audits.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
title: Audits
|
||||
---
|
||||
|
||||
Below are links to our third-party audit reports.
|
||||
|
||||
+---------+------------------------------------------------------------+
|
||||
| **Re | **Reports** |
|
||||
| lease** | |
|
||||
+---------+------------------------------------------------------------+
|
||||
| E | - [Consensys Diligence |
|
||||
| xchange | (December 2020)](https |
|
||||
| V4 | ://consensys.net/diligence/audits/2020/12/0x-exchange-v4/) |
|
||||
+---------+------------------------------------------------------------+
|
||||
| E | - [Trail of |
|
||||
| xchange | Bits](http://zeips.0x.org.s3-website. |
|
||||
| V3 | us-east-2.amazonaws.com/audits/56/trail-of-bits/audit.pdf) |
|
||||
| | - [Consensys Diligence |
|
||||
| | (Exchange)](https |
|
||||
| | ://diligence.consensys.net/audits/2019/09/0x-v3-exchange/) |
|
||||
| | - [Consensys Diligence |
|
||||
| | (Staking)](http |
|
||||
| | s://diligence.consensys.net/audits/2019/10/0x-v3-staking/) |
|
||||
+---------+------------------------------------------------------------+
|
||||
| E | - [First](https://docs.google.com/doc |
|
||||
| xchange | ument/d/1jYv6V21MfCSwCS5fxD6ZyaLWGzkpRSUO0lZpST94XsA/edit) |
|
||||
| V2.1 | - [Consensys |
|
||||
| | Diligence |
|
||||
| | ](https://github.com/ConsenSys/0x_audit_report_2018-07-23) |
|
||||
+---------+------------------------------------------------------------+
|
||||
| M | - [Consensys |
|
||||
| ultiAss | Dilige |
|
||||
| etProxy | nce](https://github.com/ConsenSys/0x-audit-report-2018-12) |
|
||||
+---------+------------------------------------------------------------+
|
||||
| ERC11 | - [Consensys |
|
||||
| 55Proxy | Dilige |
|
||||
| | nce](https://github.com/ConsenSys/0x-audit-report-2019-05) |
|
||||
+---------+------------------------------------------------------------+
|
||||
| S | - No third-party audit. |
|
||||
| taticCa | |
|
||||
| llProxy | |
|
||||
+---------+------------------------------------------------------------+
|
||||
| ER | - No third-party audit. |
|
||||
| C20Brid | |
|
||||
| geProxy | |
|
||||
+---------+------------------------------------------------------------+
|
252
docs/additional/bounties.md
Normal file
252
docs/additional/bounties.md
Normal file
@@ -0,0 +1,252 @@
|
||||
---
|
||||
title: Bounties
|
||||
---
|
||||
|
||||
We run an ongoing bug bounty for the 0x Protocol smart contracts! The
|
||||
program is open to anyone and rewards up to **\$100,000 for critical
|
||||
exploits**. The scope and disclosure instructions are below.
|
||||
|
||||
# Rewards
|
||||
|
||||
The severity of reported vulnerabilities will be graded according to the
|
||||
[CVSS](https://www.first.org/cvss/) (Common Vulnerability Scoring
|
||||
Standard). The following table will serve as a guideline for reward
|
||||
decisions:
|
||||
|
||||
---------------------------- ---------------------
|
||||
**Exploit Score** **Reward**
|
||||
|
||||
Critical (CVSS 9.0 - 10.0) \$10,000 - \$100,000
|
||||
|
||||
High (CVSS 7.0 - 8.9) \$2,500 - \$10,000
|
||||
|
||||
Medium (CVSS 4.0 - 6.9) \$1,000 - \$2,500
|
||||
|
||||
Low (CVSS 0.0 - 3.9) \$0 - \$1,000
|
||||
---------------------------- ---------------------
|
||||
|
||||
Please note that any rewards will ultimately be awarded at the
|
||||
discretion of ZeroEx Intl. All rewards will be paid out in ZRX.
|
||||
|
||||
# Areas of Interest
|
||||
|
||||
+----------+-----------------------------------------------------------+
|
||||
| **Area** | **Examples** |
|
||||
+----------+-----------------------------------------------------------+
|
||||
| Loss of | - A user loses funds in a way that they did not |
|
||||
| funds | explicitly authorize (e.g an account is able to gain |
|
||||
| | access to an `AssetProxy` and drain user funds). |
|
||||
| | - A user authorized a transaction or trade but spends |
|
||||
| | more assets than normally expected (e.g an order is |
|
||||
| | allowed to be over-filled). |
|
||||
+----------+-----------------------------------------------------------+
|
||||
| Un | - A user is able to update the state of a contract such |
|
||||
| intended | that it is no longer useable (e.g permanently lock a |
|
||||
| contract | mutex). |
|
||||
| state | - Any assets get unexpectedly \"stuck\" in a contract |
|
||||
| | with regular use of the contract\'s public methods. |
|
||||
| | - An action taken in the staking contracts is applied |
|
||||
| | to an incorrect epoch. |
|
||||
+----------+-----------------------------------------------------------+
|
||||
| B | - The `ZeroExGovernor` is allowed to bypass the |
|
||||
| ypassing | timelock for transactions where it is not explicitly |
|
||||
| time | allowed to do so. |
|
||||
| locks | - A user is allowed to bypass the `ZeroExGovernor`. |
|
||||
+----------+-----------------------------------------------------------+
|
||||
| I | - Overflows or underflow result in unexpected behavior. |
|
||||
| ncorrect | - The staking reward payouts are incorrect. |
|
||||
| math | |
|
||||
+----------+-----------------------------------------------------------+
|
||||
|
||||
# Scope
|
||||
|
||||
The following contracts are in scope of the bug bounty. Please note that
|
||||
any bugs already reported are considered out of scope. See the
|
||||
[Audits](./audits.html) page for 3rd party security reports.
|
||||
|
||||
+---+---------------------------------------------+--------------------+
|
||||
| * | **Contracts** | **Commit Hash** |
|
||||
| * | | |
|
||||
| R | | |
|
||||
| e | | |
|
||||
| l | | |
|
||||
| e | | |
|
||||
| a | | |
|
||||
| s | | |
|
||||
| e | | |
|
||||
| * | | |
|
||||
| * | | |
|
||||
+---+---------------------------------------------+--------------------+
|
||||
| E | - Documentation at | [72 |
|
||||
| x | <ht | a74e7c66](https:// |
|
||||
| c | tps://0xprotocol.readthedocs.io/en/latest/> | github.com/0xProje |
|
||||
| h | - [ZeroEx.sol | ct/protocol/tree/7 |
|
||||
| a | ](https://github.com/0xProject/protocol/blo | 2a74e7c66e27da02dd |
|
||||
| n | b/72a74e7c66e27da02dd9f4ce604ad057c740c304/ | 9f4ce604ad057c740c |
|
||||
| g | contracts/zero-ex/contracts/src/ZeroEx.sol) | 304/contracts/zero |
|
||||
| e | - [ZeroExOptimized.sol](https:/ | -ex/contracts/src) |
|
||||
| V | /github.com/0xProject/protocol/blob/72a74e7 | |
|
||||
| 4 | c66e27da02dd9f4ce604ad057c740c304/contracts | |
|
||||
| | /zero-ex/contracts/src/ZeroExOptimized.sol) | |
|
||||
| | - [external/\*.s | |
|
||||
| | ol](https://github.com/0xProject/protocol/t | |
|
||||
| | ree/72a74e7c66e27da02dd9f4ce604ad057c740c30 | |
|
||||
| | 4/contracts/zero-ex/contracts/src/external) | |
|
||||
| | - [features/\*\*.s | |
|
||||
| | ol](https://github.com/0xProject/protocol/t | |
|
||||
| | ree/72a74e7c66e27da02dd9f4ce604ad057c740c30 | |
|
||||
| | 4/contracts/zero-ex/contracts/src/features) | |
|
||||
| | - [fixins/\* | |
|
||||
| | .sol](https://github.com/0xProject/protocol | |
|
||||
| | /tree/72a74e7c66e27da02dd9f4ce604ad057c740c | |
|
||||
| | 304/contracts/zero-ex/contracts/src/fixins) | |
|
||||
| | - [migrations/\*.sol | |
|
||||
| | ](https://github.com/0xProject/protocol/tre | |
|
||||
| | e/72a74e7c66e27da02dd9f4ce604ad057c740c304/ | |
|
||||
| | contracts/zero-ex/contracts/src/migrations) | |
|
||||
| | - [storage/\*. | |
|
||||
| | sol](https://github.com/0xProject/protocol/ | |
|
||||
| | tree/72a74e7c66e27da02dd9f4ce604ad057c740c3 | |
|
||||
| | 04/contracts/zero-ex/contracts/src/storage) | |
|
||||
+---+---------------------------------------------+--------------------+
|
||||
| E | - [ERC20BridgeProxy.sol](https://github. | [f |
|
||||
| x | com/0xProject/0x-monorepo/blob/fb8360edfd4f | b8360edfd](https:/ |
|
||||
| c | 42f2d2b127b95c156eb1b0daa02b/contracts/asse | /github.com/0xProj |
|
||||
| h | t-proxy/contracts/src/ERC20BridgeProxy.sol) | ect/0x-monorepo/tr |
|
||||
| a | ([spec](https://github.c | ee/fb8360edfd4f42f |
|
||||
| n | om/0xProject/0x-protocol-specification/blob | 2d2b127b95c156eb1b |
|
||||
| g | /master/asset-proxy/erc20-bridge-proxy.md)) | 0daa02b/contracts) |
|
||||
| e | - [Exchange.sol](http | |
|
||||
| V | s://github.com/0xProject/0x-monorepo/blob/f | |
|
||||
| 3 | b8360edfd4f42f2d2b127b95c156eb1b0daa02b/con | |
|
||||
| | tracts/exchange/contracts/src/Exchange.sol) | |
|
||||
| | ([spec](https | |
|
||||
| | ://github.com/0xProject/0x-protocol-specifi | |
|
||||
| | cation/blob/master/v3/v3-specification.md)) | |
|
||||
| | - [ZeroExGovernor.sol](https://gi | |
|
||||
| | thub.com/0xProject/0x-monorepo/blob/fb8360e | |
|
||||
| | dfd4f42f2d2b127b95c156eb1b0daa02b/contracts | |
|
||||
| | /multisig/contracts/src/ZeroExGovernor.sol) | |
|
||||
| | ([spec](https | |
|
||||
| | ://github.com/0xProject/0x-protocol-specifi | |
|
||||
| | cation/blob/master/v3/zero-ex-governor.md)) | |
|
||||
| | - [Staking.sol](ht | |
|
||||
| | tps://github.com/0xProject/0x-monorepo/blob | |
|
||||
| | /fb8360edfd4f42f2d2b127b95c156eb1b0daa02b/c | |
|
||||
| | ontracts/staking/contracts/src/Staking.sol) | |
|
||||
| | ([spec](https://github. | |
|
||||
| | com/0xProject/0x-protocol-specification/blo | |
|
||||
| | b/master/staking/staking-specification.md)) | |
|
||||
| | - [StakingProxy.sol](https:/ | |
|
||||
| | /github.com/0xProject/0x-monorepo/blob/fb83 | |
|
||||
| | 60edfd4f42f2d2b127b95c156eb1b0daa02b/contra | |
|
||||
| | cts/staking/contracts/src/StakingProxy.sol) | |
|
||||
| | ([spec](https://github. | |
|
||||
| | com/0xProject/0x-protocol-specification/blo | |
|
||||
| | b/master/staking/staking-specification.md)) | |
|
||||
| | - [ZrxVault.sol](htt | |
|
||||
| | ps://github.com/0xProject/0x-monorepo/blob/ | |
|
||||
| | fb8360edfd4f42f2d2b127b95c156eb1b0daa02b/co | |
|
||||
| | ntracts/staking/contracts/src/ZrxVault.sol) | |
|
||||
| | ([spec](https://github. | |
|
||||
| | com/0xProject/0x-protocol-specification/blo | |
|
||||
| | b/master/staking/staking-specification.md)) | |
|
||||
+---+---------------------------------------------+--------------------+
|
||||
| E | - [src/2.0.0/protoc | [f |
|
||||
| x | ol](https://github.com/0xProject/0x-monorep | f70c5ecfe](https:/ |
|
||||
| c | o/tree/ff70c5ecfe28eff14e1a372c5e493b8f5363 | /github.com/0xProj |
|
||||
| h | e1d0/packages/contracts/src/2.0.0/protocol) | ect/0x-monorepo/tr |
|
||||
| a | - [src/2.0.0/ | ee/ff70c5ecfe28eff |
|
||||
| n | utils](https://github.com/0xProject/0x-mono | 14e1a372c5e493b8f5 |
|
||||
| g | repo/tree/ff70c5ecfe28eff14e1a372c5e493b8f5 | 363e1d0/contracts) |
|
||||
| e | 363e1d0/packages/contracts/src/2.0.0/utils) | |
|
||||
| V | | |
|
||||
| 2 | | |
|
||||
| . | | |
|
||||
| 1 | | |
|
||||
+---+---------------------------------------------+--------------------+
|
||||
| M | - [MultiAssetProxy.sol](https://github | [c |
|
||||
| u | .com/0xProject/0x-monorepo/blob/c4d9ef9f835 | 4d9ef9f83](https:/ |
|
||||
| l | 08154fe9db35796b6b86aeb0f2240/contracts/ass | /github.com/0xProj |
|
||||
| t | et-proxy/contracts/src/MultiAssetProxy.sol) | ect/0x-monorepo/tr |
|
||||
| i | | ee/c4d9ef9f8350815 |
|
||||
| A | | 4fe9db35796b6b86ae |
|
||||
| s | | b0f2240/contracts) |
|
||||
| s | | |
|
||||
| e | | |
|
||||
| t | | |
|
||||
| P | | |
|
||||
| r | | |
|
||||
| o | | |
|
||||
| x | | |
|
||||
| y | | |
|
||||
+---+---------------------------------------------+--------------------+
|
||||
| E | - [ERC1155Proxy.sol](https://git | [7 |
|
||||
| R | hub.com/0xProject/0x-monorepo/blob/77484dc6 | 7484dc69e](https:/ |
|
||||
| C | 9eea1f4f1a8397590199f3f2489751d2/contracts/ | /github.com/0xProj |
|
||||
| 1 | asset-proxy/contracts/src/ERC1155Proxy.sol) | ect/0x-monorepo/tr |
|
||||
| 1 | | ee/77484dc69eea1f4 |
|
||||
| 5 | | f1a8397590199f3f24 |
|
||||
| 5 | | 89751d2/contracts) |
|
||||
| P | | |
|
||||
| r | | |
|
||||
| o | | |
|
||||
| x | | |
|
||||
| y | | |
|
||||
+---+---------------------------------------------+--------------------+
|
||||
| S | - [StaticCallProxy.sol](https://github | [5 |
|
||||
| t | .com/0xProject/0x-monorepo/blob/54f4727adc6 | 4f4727adc](https:/ |
|
||||
| a | da95f312e3721f44857110555d24c/contracts/ass | /github.com/0xProj |
|
||||
| t | et-proxy/contracts/src/StaticCallProxy.sol) | ect/0x-monorepo/tr |
|
||||
| i | | ee/54f4727adc6da95 |
|
||||
| c | | f312e3721f44857110 |
|
||||
| C | | 555d24c/contracts) |
|
||||
| a | | |
|
||||
| l | | |
|
||||
| l | | |
|
||||
| P | | |
|
||||
| r | | |
|
||||
| o | | |
|
||||
| x | | |
|
||||
| y | | |
|
||||
+---+---------------------------------------------+--------------------+
|
||||
| E | - [ERC20BridgeProxy.sol](https://github. | [2 |
|
||||
| R | com/0xProject/0x-monorepo/blob/281658ba349a | 81658ba34](https:/ |
|
||||
| C | 2c5088b40b503998bea5020284a6/contracts/asse | /github.com/0xProj |
|
||||
| 2 | t-proxy/contracts/src/ERC20BridgeProxy.sol) | ect/0x-monorepo/tr |
|
||||
| 0 | | ee/281658ba349a2c5 |
|
||||
| B | | 088b40b503998bea50 |
|
||||
| r | | 20284a6/contracts) |
|
||||
| i | | |
|
||||
| d | | |
|
||||
| g | | |
|
||||
| e | | |
|
||||
| P | | |
|
||||
| r | | |
|
||||
| o | | |
|
||||
| x | | |
|
||||
| y | | |
|
||||
+---+---------------------------------------------+--------------------+
|
||||
| E | - [contracts/src](https://github.com/ | [7 |
|
||||
| x | 0xProject/0x-monorepo/tree/7967a8416c76e34f | 967a8416c](https:/ |
|
||||
| c | f5a0a4eb80e7b33ff8c0e297/contracts/zero-ex) | /github.com/0xProj |
|
||||
| h | | ect/0x-monorepo/tr |
|
||||
| a | | ee/7967a8416c76e34 |
|
||||
| n | | ff5a0a4eb80e7b33ff |
|
||||
| g | | 8c0e297/contracts) |
|
||||
| e | | |
|
||||
| P | | |
|
||||
| r | | |
|
||||
| o | | |
|
||||
| x | | |
|
||||
| y | | |
|
||||
+---+---------------------------------------------+--------------------+
|
||||
|
||||
# Disclosures
|
||||
|
||||
Please e-mail all submissions to <security@0x.org> with the subject
|
||||
\"BUG BOUNTY\". Your submission should include any steps required to
|
||||
reproduce or exploit the vulnerability. Please allow time for the
|
||||
vulnerability to be fixed before discussing any findings publicly. After
|
||||
receiving a submission, we will contact you with expected timelines for
|
||||
a fix to be implemented.
|
15
docs/additional/contributing.md
Normal file
15
docs/additional/contributing.md
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: Contributing
|
||||
---
|
||||
|
||||
We are an open source project and welcome contributions!
|
||||
|
||||
Learn more about 0x Labs at [0x.org](https://0x.org). Check out our code
|
||||
on [GitHub](https://github.com/0xProject/protocol). Connect with the
|
||||
community on our [Forum](https://forum.0x.org/) and
|
||||
[Reddit](https://www.reddit.com/r/0xProject/). Chat with our team
|
||||
privately on [Discord](https://discord.com/invite/d3FTX3M) or publicly
|
||||
on [Twitter](https://twitter.com/0xproject).
|
||||
|
||||
We\'re also hiring, see our open roles at
|
||||
[0x.org/jobs](https://0x.org/about/jobs).
|
131
docs/additional/emergency.md
Normal file
131
docs/additional/emergency.md
Normal file
File diff suppressed because one or more lines are too long
23
docs/additional/exceptional_erc20s.md
Normal file
23
docs/additional/exceptional_erc20s.md
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: Exceptional ERC20s
|
||||
---
|
||||
|
||||
Some ERC20s have unique behavior that may require extra handling. We
|
||||
document these here as they are discovered.
|
||||
|
||||
# Assert vs Require
|
||||
|
||||
These ERC20\'s use [assert]{.title-ref} instead of
|
||||
[require]{.title-ref}, which means that if the token reverts then
|
||||
(nearly) all of the gas from your transaction will be consumed.
|
||||
Specifically, you are left with 1/64 of the gas limit. Be mindful of
|
||||
this when implementing fallback logic; for example, if a call to
|
||||
[transferFrom]{.title-ref} reverts then note you will only have 1/64 of
|
||||
the gas limit to handle the exception.
|
||||
|
||||
Known tokens:
|
||||
|
||||
- KNC
|
||||
- LINK
|
||||
- sUSD
|
||||
- USDT
|
143
docs/additional/releases.md
Normal file
143
docs/additional/releases.md
Normal file
@@ -0,0 +1,143 @@
|
||||
---
|
||||
title: Releases
|
||||
---
|
||||
|
||||
::: {.note}
|
||||
::: {.title}
|
||||
Note
|
||||
:::
|
||||
|
||||
These releases are approved by the 0x Community. Come out and vote
|
||||
[HERE](https://0x.org/zrx/vote/)!
|
||||
:::
|
||||
|
||||
This page outlines upcoming releases and expected changes.
|
||||
|
||||
--------------------------------------------- ------------------------------------------------- ---------- ------------- -------------------------------------------------------------------------------------------------------------------------
|
||||
**Name** **Overview** **Est **Status** **Additional**
|
||||
Release
|
||||
Date**
|
||||
|
||||
[Amaretto](#amaretto) Protocol 4.1: Efficiency + Batch Fills 03/15/21 Development
|
||||
|
||||
*The following releases have been deployed*
|
||||
|
||||
[Babooshka](#babooshka) Connect Exchange Proxy to Staking 02/08/21 Deployed [Release Notes](https://github.com/0xProject/0x-migrations/blob/main/src/exchange-proxy/migrations/log/9_babooshka.md)
|
||||
|
||||
[Squire](#squire) Aggregation for [V4 02/04/21 Deployed N/A
|
||||
Orders](../basics/orders.html)
|
||||
|
||||
[big-pantsuit-energy](#big-pantsuit-energy) Patch batch `` `getOrderRelevantState() ``\` 01/25/21 Deployed [Release
|
||||
functions Notes](https://github.com/0xProject/0x-migrations/blob/main/src/exchange-proxy/migrations/log/8_big-pantsuit-energy.md)
|
||||
|
||||
[Panettone](#panettone) Minor patches from [Consensys 01/12/21 Deployed [Release Notes](https://github.com/0xProject/0x-migrations/blob/main/src/exchange-proxy/migrations/log/7_panettone.md)
|
||||
Audit](./audits.html)
|
||||
|
||||
[cyberpants2077](#cyberpants2077) [V4 Orders](../basics/orders.html) 01/05/21 Deployed [Release
|
||||
Notes](https://github.com/0xProject/0x-migrations/blob/main/src/exchange-proxy/migrations/log/6_cyberpants2077.md)
|
||||
|
||||
[Hot-Pants](#hot-pants) Remove calldata signing / DeFi Saver Fix / 12/07/20 Deployed [Release Notes](https://github.com/0xProject/0x-migrations/blob/main/src/exchange-proxy/migrations/log/5_hot_pants.md)
|
||||
Allowance on Proxy
|
||||
|
||||
[Plop](#plop) PLP VIP 12/01/20 Deployed [Release Notes](https://github.com/0xProject/0x-migrations/blob/main/src/exchange-proxy/migrations/log/4_plop.md)
|
||||
|
||||
[Tinker](#tinker) Set allowances directly on Exchange Proxy 11/12/20 Deployed [Release Notes](https://github.com/0xProject/0x-migrations/blob/main/src/exchange-proxy/migrations/log/3_tinker.md)
|
||||
|
||||
[Elphaba](#elphaba) Meta-Transactions + Uniswap VIP Deployed [Release Notes](https://github.com/0xProject/0x-migrations/blob/main/src/exchange-proxy/migrations/log/2_elphaba.md)
|
||||
|
||||
[Champagne-Problems](#champagne-problems) Signed Calldata Deployed [Release
|
||||
Notes](https://github.com/0xProject/0x-migrations/blob/main/src/exchange-proxy/migrations/log/1_champagne_problems.md)
|
||||
--------------------------------------------- ------------------------------------------------- ---------- ------------- -------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# Upcoming
|
||||
|
||||
## Amaretto
|
||||
|
||||
- RFQ VIP (fallback to DEX if RFQ orders is unfillable)
|
||||
- Batch fills for native orders
|
||||
- Mooniswap VIP
|
||||
- Curve / Swerve VIP (via PLP Sandbox)
|
||||
|
||||
# Past
|
||||
|
||||
## Babooshka
|
||||
|
||||
- Register the 0x Exchange Proxy with the Staking Proxy, allowing
|
||||
protocol fees from V4 Orders to be paid to Staking Pools.
|
||||
|
||||
## Squire
|
||||
|
||||
- Deploy updated
|
||||
[FillQuoteTransformer](../architecture/transformers.html), which can
|
||||
fill [V4 Orders](../basics/orders.html). This transformer will no
|
||||
longer call Exchange V3.
|
||||
- This will replace the [ERC20BridgeTransfer
|
||||
Event](../basics/events.html#erc20bridgetransfer)
|
||||
|
||||
## big-pantsuit-energy
|
||||
|
||||
- Swallow reverts in [batchGetRfqOrderRelevantStates()]{.title-ref}
|
||||
and [batchGetLimitOrderRelevantStates()]{.title-ref} functions.
|
||||
|
||||
## Panettone
|
||||
|
||||
- Minor patches from the Consensys Audit. No breaking changes.
|
||||
- Decommissions the internal [\_executeMetaTransaction]{.title-ref}
|
||||
function.
|
||||
- Extends deployment timelock from 24h to 48h.
|
||||
- Decommission
|
||||
[SignatureValidationFeature](../architecture/features.html).
|
||||
- Decommission [TokenSpenderFeature](../architecture/features.html).
|
||||
|
||||
## cyberpants2077
|
||||
|
||||
- Deploy [NativeLiquidityFeature](../architecture/features.html). This
|
||||
incldues order validation that was previously in Dev-Utils.
|
||||
- Introduces [new events](../basics/events.html).
|
||||
|
||||
## Hot-Pants
|
||||
|
||||
- Removes calldata signing from `TransformERC20` Feature.
|
||||
- Redeploying all [Transformers](../architecture/transformers.html)
|
||||
(new interface w/o `calldataHash`)
|
||||
- Allowances can now be set on the
|
||||
[Proxy](../architecture/features/proxy.html). See more on the
|
||||
[Allowances Page](../basics/allowances.html). This involves
|
||||
redeploying the following [Features](../architecture/features.html):
|
||||
`MetaTransactionsFeature`, `TransformERC20Feature`,
|
||||
`UniswapFeature`.
|
||||
|
||||
## Plop
|
||||
|
||||
- Deploy the
|
||||
[LiquidityProviderFeature](../architecture/features.html), which
|
||||
enables optimized trades directly with [PLP](../advanced/plp.html)
|
||||
|
||||
## Tinker
|
||||
|
||||
::: {.note}
|
||||
::: {.title}
|
||||
Note
|
||||
:::
|
||||
|
||||
This release was partially rolled back due to breaking allowances for
|
||||
some [Exceptional ERC20 Tokens](./exceptional_erc20s.html). These
|
||||
features were fixed and re-deployed in the Hot-Pants release, above.
|
||||
:::
|
||||
|
||||
- Upgrade any features that transfer user funds to use allowances on
|
||||
the Proxy contract. Transfers will still fallback to the Allowance
|
||||
Target, but integrators will get reduced transaction costs from
|
||||
setting their allowance on the Proxy. This involves redeploying the
|
||||
following [Features](../architecture/features.html):
|
||||
`MetaTransactionsFeature`, `TransformERC20Feature`,
|
||||
`UniswapFeature`.
|
||||
|
||||
## Elphaba
|
||||
|
||||
- Updates for Meta-Transactions Feature
|
||||
- Uniswap VIP for efficient fills through Uniswap.
|
||||
|
||||
## Champagne-Problems
|
||||
|
||||
- Signed Calldata for Meta-Transactions
|
@@ -1,178 +0,0 @@
|
||||
###############################
|
||||
ERC20 Transformations
|
||||
###############################
|
||||
|
||||
|
||||
The 0x Protocol is able to perform a variety of atomic transformations on ERC20 tokens, in addition to simply executing trades. This is made possible through composable smart contracts, called `Transformers <../architecture/transformers.html>`_. These trustless modules extend the core Exchange logic, enabling workflows like converting between ETH<>WETH or aggregating liquidity across DEX's. These operations can be combined with trade exeuction to create a seamlesss trading experience.
|
||||
|
||||
Anyone can run transformations using the ``transformERC20`` Exchange function.
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
/// @dev Executes a series of transformations to convert an ERC20 `inputToken`
|
||||
/// to an ERC20 `outputToken`.
|
||||
/// @param inputToken The token being provided by the sender.
|
||||
/// If `0xeee...`, ETH is implied and should be provided with the call.`
|
||||
/// @param outputToken The token to be acquired by the sender.
|
||||
/// `0xeee...` implies ETH.
|
||||
/// @param inputTokenAmount The amount of `inputToken` to take from the sender.
|
||||
/// If set to `uint256(-1)`, the entire spendable balance of the taker
|
||||
/// will be solt.
|
||||
/// @param minOutputTokenAmount The minimum amount of `outputToken` the sender
|
||||
/// must receive for the entire transformation to succeed. If set to zero,
|
||||
/// the minimum output token transfer will not be asserted.
|
||||
/// @param transformations The transformations to execute on the token balance(s)
|
||||
/// in sequence.
|
||||
/// @return outputTokenAmount The amount of `outputToken` received by the sender.
|
||||
function transformERC20(
|
||||
IERC20TokenV06 inputToken,
|
||||
IERC20TokenV06 outputToken,
|
||||
uint256 inputTokenAmount,
|
||||
uint256 minOutputTokenAmount,
|
||||
Transformation[] memory transformations
|
||||
)
|
||||
public
|
||||
override
|
||||
payable
|
||||
returns (uint256 outputTokenAmount);
|
||||
|
||||
A Transformation is defined by a ``deploymentNonce`` (which identifies the contract that implements the transformation) and ``data`` for that contract.
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
/// @dev Defines a transformation to run in `transformERC20()`.
|
||||
struct Transformation {
|
||||
// The deployment nonce for the transformer.
|
||||
// The address of the transformer contract will be derived from this
|
||||
// value.
|
||||
uint32 deploymentNonce;
|
||||
// Arbitrary data to pass to the transformer.
|
||||
bytes data;
|
||||
}
|
||||
|
||||
The transaction will revert if a transformation fails; the `inputTokenAmount` cannot be transferred from the sender; or the ``minOutputTokenAmount`` is not transferred to the sender. A single `TransformedERC20 <../basics/events.html#transformederc20>`_ event is be emitted upon successful execution of all transformations.
|
||||
|
||||
Liquidity Aggregation
|
||||
---------------------
|
||||
|
||||
Liquidity can be pulled from other Decentralized Exchanges (DEX) to supplement native liquidity (0x orders). This is currently used by 0x API to provide the aggregate the best prices across the entire DEX Ecosystem. Check out `https://matcha.xyz <https://matcha.xyz>`_ to see this in action!
|
||||
|
||||
Supported DEX's:
|
||||
|
||||
* Balancer
|
||||
* Curve
|
||||
* DoDo
|
||||
* Kyber
|
||||
* MStable
|
||||
* Mooniswap
|
||||
* Oasis
|
||||
* Shell
|
||||
* Sushiswap
|
||||
* Uniswap v1/v2
|
||||
|
||||
This transformation is implemented by the `FillQuoteTransformer <../architecture/transformers.html>`_. Abi-Encode the following struct to get the ``data``:
|
||||
|
||||
.. warning::
|
||||
An upgrade is pending to this transformation. This currently uses Exchange V3 Orders, but will soon be updated to use `V4 Orders <../basics/orders.html>`_. - 11/26/2020
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
/// @dev Transform data to ABI-encode and pass into `transform()`.
|
||||
struct TransformData {
|
||||
// Whether we are performing a market sell or buy.
|
||||
Side side;
|
||||
// The token being sold.
|
||||
// This should be an actual token, not the ETH pseudo-token.
|
||||
IERC20TokenV06 sellToken;
|
||||
// The token being bought.
|
||||
// This should be an actual token, not the ETH pseudo-token.
|
||||
IERC20TokenV06 buyToken;
|
||||
// The orders to fill.
|
||||
IExchange.Order[] orders;
|
||||
// Signatures for each respective order in `orders`.
|
||||
bytes[] signatures;
|
||||
// Maximum fill amount for each order. This may be shorter than the
|
||||
// number of orders, where missing entries will be treated as `uint256(-1)`.
|
||||
// For sells, this will be the maximum sell amount (taker asset).
|
||||
// For buys, this will be the maximum buy amount (maker asset).
|
||||
uint256[] maxOrderFillAmounts;
|
||||
// Amount of `sellToken` to sell or `buyToken` to buy.
|
||||
// For sells, this may be `uint256(-1)` to sell the entire balance of
|
||||
// `sellToken`.
|
||||
uint256 fillAmount;
|
||||
// Who to transfer unused protocol fees to.
|
||||
// May be a valid address or one of:
|
||||
// `address(0)`: Stay in flash wallet.
|
||||
// `address(1)`: Send to the taker.
|
||||
// `address(2)`: Send to the sender (caller of `transformERC20()`).
|
||||
address payable refundReceiver;
|
||||
// Required taker address for RFQT orders.
|
||||
// Null means any taker can fill it.
|
||||
address rfqtTakerAddress;
|
||||
}
|
||||
|
||||
This transformation currently executes a Market Sell or Market Buy on a series of `0x V3 Orders <https://github.com/0xProject/0x-protocol-specification/blob/master/v3/v3-specification.md#orders>`_. The transaction will revert if the ``fillAmount`` is not reached; an individual order can fail without the entire transaction reverting. A `ProtocolFeeUnfunded <../basics/events.html#protocolfeeunfunded>`_ event will be emitted if an order failed to fill because the Taker did not send a sufficient protocol fee.
|
||||
|
||||
|
||||
WETH Wrapping
|
||||
-------------
|
||||
|
||||
This transformation is implemented by the `WethTransformer <../architecture/transformers.html>`_. Abi-Encode the following struct to get the ``data``:
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
/// @dev Transform data to ABI-encode and pass into `transform()`.
|
||||
struct TransformData {
|
||||
// The token to wrap/unwrap. Must be either ETH or WETH.
|
||||
IERC20TokenV06 token;
|
||||
// Amount of `token` to wrap or unwrap.
|
||||
// `uint(-1)` will unwrap the entire balance.
|
||||
uint256 amount;
|
||||
}
|
||||
|
||||
If the supplied token address is `WETH (etherToken) <../basics/addresses.html>`_ then the supplied WETH will be unwrapped to ``ETH``. If any other address is supplied the any ETH passed in will be wrapped into ``WETH``. No events are emitted by 0x during this transformation, although token contracts may have events. This will revert if ``allowances <../basics/allowances.html>_`` are not set or the available balance is less than ``amount``.
|
||||
|
||||
Affiliate Fees
|
||||
--------------
|
||||
|
||||
This transformation is implemented by the `AffiliateFeeTransformer <../architecture/transformers.html>`_. Abi-Encode the following struct to get the ``data``:
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
/// @dev Information for a single fee.
|
||||
struct TokenFee {
|
||||
// The token to transfer to `recipient`.
|
||||
IERC20TokenV06 token;
|
||||
// Amount of each `token` to transfer to `recipient`.
|
||||
// If `amount == uint256(-1)`, the entire balance of `token` will be
|
||||
// transferred.
|
||||
uint256 amount;
|
||||
// Recipient of `token`.
|
||||
address payable recipient;
|
||||
}
|
||||
|
||||
This pays the ``recipient`` in the ``amount`` of ``token`` specified. This can be used by integrators who wish to add an additional fee on top of 0x Orders. No events are emitted by 0x during this transformation, although token contracts may have events. This will revert if `allowances <../basics/allowances.html>`_ are not set or the available balance is less than ``amount``.
|
||||
|
||||
Pay Taker
|
||||
---------
|
||||
|
||||
This transformation is implemented by the `PayTakerTransformer <../architecture/transformers.html>`_. Abi-Encode the following struct to get the ``data``:
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
/// @dev Transform data to ABI-encode and pass into `transform()`.
|
||||
struct TransformData {
|
||||
// The tokens to transfer to the taker.
|
||||
IERC20TokenV06[] tokens;
|
||||
// Amount of each token in `tokens` to transfer to the taker.
|
||||
// `uint(-1)` will transfer the entire balance.
|
||||
uint256[] amounts;
|
||||
}
|
||||
|
||||
This pays the ``taker`` in the ``amounts`` of each ``tokens`` specified. This is generally run at the end of all other transformations. For example, if you've swapped the taker's ETH for WETH then executed a trade through `Liquidity Aggregation`_, this transformation will can transfer the final output token back to the Taker.
|
||||
|
||||
No events are emitted by 0x during this transformation, although token contracts may have events. This will revert if `allowances <../basics/allowances.html>`_ are not set or the available balance is less than ``amount``.
|
||||
|
||||
Adding Custom Transformations
|
||||
-----------------------------
|
||||
Transformations are trustless, but at this time they are permissioned so only 0x Labs can deploy new Transformers. If you are interested in deploying your own transformation logic, please reach out to us on `Discord <https://discord.com/invite/d3FTX3M>`_. Learn more about why this is permissioned in the `Transformer Deployer <../architecture/transformer_deployer.html>`_ section.
|
@@ -1,233 +0,0 @@
|
||||
###############################
|
||||
Meta-Transactions
|
||||
###############################
|
||||
|
||||
Meta-Transactions are signed messages that instruct the 0x Protocol to run function(s) in the context of the signer. This signed mtx can then be shared off-chain, allowing anyone to execute on-chain. This is useful for integrators who would like to subsidize the Ethereum Gas Fee, or add custom smart contract logic to run atomically a fill. A signed meta-transaction can only be executed once.
|
||||
|
||||
A common use case for this is in Request For Quote (RFQ) systems. The Maker creates an order; the Taker signs a mtx permitting 0x Protocol to fill the order on their behalf; the mtx is returned to the Maker who submits it on-chain.
|
||||
|
||||
.. image:: ../_static/img/rfqm.png
|
||||
:alt: Meta-Transaction Example
|
||||
:align: center
|
||||
|
||||
|
||||
|
||||
Constructing
|
||||
============
|
||||
|
||||
To construct a Meta-Transaction, abi-encode the following struct and sign it.
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
/// @dev Describes an exchange proxy meta transaction.
|
||||
struct MetaTransactionData {
|
||||
// Signer of meta-transaction. On whose behalf to execute the MTX.
|
||||
address payable signer;
|
||||
// Required sender, or NULL for anyone.
|
||||
address sender;
|
||||
// Minimum gas price.
|
||||
uint256 minGasPrice;
|
||||
// Maximum gas price.
|
||||
uint256 maxGasPrice;
|
||||
// MTX is invalid after this time.
|
||||
uint256 expirationTimeSeconds;
|
||||
// Nonce to make this MTX unique.
|
||||
uint256 salt;
|
||||
// Encoded call data to a function on the exchange proxy.
|
||||
bytes callData;
|
||||
// Amount of ETH to attach to the call.
|
||||
uint256 value;
|
||||
// ERC20 fee `signer` pays `sender`.
|
||||
IERC20TokenV06 feeToken;
|
||||
// ERC20 fee amount.
|
||||
uint256 feeAmount;
|
||||
}
|
||||
|
||||
The ``calldata`` field is specific to the function you wish to execute. At this time, the following functions are supported:
|
||||
|
||||
- `fillLimitOrder <../basics/functions.html#filllimitorder>`_
|
||||
- `fillRfqOrder <../basics/functions.html#fillrfqorder>`_
|
||||
- `transformERC20 <../advanced/erc20_transformations.html>`_
|
||||
|
||||
Signing
|
||||
=======
|
||||
|
||||
Meta-Transactions use the same signing technique as 0x Orders; see the `How to Sign <../basics/orders.html#how-to-sign>`_ section of the Orders documentation. See `getMetaTransactionHash`_ for generating a unique hash for your mtx.
|
||||
|
||||
Functionality
|
||||
=============
|
||||
|
||||
+----------------------------------------+------------------------------------------------------------------------------------------------+
|
||||
| Function | Overview |
|
||||
+----------------------------------------+------------------------------------------------------------------------------------------------+
|
||||
| `executeMetaTransaction`_ | Executes a single meta-transaction |
|
||||
+----------------------------------------+------------------------------------------------------------------------------------------------+
|
||||
| `batchExecuteMetaTransactions`_ | Executes a batch of meta-transactions. |
|
||||
+----------------------------------------+------------------------------------------------------------------------------------------------+
|
||||
| `getMetaTransactionExecutedBlock`_ | Returns the block that a meta-transaction was executed at. |
|
||||
+----------------------------------------+------------------------------------------------------------------------------------------------+
|
||||
| `getMetaTransactionHashExecutedBlock`_ | Same as ``getMetaTransactionExecutedBlock``, only this function takes a meta-transaction hash. |
|
||||
+----------------------------------------+------------------------------------------------------------------------------------------------+
|
||||
| `getMetaTransactionHash`_ | Returns the hash of a meta-transaction. |
|
||||
+----------------------------------------+------------------------------------------------------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
executeMetaTransaction
|
||||
----------------------
|
||||
|
||||
A single Meta-Transaction is executed by calling ``executeMetaTransaction``. A batch of mtx's can be executed by calling ``batchExecuteMetaTransactions``.
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
/// @dev Execute a single meta-transaction.
|
||||
/// @param mtx The meta-transaction.
|
||||
/// @param signature The signature by `mtx.signer`.
|
||||
/// @return returnResult The ABI-encoded result of the underlying call.
|
||||
function executeMetaTransaction(
|
||||
MetaTransactionData calldata mtx,
|
||||
LibSignature.Signature calldata signature
|
||||
)
|
||||
external
|
||||
payable
|
||||
returns (bytes memory returnResult);
|
||||
|
||||
A `MetaTransactionExecuted <../basics/events.html#metatransactionexecuted>`_ event is emitted on succes. The ``returnResult`` contains the raw return data for the executed function. For example, if the function returns a ``uint256`` then the ``returnResult`` could be abi-decoded into a ``uint256``.
|
||||
|
||||
This call will revert in the following scenarios:
|
||||
|
||||
- The address in the ``mtx.sender`` field does not match ``msg.sender``.
|
||||
- The mtx has expired.
|
||||
- The Ethereum transaction's gas price (``tx.gasprice``) is outside of the range ``[mtx.minGasPrice..mtx.maxGasPrice]``
|
||||
- The ETH sent with the mtx is less than ``mtx.value``
|
||||
- The allowance/balance of ``signer`` is insufficient to pay ``feeAmount`` of ``feeToken`` to the ``sender`` (if specified)
|
||||
- The signature is invalid.
|
||||
- The mtx was already executed
|
||||
- The underlying function is not supported by meta-transactions (see list above).
|
||||
- The underlying function call reverts.
|
||||
|
||||
batchExecuteMetaTransactions
|
||||
----------------------------
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
/// @dev Execute multiple meta-transactions.
|
||||
/// @param mtxs The meta-transactions.
|
||||
/// @param signatures The signature by each respective `mtx.signer`.
|
||||
/// @return returnResults The ABI-encoded results of the underlying calls.
|
||||
function batchExecuteMetaTransactions(
|
||||
MetaTransactionData[] calldata mtxs,
|
||||
LibSignature.Signature[] calldata signatures
|
||||
)
|
||||
external
|
||||
payable
|
||||
returns (bytes[] memory returnResults);
|
||||
|
||||
A `MetaTransactionExecuted <../basics/events.html#metatransactionexecuted>`_ event is emitted for each mtx on succes. The ``returnResult`` contains the raw return data for the executed function This call will revert if the one of the ``mtxs`` reverts. Any exceess Ether will be refunded to the ``msg.sender``.
|
||||
|
||||
|
||||
getMetaTransactionExecutedBlock
|
||||
-------------------------------
|
||||
|
||||
The ``block.number`` is stored on-chain when a mtx is executed. This value can be retrieved using the following function.
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
/// @dev Get the block at which a meta-transaction has been executed.
|
||||
/// @param mtx The meta-transaction.
|
||||
/// @return blockNumber The block height when the meta-transactioin was executed.
|
||||
function getMetaTransactionExecutedBlock(MetaTransactionData calldata mtx)
|
||||
external
|
||||
view
|
||||
returns (uint256 blockNumber);
|
||||
|
||||
getMetaTransactionHashExecutedBlock
|
||||
-----------------------------------
|
||||
|
||||
This is a more gas-efficient implementation of ``getMetaTransactionExecutedBlock``.
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
/// @dev Get the block at which a meta-transaction hash has been executed.
|
||||
/// @param mtxHash The meta-transaction hash.
|
||||
/// @return blockNumber The block height when the meta-transactioin was executed.
|
||||
function getMetaTransactionHashExecutedBlock(bytes32 mtxHash)
|
||||
external
|
||||
view
|
||||
returns (uint256 blockNumber);
|
||||
|
||||
|
||||
getMetaTransactionHash
|
||||
----------------------
|
||||
|
||||
The hash of the mtx is used to uniquely identify it inside the protocol. It is computed following the `EIP712 spec <https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md>`_ standard. In solidity, the hash is computed using:
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
/// @dev Get the EIP712 hash of a meta-transaction.
|
||||
/// @param mtx The meta-transaction.
|
||||
/// @return mtxHash The EIP712 hash of `mtx`.
|
||||
function getMetaTransactionHash(MetaTransactionData calldata mtx)
|
||||
external
|
||||
view
|
||||
returns (bytes32 mtxHash);
|
||||
|
||||
The simplest way to generate an order hash is by calling this function, ex:
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
bytes32 orderHash = IZeroEx(0xDef1C0ded9bec7F1a1670819833240f027b25EfF).getMetaTransactionHash(mtx);
|
||||
|
||||
The hash can be manually generated using the following code:
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
bytes32 orderHash = keccak256(abi.encodePacked(
|
||||
'\x19\x01',
|
||||
// The domain separator.
|
||||
keccak256(abi.encode(
|
||||
// The EIP712 domain separator type hash.
|
||||
keccak256(abi.encodePacked(
|
||||
'EIP712Domain(',
|
||||
'string name,',
|
||||
'string version,',
|
||||
'uint256 chainId,',
|
||||
'address verifyingContract)'
|
||||
)),
|
||||
// The EIP712 domain separator values.
|
||||
'ZeroEx',
|
||||
'1.0.0',
|
||||
1, // For mainnet
|
||||
0xDef1C0ded9bec7F1a1670819833240f027b25EfF, // Address of the Exchange Proxy
|
||||
)),
|
||||
// The struct hash.
|
||||
keccak256(abi.encode(
|
||||
// The EIP712 type hash.
|
||||
keccak256(abi.encodePacked(
|
||||
"MetaTransactionData("
|
||||
"address signer,"
|
||||
"address sender,"
|
||||
"uint256 minGasPrice,"
|
||||
"uint256 maxGasPrice,"
|
||||
"uint256 expirationTimeSeconds,"
|
||||
"uint256 salt,"
|
||||
"bytes callData,"
|
||||
"uint256 value,"
|
||||
"address feeToken,"
|
||||
"uint256 feeAmount"
|
||||
")"
|
||||
)),
|
||||
// The struct values.
|
||||
mtx.signer,
|
||||
mtx.sender,
|
||||
mtx.minGasPrice,
|
||||
mtx.maxGasPrice,
|
||||
mtx.expirationTimeSeconds,
|
||||
mtx.salt,
|
||||
keccak256(mtx.callData),
|
||||
mtx.value,
|
||||
mtx.feeToken,
|
||||
mtx.feeAmount
|
||||
))
|
||||
));
|
||||
|
@@ -1,122 +0,0 @@
|
||||
###############################
|
||||
Pluggable Liquidity (PLP)
|
||||
###############################
|
||||
|
||||
PLP (Pluggable Liquidity PLP) enables anyone to extend the 0x Protocol with their own on-chain liquidity provider, like an AMM (Automated Market Maker). Liquidity providers are sandboxed so their code can be totally closed-source; they are executed via the `LiquidityProviderFeature <../architecture/features.html>`_
|
||||
|
||||
|
||||
Implementing a Liquidity Provider
|
||||
=================================
|
||||
The only requirement is that the provider implements the interface in `ILiquidityProvider <https://github.com/0xProject/protocol/blob/development/contracts/zero-ex/contracts/src/vendor/ILiquidityProvider.sol>`_.
|
||||
Note that ``sellEthForToken`` and ``sellTokenForEth`` do not need to be implemented if the liquidity provider does not trade ETH/WETH.
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
/// @dev Trades `inputToken` for `outputToken`. The amount of `inputToken`
|
||||
/// to sell must be transferred to the contract prior to calling this
|
||||
/// function to trigger the trade.
|
||||
/// @param inputToken The token being sold.
|
||||
/// @param outputToken The token being bought.
|
||||
/// @param recipient The recipient of the bought tokens.
|
||||
/// @param minBuyAmount The minimum acceptable amount of `outputToken` to buy.
|
||||
/// @param auxiliaryData Arbitrary auxiliary data supplied to the contract.
|
||||
/// @return boughtAmount The amount of `outputToken` bought.
|
||||
function sellTokenForToken(
|
||||
address inputToken,
|
||||
address outputToken,
|
||||
address recipient,
|
||||
uint256 minBuyAmount,
|
||||
bytes calldata auxiliaryData
|
||||
)
|
||||
external
|
||||
returns (uint256 boughtAmount);
|
||||
|
||||
/// @dev Trades ETH for token. ETH must either be attached to this function
|
||||
/// call or sent to the contract prior to calling this function to
|
||||
/// trigger the trade.
|
||||
/// @param outputToken The token being bought.
|
||||
/// @param recipient The recipient of the bought tokens.
|
||||
/// @param minBuyAmount The minimum acceptable amount of `outputToken` to buy.
|
||||
/// @param auxiliaryData Arbitrary auxiliary data supplied to the contract.
|
||||
/// @return boughtAmount The amount of `outputToken` bought.
|
||||
function sellEthForToken(
|
||||
address outputToken,
|
||||
address recipient,
|
||||
uint256 minBuyAmount,
|
||||
bytes calldata auxiliaryData
|
||||
)
|
||||
external
|
||||
payable
|
||||
returns (uint256 boughtAmount);
|
||||
|
||||
/// @dev Trades token for ETH. The token must be sent to the contract prior
|
||||
/// to calling this function to trigger the trade.
|
||||
/// @param inputToken The token being sold.
|
||||
/// @param recipient The recipient of the bought tokens.
|
||||
/// @param minBuyAmount The minimum acceptable amount of ETH to buy.
|
||||
/// @param auxiliaryData Arbitrary auxiliary data supplied to the contract.
|
||||
/// @return boughtAmount The amount of ETH bought.
|
||||
function sellTokenForEth(
|
||||
address inputToken,
|
||||
address payable recipient,
|
||||
uint256 minBuyAmount,
|
||||
bytes calldata auxiliaryData
|
||||
)
|
||||
external
|
||||
returns (uint256 boughtAmount);
|
||||
|
||||
/// @dev Quotes the amount of `outputToken` that would be obtained by
|
||||
/// selling `sellAmount` of `inputToken`.
|
||||
/// @param inputToken Address of the taker token (what to sell). Use
|
||||
/// the wETH address if selling ETH.
|
||||
/// @param outputToken Address of the maker token (what to buy). Use
|
||||
/// the wETH address if buying ETH.
|
||||
/// @param sellAmount Amount of `inputToken` to sell.
|
||||
/// @return outputTokenAmount Amount of `outputToken` that would be obtained.
|
||||
function getSellQuote(
|
||||
address inputToken,
|
||||
address outputToken,
|
||||
uint256 sellAmount
|
||||
)
|
||||
external
|
||||
view
|
||||
returns (uint256 outputTokenAmount);
|
||||
|
||||
|
||||
Trading with a Liquidity Provider
|
||||
=================================
|
||||
|
||||
To trade with a liquidity provider use the ``sellToLiquidityProvider`` function.
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
/// @dev Sells `sellAmount` of `inputToken` to the liquidity provider
|
||||
/// at the given `provider` address.
|
||||
/// @param inputToken The token being sold.
|
||||
/// @param outputToken The token being bought.
|
||||
/// @param provider The address of the on-chain liquidity provider
|
||||
/// to trade with.
|
||||
/// @param recipient The recipient of the bought tokens. If equal to
|
||||
/// address(0), `msg.sender` is assumed to be the recipient.
|
||||
/// @param sellAmount The amount of `inputToken` to sell.
|
||||
/// @param minBuyAmount The minimum acceptable amount of `outputToken` to
|
||||
/// buy. Reverts if this amount is not satisfied.
|
||||
/// @param auxiliaryData Auxiliary data supplied to the `provider` contract.
|
||||
/// @return boughtAmount The amount of `outputToken` bought.
|
||||
function sellToLiquidityProvider(
|
||||
address inputToken,
|
||||
address outputToken,
|
||||
address payable provider,
|
||||
address recipient,
|
||||
uint256 sellAmount,
|
||||
uint256 minBuyAmount,
|
||||
bytes calldata auxiliaryData
|
||||
)
|
||||
external
|
||||
override
|
||||
payable
|
||||
returns (uint256 boughtAmount);
|
||||
|
||||
This function transfers tokens from ``msg.sender`` to the liquidity provider then executes the trade through a sandboxed contract external to the Exchange Proxy. The sandbox then executes the trade through the provider. This function then transfers the output tokens to the ``recipient``.
|
||||
|
||||
This function will emit a `LiquidityProviderSwap <../basics/events.html#liquidityproviderswap>`_ event if the trade succeeds. It will revert if the amount of ``outputToken`` returned by the Liquidity Provider is less than ``minBuyAmount``.
|
@@ -1,32 +0,0 @@
|
||||
###############################
|
||||
Optimized Uniswap Router
|
||||
###############################
|
||||
|
||||
The 0x Protocol is equipped with a highly optimized `UniswapV2 Router <https://uniswap.org/docs/v2/smart-contracts/router02/>`_, which can reduce the transaction cost of trading with Uniswap. Call the ``sellToUniswap`` function to execute a trade on Uniswap through the 0x Protocol.
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
/// @dev Efficiently sell directly to uniswap/sushiswap.
|
||||
/// @param tokens Sell path.
|
||||
/// @param sellAmount of `tokens[0]` Amount to sell.
|
||||
/// @param minBuyAmount Minimum amount of `tokens[-1]` to buy.
|
||||
/// @param isSushi Use sushiswap if true.
|
||||
/// @return buyAmount Amount of `tokens[-1]` bought.
|
||||
function sellToUniswap(
|
||||
IERC20TokenV06[] calldata tokens,
|
||||
uint256 sellAmount,
|
||||
uint256 minBuyAmount,
|
||||
bool isSushi
|
||||
)
|
||||
external
|
||||
payable
|
||||
returns (uint256 buyAmount);
|
||||
|
||||
This function sells ``sellAmount`` of ``tokens[0]`` for at least ``minBuyAmount`` of ``tokens[-1]``. The ``tokens`` array defines how to route the trade between Uniswap pools. This function does not emit any events, although Uniswap pools will emit their own events. This function reverts if amount bought from Uniswap is less than ``minBuyAmount``, or if Uniswap reverts.
|
||||
|
||||
See the source code for our router `here <https://github.com/0xProject/protocol/blob/development/contracts/zero-ex/contracts/src/features/UniswapFeature.sol>`_.
|
||||
|
||||
See the official `Uniswap V2 Documentation <https://uniswap.org/docs/v2/>`_ for information on events/reverts/allowances.
|
||||
|
||||
.. note::
|
||||
This function does not use allowances set on 0x. The ``msg.sender`` must have allowances set on Uniswap (or SushiSwap).
|
@@ -1,77 +0,0 @@
|
||||
###############################
|
||||
Features
|
||||
###############################
|
||||
|
||||
Features implement the core feature set of the 0x Protocol. They are trusted with user allowances and permissioned by the `0x Governor <./governor.html>`_. Features are run in the context of the `Proxy <../proxy.html>`_, via a ``delegatecall``.
|
||||
|
||||
Below is a catalog of Features.
|
||||
|
||||
.. table::
|
||||
:widths: 20 60 20
|
||||
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| **Feature** | **Description** | **Resources** |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| BootstrapFeature | Bootstraps the entire system. | `Code <https://github.com/0xProject/protocol/blob/development/contracts/zero-ex/contracts/src/features/BootstrapFeature.sol>`__; `Usage <./proxy.html#bootstrapping>`__ |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| LiquidityProviderFeature | Connects the system to Pluggable Liquidity (PLP). | `Code <https://github.com/0xProject/protocol/blob/development/contracts/zero-ex/contracts/src/features/LiquidityProviderFeature.sol>`__; `Usage <../advanced/plp.html#trading-with-a-liquidity-provider>`__ |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| MetaTransactionsFeature | Executes Meta-Transactions. | `Code <https://github.com/0xProject/protocol/blob/development/contracts/zero-ex/contracts/src/features/MetaTransactionsFeature.sol>`__; `Usage <../advanced/mtx.html>`__ |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| NativeLiquidityFeature | Functions for native 0x liquidity (see `Orders <../basics/orders.html>`_). | `Code <https://github.com/0xProject/protocol/blob/development/contracts/zero-ex/contracts/src/features/NativeOrdersFeature.sol>`__; `Usage <../basics/functions.html>`__ |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| OwnableFeature | An implementation of Ownable that is compatible with the delegate-call proxy pattern. | `Code <https://github.com/0xProject/protocol/blob/development/contracts/zero-ex/contracts/src/features/OwnableFeature.sol>`__; `Usage <./architecture/proxy.html#ownership>`__ |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| SignatureValidationFeature | *This feature is deprecated. Its code will be removed after the contract is decommissioned.* | `Code <https://github.com/0xProject/protocol/blob/development/contracts/zero-ex/contracts/src/features/SignatureValidatorFeature.sol>`__ |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| SimpleFunctionRegistry | Implements the registry of functions/features available in the system. | `Code <https://github.com/0xProject/protocol/blob/development/contracts/zero-ex/contracts/src/features/SimpleFunctionRegistryFeature.sol>`__; `Usage <./proxy.html#function-registry>`__ |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| TokenSpenderFeature | *This feature is deprecated. Its code will be removed after the contract is decommissioned.* | `Code <https://github.com/0xProject/protocol/blob/development/contracts/zero-ex/contracts/src/features/TokenSpenderFeature.sol>`__ |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| TransformERC20Feature | Executes `Transformers <./transformers.html>`_ to aggregate liquidity and operate on ERC20 tokens. | `Code <https://github.com/0xProject/protocol/blob/development/contracts/zero-ex/contracts/src/features/TransformERC20Feature.sol>`__; `Usage <../advanced/erc20_transformations.html>`__ |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| UniswapFeature | A highly-optimized UniswapV2 router; used to source liquidity from Uniswap. | `Code <https://github.com/0xProject/protocol/blob/development/contracts/zero-ex/contracts/src/features/UniswapFeature.sol>`__; `Usage <../advanced/uniswap.html>`__ |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
Implementing a Feature
|
||||
======================
|
||||
The only requirement is that the Feature implements the interface in `IFeature <https://github.com/0xProject/protocol/blob/development/contracts/zero-ex/contracts/src/features/IFeature.sol>`_. Review the `Proxy Section <./proxy.html>`_ for details on how to write a smart contract that is compatible with our architecture (ex, how to properly manage state).
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
/// @dev Basic interface for a feature contract.
|
||||
interface IFeature {
|
||||
|
||||
// solhint-disable func-name-mixedcase
|
||||
|
||||
/// @dev The name of this feature set.
|
||||
function FEATURE_NAME() external view returns (string memory name);
|
||||
|
||||
/// @dev The version of this feature set.
|
||||
function FEATURE_VERSION() external view returns (uint256 version);
|
||||
}
|
||||
|
||||
|
||||
Best Practices
|
||||
================
|
||||
|
||||
We use this checklist to review the safety of new Features.
|
||||
|
||||
::
|
||||
|
||||
- [ ] Feature has updated version information.
|
||||
- [ ] implements IFeature interface.
|
||||
- [ ] Feature contracts are stateless (including inherited contracts).
|
||||
- [ ] onlySelf feature functions are prefixed with _.
|
||||
- [ ] Feature functions are added to full_migration_tests.
|
||||
- [ ] No delegatecalls from inside a feature. Call other features through the router.
|
||||
- [ ] No self-destruct in features (except BootstrapFeature).
|
||||
- [ ] No intentionally persistent (non-atomic) balances on the Exchange Proxy.
|
||||
- [ ] No direct access to another feature’s storage bucket without strong justification.
|
||||
- [ ] No executing arbitrary calldata from the context of the Exchange Proxy.
|
||||
- [ ] No external calls to arbitrary contracts from within the Exchange Proxy.
|
||||
- [ ] Features use unique StorageIds.
|
||||
- [ ] Document functions with execution contexts outside of the Exchange Proxy.
|
||||
- [ ] Document feature dependencies in checklist doc.
|
||||
- [ ] Document reentrant functions in checklist doc.
|
||||
- [ ] Document temporary balances.
|
@@ -1,17 +0,0 @@
|
||||
###############################
|
||||
Fee Collectors
|
||||
###############################
|
||||
|
||||
The `Protocol Fees <../basics/protocol_fees.html>`_ are paid into special Fee Collector contracts at time-of-fill. There is one collector for each Staking Pool. The fees are paid in aggregate from the collector to the `Staking System <../tokenomics/staking.md>`_; this can happen at anytime, but is most optimal to run during finalization. This increases the cost of finalizing an epoch, but substantially reduces the transaction cost for takers executing trades.
|
||||
|
||||
Architecture
|
||||
============
|
||||
|
||||
1. There is one Fee Collector per staking pool. The fee collector serves as a repository for protocol fees attributed to a given pool. It automatically ``approve()s`` the staking contract so fees can be aggregated during finalization. It also contains functionality to convert ETH to WETH. Fee collectors are created using ``CREATE2``. This gives us predictable addresses.
|
||||
|
||||
2. When a `Limit Order <../basics/orders.html#limitorders>`_ is filled, the protocol fee is paid to the Fee Collector that corresponds to ``order.pool``.
|
||||
|
||||
3. The `transferProtocolFeesForPools() <../basics/functions.html#transferprotocolfeesforpools>` function can be called to transfer the fees for a set of pools from their respective Fee Collectors into the Staking system.
|
||||
|
||||
.. image:: ../_static/img/fee_collectors.png
|
||||
:align: center
|
@@ -1,47 +0,0 @@
|
||||
###############################
|
||||
Flash Wallet
|
||||
###############################
|
||||
|
||||
The Flash Wallet is a sandboxed escrow contract that holds funds for `Transformers <./transformers.html>`_ to operate on. A `Feature <./features.html>`_ contract transfers tokens to the Flash Wallet, which then delegate call's into a Transformer to run operations on the escrowed funds. Transformers are trustless and therefore only have access to the funds deposted into the Flash Wallet; they do not have access to user allowances.
|
||||
|
||||
The wallet is currently only used by the ``TransformERC20`` feature. It is deployed using the ``createTransformWallet()`` function on the feature, which is only callable by the owner/governor. This allows us to deploy a fresh wallet in case we somehow break the old one, like if we accidentally selfdestruct it or clobber its state.
|
||||
|
||||
.. note::
|
||||
The wallet is currently only used for ERC20 tokens, but can be extended to work with other standards, like ERC1155 and ERC223, by implementing the required fallbacks for those standards.
|
||||
|
||||
The Flash Wallet exposes two functions of interest: ``executeCall()`` and ``executeDelegateCall()``. The former executes a ``call`` and reverts if the callee reverts. The latter executes a ``delegatecall`` and reverts if the callee reverts.
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
/// @dev Execute an arbitrary call. Only an authority can call this.
|
||||
/// @param target The call target.
|
||||
/// @param callData The call data.
|
||||
/// @param value Ether to attach to the call.
|
||||
/// @return resultData The data returned by the call.
|
||||
function executeCall(
|
||||
address payable target,
|
||||
bytes calldata callData,
|
||||
uint256 value
|
||||
)
|
||||
external
|
||||
payable
|
||||
override
|
||||
onlyOwner
|
||||
returns (bytes memory resultData);
|
||||
|
||||
/// @dev Execute an arbitrary delegatecall, in the context of this puppet.
|
||||
/// Only an authority can call this.
|
||||
/// @param target The call target.
|
||||
/// @param callData The call data.
|
||||
/// @return resultData The data returned by the call.
|
||||
function executeDelegateCall(
|
||||
address payable target,
|
||||
bytes calldata callData
|
||||
)
|
||||
external
|
||||
payable
|
||||
override
|
||||
onlyOwner
|
||||
returns (bytes memory resultData);
|
||||
|
||||
View the code for the Flash Wallet `here <https://github.com/0xProject/protocol/blob/development/contracts/zero-ex/contracts/src/external/FlashWallet.sol>`_.
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user