Compare commits
3 Commits
@0x/contra
...
feat/OtcOr
Author | SHA1 | Date | |
---|---|---|---|
|
c82ce2bdf9 | ||
|
1170c90141 | ||
|
cb7916789b |
@@ -1,10 +1,5 @@
|
||||
version: 2.1
|
||||
|
||||
parameters:
|
||||
cache_version:
|
||||
type: string
|
||||
default: v3
|
||||
|
||||
jobs:
|
||||
build:
|
||||
resource_class: xlarge
|
||||
@@ -17,9 +12,6 @@ jobs:
|
||||
- checkout
|
||||
- run: git submodule update --init --recursive
|
||||
- run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- run:
|
||||
name: install-yarn
|
||||
command: npm install --force --global yarn@1.22.0
|
||||
@@ -27,102 +19,74 @@ jobs:
|
||||
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:ci || yarn build:ci || yarn build:ci || yarn build:ci || yarn build:ci || yarn build:ci
|
||||
- save_cache:
|
||||
key: repo-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
key: repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo
|
||||
- ~/.cache/yarn
|
||||
- store_artifacts:
|
||||
path: ~/repo/packages/abi-gen/test-cli/output
|
||||
- store_artifacts:
|
||||
path: ~/repo/packages/contract-wrappers/generated_docs
|
||||
test-exchange-ganache:
|
||||
resource_class: xlarge
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: node:16
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun -p @0x/contracts-exchange -m --serial -c test:circleci
|
||||
test-integrations-ganache:
|
||||
resource_class: xlarge
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: node:16
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun -p @0x/contracts-integrations -m --serial -c test:circleci
|
||||
test-contracts-staking-ganache:
|
||||
resource_class: xlarge
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: node:16
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun -p @0x/contracts-staking -m --serial -c test:circleci
|
||||
test-contracts-extra-ganache:
|
||||
resource_class: xlarge
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: node:16
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ checksum "yarn.lock" }}
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun -p @0x/contracts-exchange-forwarder -p @0x/contracts-coordinator -m --serial -c test:circleci
|
||||
test-contracts-rest-ganache:
|
||||
resource_class: xlarge
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: node:16
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- checkout
|
||||
- run: |
|
||||
git diff --name-only development >> changed.txt
|
||||
if ! grep -q \.sol changed.txt; then
|
||||
circleci-agent step halt
|
||||
fi
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- 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
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- 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-foundry:
|
||||
resource_class: xlarge
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: ghcr.io/foundry-rs/foundry:latest
|
||||
working_directory: ~/repo/contracts/zero-ex
|
||||
steps:
|
||||
- checkout
|
||||
- run: |
|
||||
git diff --name-only development >> changed.txt
|
||||
if ! grep -q \.sol changed.txt; then
|
||||
circleci-agent step halt
|
||||
fi
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
# - run: forge install
|
||||
- run: forge test
|
||||
test-publish:
|
||||
@@ -134,15 +98,9 @@ jobs:
|
||||
- image: 0xorg/verdaccio
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- checkout
|
||||
- run: |
|
||||
git diff --name-only development >> changed.txt
|
||||
if ! grep -q packages/ changed.txt; then
|
||||
circleci-agent step halt
|
||||
fi
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run:
|
||||
command: yarn test:publish:circleci
|
||||
no_output_timeout: 1800
|
||||
@@ -153,10 +111,9 @@ jobs:
|
||||
- image: node:16
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run:
|
||||
command: yarn test:generate_docs:circleci
|
||||
no_output_timeout: 1200
|
||||
@@ -167,48 +124,40 @@ jobs:
|
||||
environment:
|
||||
RUST_ROUTER: 'true'
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun -p @0x/contracts-test-utils -m --serial -c test:circleci
|
||||
- run: yarn wsrun -p @0x/contract-addresses -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/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-{{ checksum "yarn.lock" }}
|
||||
key: coverage-contract-wrappers-test-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/contract-wrappers-test/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-order-utils-{{ checksum "yarn.lock" }}
|
||||
key: coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/order-utils/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-web3-wrapper-{{ checksum "yarn.lock" }}
|
||||
key: coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/web3-wrapper/coverage/lcov.info
|
||||
static-tests:
|
||||
resource_class: large
|
||||
working_directory: ~/repo
|
||||
docker:
|
||||
- image: node:16
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- run:
|
||||
command: yarn lerna run lint
|
||||
working_directory: ~/repo
|
||||
- run:
|
||||
command: yarn prettier:ci
|
||||
working_directory: ~/repo
|
||||
- run:
|
||||
command: yarn deps_versions:ci
|
||||
working_directory: ~/repo
|
||||
- run:
|
||||
command: yarn diff_md_docs:ci
|
||||
working_directory: ~/repo
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn lerna run lint
|
||||
- run: yarn prettier:ci
|
||||
- run: yarn deps_versions:ci
|
||||
- run: yarn diff_md_docs:ci
|
||||
submit-coverage:
|
||||
docker:
|
||||
- image: node:16
|
||||
@@ -216,16 +165,16 @@ jobs:
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-contract-wrappers-test-{{ checksum "yarn.lock" }}
|
||||
- coverage-contract-wrappers-test-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-order-utils-{{ checksum "yarn.lock" }}
|
||||
- coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-contracts-{{ checksum "yarn.lock" }}
|
||||
- coverage-contracts-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn report_coverage
|
||||
workflows:
|
||||
version: 2
|
||||
|
13
README.md
13
README.md
@@ -34,6 +34,7 @@ These packages are all under development. See [/contracts/README.md](/contracts/
|
||||
|
||||
| Package | Version | Description |
|
||||
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
||||
| [`@0x/asset-swapper`](/packages/asset-swapper) | [](https://www.npmjs.com/package/@0x/asset-swapper) | Package used to find and create aggregated swaps |
|
||||
| [`@0x/protocol-utils`](/packages/protocol-utils) | [](https://www.npmjs.com/package/@0x/protocol-utils) | A set of utilities for generating, parsing, signing and validating 0x orders |
|
||||
| [`@0x/contract-addresses`](/packages/contract-addresses) | [](https://www.npmjs.com/package/@0x/contract-addresses) | A tiny utility library for getting known deployed contract addresses for a particular network. |
|
||||
| [`@0x/contract-wrappers`](/packages/contract-wrappers) | [](https://www.npmjs.com/package/@0x/contract-wrappers) | JS/TS wrappers for interacting with the 0x smart contracts |
|
||||
@@ -81,7 +82,7 @@ yarn build
|
||||
To build a specific package:
|
||||
|
||||
```bash
|
||||
PKG=@0x/protocol-utils yarn build
|
||||
PKG=@0x/asset-swapper yarn build
|
||||
```
|
||||
|
||||
To build all contracts packages:
|
||||
@@ -104,7 +105,7 @@ To watch a specific package and all it's dependent packages:
|
||||
PKG=[NPM_PACKAGE_NAME] yarn watch
|
||||
|
||||
e.g
|
||||
PKG=@0x/protocol-utils yarn watch
|
||||
PKG=@0x/asset-swapper yarn watch
|
||||
```
|
||||
|
||||
### Clean
|
||||
@@ -118,7 +119,7 @@ yarn clean
|
||||
Clean a specific package
|
||||
|
||||
```bash
|
||||
PKG=@0x/protocol-utils yarn clean
|
||||
PKG=@0x/asset-swapper yarn clean
|
||||
```
|
||||
|
||||
### Rebuild
|
||||
@@ -132,7 +133,7 @@ yarn rebuild
|
||||
To re-build (clean & build) a specific package & it's deps:
|
||||
|
||||
```bash
|
||||
PKG=@0x/protocol-utils yarn rebuild
|
||||
PKG=@0x/asset-swapper yarn rebuild
|
||||
```
|
||||
|
||||
### Lint
|
||||
@@ -146,7 +147,7 @@ yarn lint
|
||||
Lint a specific package:
|
||||
|
||||
```bash
|
||||
PKG=@0x/protocol-utils yarn lint
|
||||
PKG=@0x/asset-swapper yarn lint
|
||||
```
|
||||
|
||||
### Run Tests
|
||||
@@ -160,7 +161,7 @@ yarn test
|
||||
Run a specific package's test:
|
||||
|
||||
```bash
|
||||
PKG=@0x/protocol-utils yarn test
|
||||
PKG=@0x/asset-swapper yarn test
|
||||
```
|
||||
|
||||
Run all contracts packages tests:
|
||||
|
@@ -1,31 +1,4 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1661462289,
|
||||
"version": "3.3.39",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1661459661,
|
||||
"version": "3.3.38",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1661145612,
|
||||
"version": "3.3.37",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1660093941,
|
||||
"version": "3.3.36",
|
||||
|
@@ -5,18 +5,6 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.3.39 - _August 25, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.3.38 - _August 25, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.3.37 - _August 22, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.3.36 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-erc20",
|
||||
"version": "3.3.39",
|
||||
"version": "3.3.36",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -51,18 +51,18 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contracts-gen": "^2.0.47",
|
||||
"@0x/contracts-test-utils": "^5.4.30",
|
||||
"@0x/contracts-utils": "^4.8.20",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
"@0x/abi-gen": "^5.8.0",
|
||||
"@0x/contracts-gen": "^2.0.46",
|
||||
"@0x/contracts-test-utils": "^5.4.27",
|
||||
"@0x/contracts-utils": "^4.8.17",
|
||||
"@0x/dev-utils": "^4.2.14",
|
||||
"@0x/sol-compiler": "^4.8.1",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"@0x/utils": "^6.5.3",
|
||||
"@0x/web3-wrapper": "^7.6.5",
|
||||
"@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.7.1",
|
||||
"ethereum-types": "^3.7.0",
|
||||
"lodash": "^4.17.11",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^6.2.0",
|
||||
@@ -82,7 +82,7 @@
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/base-contract": "^6.5.0",
|
||||
"ethers": "~4.0.4"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -1,31 +1,4 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1661462289,
|
||||
"version": "5.4.30",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1661459661,
|
||||
"version": "5.4.29",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1661145612,
|
||||
"version": "5.4.28",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1660093941,
|
||||
"version": "5.4.27",
|
||||
|
@@ -5,18 +5,6 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v5.4.30 - _August 25, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v5.4.29 - _August 25, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v5.4.28 - _August 22, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v5.4.27 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-test-utils",
|
||||
"version": "5.4.30",
|
||||
"version": "5.4.27",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -34,7 +34,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/test-utils",
|
||||
"devDependencies": {
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
"@0x/sol-compiler": "^4.8.1",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
@@ -42,20 +42,20 @@
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.35",
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/contract-addresses": "^6.22.0",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/assert": "^3.0.34",
|
||||
"@0x/base-contract": "^6.5.0",
|
||||
"@0x/contract-addresses": "^6.19.2",
|
||||
"@0x/dev-utils": "^4.2.14",
|
||||
"@0x/json-schemas": "^6.4.4",
|
||||
"@0x/order-utils": "^10.4.28",
|
||||
"@0x/sol-coverage": "^4.0.46",
|
||||
"@0x/sol-profiler": "^4.1.36",
|
||||
"@0x/sol-trace": "^3.0.46",
|
||||
"@0x/subproviders": "^7.0.0",
|
||||
"@0x/sol-coverage": "^4.0.45",
|
||||
"@0x/sol-profiler": "^4.1.35",
|
||||
"@0x/sol-trace": "^3.0.45",
|
||||
"@0x/subproviders": "^6.6.5",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"@0x/utils": "^6.5.3",
|
||||
"@0x/web3-wrapper": "^7.6.5",
|
||||
"@types/bn.js": "^4.11.0",
|
||||
"@types/js-combinatorics": "^0.5.29",
|
||||
"@types/lodash": "4.14.104",
|
||||
@@ -67,7 +67,7 @@
|
||||
"chai-bignumber": "^3.0.0",
|
||||
"decimal.js": "^10.2.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"ethereum-types": "^3.7.1",
|
||||
"ethereum-types": "^3.7.0",
|
||||
"ethereumjs-util": "^7.0.10",
|
||||
"ethers": "~4.0.4",
|
||||
"js-combinatorics": "^0.5.3",
|
||||
|
@@ -38,7 +38,7 @@ async function _getGanacheOrGethErrorAsync(ganacheError: string, gethError: stri
|
||||
}
|
||||
|
||||
async function _getInsufficientFundsErrorMessageAsync(): Promise<string> {
|
||||
return _getGanacheOrGethErrorAsync('insufficient funds for gas * price + value', 'insufficient funds');
|
||||
return _getGanacheOrGethErrorAsync("sender doesn't have enough funds", 'insufficient funds');
|
||||
}
|
||||
|
||||
async function _getTransactionFailedErrorMessageAsync(): Promise<string> {
|
||||
|
@@ -1,31 +1,4 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1661462289,
|
||||
"version": "1.4.22",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1661459661,
|
||||
"version": "1.4.21",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1661145612,
|
||||
"version": "1.4.20",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1660093941,
|
||||
"version": "1.4.19",
|
||||
|
@@ -5,18 +5,6 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.4.22 - _August 25, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.4.21 - _August 25, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.4.20 - _August 22, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.4.19 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-treasury",
|
||||
"version": "1.4.22",
|
||||
"version": "1.4.19",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -46,14 +46,14 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contract-addresses": "^6.22.0",
|
||||
"@0x/abi-gen": "^5.8.0",
|
||||
"@0x/contract-addresses": "^6.19.2",
|
||||
"@0x/contracts-asset-proxy": "^3.7.19",
|
||||
"@0x/contracts-erc20": "^3.3.39",
|
||||
"@0x/contracts-gen": "^2.0.47",
|
||||
"@0x/contracts-erc20": "^3.3.36",
|
||||
"@0x/contracts-gen": "^2.0.46",
|
||||
"@0x/contracts-staking": "^2.0.45",
|
||||
"@0x/contracts-test-utils": "^5.4.30",
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
"@0x/contracts-test-utils": "^5.4.27",
|
||||
"@0x/sol-compiler": "^4.8.1",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@types/isomorphic-fetch": "^0.0.35",
|
||||
@@ -72,14 +72,14 @@
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/protocol-utils": "^11.16.6",
|
||||
"@0x/subproviders": "^7.0.0",
|
||||
"@0x/base-contract": "^6.5.0",
|
||||
"@0x/protocol-utils": "^11.16.3",
|
||||
"@0x/subproviders": "^6.6.5",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"ethereum-types": "^3.7.1",
|
||||
"@0x/utils": "^6.5.3",
|
||||
"@0x/web3-wrapper": "^7.6.5",
|
||||
"ethereum-types": "^3.7.0",
|
||||
"ethereumjs-util": "^7.0.10"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -1,31 +1,4 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1661462289,
|
||||
"version": "4.8.20",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1661459661,
|
||||
"version": "4.8.19",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1661145612,
|
||||
"version": "4.8.18",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1660093941,
|
||||
"version": "4.8.17",
|
||||
|
@@ -5,18 +5,6 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v4.8.20 - _August 25, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.8.19 - _August 25, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.8.18 - _August 22, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.8.17 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-utils",
|
||||
"version": "4.8.20",
|
||||
"version": "4.8.17",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -50,15 +50,15 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/utils",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contracts-gen": "^2.0.47",
|
||||
"@0x/contracts-test-utils": "^5.4.30",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/abi-gen": "^5.8.0",
|
||||
"@0x/contracts-gen": "^2.0.46",
|
||||
"@0x/contracts-test-utils": "^5.4.27",
|
||||
"@0x/dev-utils": "^4.2.14",
|
||||
"@0x/order-utils": "^10.4.28",
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
"@0x/sol-compiler": "^4.8.1",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"@0x/web3-wrapper": "^7.6.5",
|
||||
"@types/bn.js": "^4.11.0",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
@@ -79,11 +79,11 @@
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/base-contract": "^6.5.0",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@0x/utils": "^6.5.3",
|
||||
"bn.js": "^4.11.8",
|
||||
"ethereum-types": "^3.7.1"
|
||||
"ethereum-types": "^3.7.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -1,28 +1,9 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1661462289,
|
||||
"version": "0.36.6",
|
||||
"version": "0.37.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1661459661,
|
||||
"version": "0.36.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1661145612,
|
||||
"version": "0.36.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
"note": "Add support for OTC orders in the FillQuoteTransformer"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@@ -5,18 +5,6 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.36.6 - _August 25, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.36.5 - _August 25, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.36.4 - _August 22, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.36.3 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -31,6 +31,7 @@ import "../features/libs/LibNativeOrder.sol";
|
||||
import "./bridges/IBridgeAdapter.sol";
|
||||
import "./Transformer.sol";
|
||||
import "./LibERC20Transformer.sol";
|
||||
import "../IZeroEx.sol";
|
||||
|
||||
/// @dev A transformer that fills an ERC20 market sell/buy quote.
|
||||
/// This transformer shortcuts bridge orders and fills them directly
|
||||
@@ -52,7 +53,8 @@ contract FillQuoteTransformer is
|
||||
enum OrderType {
|
||||
Bridge,
|
||||
Limit,
|
||||
Rfq
|
||||
Rfq,
|
||||
Otc
|
||||
}
|
||||
|
||||
struct LimitOrderInfo {
|
||||
@@ -62,6 +64,13 @@ contract FillQuoteTransformer is
|
||||
uint256 maxTakerTokenFillAmount;
|
||||
}
|
||||
|
||||
struct OtcOrderInfo {
|
||||
LibNativeOrder.OtcOrder order;
|
||||
LibSignature.Signature signature;
|
||||
// Maximum taker token amount of this limit order to fill.
|
||||
uint256 maxTakerTokenFillAmount;
|
||||
}
|
||||
|
||||
struct RfqOrderInfo {
|
||||
LibNativeOrder.RfqOrder order;
|
||||
LibSignature.Signature signature;
|
||||
@@ -84,6 +93,8 @@ contract FillQuoteTransformer is
|
||||
IBridgeAdapter.BridgeOrder[] bridgeOrders;
|
||||
// Native limit orders. Sorted by fill sequence.
|
||||
LimitOrderInfo[] limitOrders;
|
||||
// Otc orders. Sorted by fill sequence.
|
||||
OtcOrderInfo[] otcOrders;
|
||||
// Native RFQ orders. Sorted by fill sequence.
|
||||
RfqOrderInfo[] rfqOrders;
|
||||
|
||||
@@ -123,7 +134,7 @@ contract FillQuoteTransformer is
|
||||
uint256 soldAmount;
|
||||
uint256 protocolFee;
|
||||
uint256 takerTokenBalanceRemaining;
|
||||
uint256[3] currentIndices;
|
||||
uint256[4] currentIndices;
|
||||
OrderType currentOrderType;
|
||||
}
|
||||
|
||||
@@ -147,12 +158,12 @@ contract FillQuoteTransformer is
|
||||
IBridgeAdapter public immutable bridgeAdapter;
|
||||
|
||||
/// @dev The exchange proxy contract.
|
||||
INativeOrdersFeature public immutable zeroEx;
|
||||
IZeroEx public immutable zeroEx;
|
||||
|
||||
/// @dev Create this contract.
|
||||
/// @param bridgeAdapter_ The bridge adapter contract.
|
||||
/// @param zeroEx_ The Exchange Proxy contract.
|
||||
constructor(IBridgeAdapter bridgeAdapter_, INativeOrdersFeature zeroEx_)
|
||||
constructor(IBridgeAdapter bridgeAdapter_, IZeroEx zeroEx_)
|
||||
public
|
||||
Transformer()
|
||||
{
|
||||
@@ -172,7 +183,6 @@ contract FillQuoteTransformer is
|
||||
{
|
||||
TransformData memory data = abi.decode(context.data, (TransformData));
|
||||
FillState memory state;
|
||||
|
||||
// Validate data fields.
|
||||
if (data.sellToken.isTokenETH() || data.buyToken.isTokenETH()) {
|
||||
LibTransformERC20RichErrors.InvalidTransformDataError(
|
||||
@@ -183,6 +193,7 @@ contract FillQuoteTransformer is
|
||||
|
||||
if (data.bridgeOrders.length
|
||||
+ data.limitOrders.length
|
||||
+ data.otcOrders.length
|
||||
+ data.rfqOrders.length != data.fillSequence.length
|
||||
) {
|
||||
LibTransformERC20RichErrors.InvalidTransformDataError(
|
||||
@@ -198,7 +209,7 @@ contract FillQuoteTransformer is
|
||||
|
||||
// Approve the exchange proxy to spend our sell tokens if native orders
|
||||
// are present.
|
||||
if (data.limitOrders.length + data.rfqOrders.length != 0) {
|
||||
if (data.limitOrders.length + data.rfqOrders.length + data.otcOrders.length != 0) {
|
||||
data.sellToken.approveIfBelow(address(zeroEx), data.fillAmount);
|
||||
// Compute the protocol fee if a limit order is present.
|
||||
if (data.limitOrders.length != 0) {
|
||||
@@ -222,6 +233,7 @@ contract FillQuoteTransformer is
|
||||
|
||||
state.currentOrderType = OrderType(data.fillSequence[i]);
|
||||
uint256 orderIndex = state.currentIndices[uint256(state.currentOrderType)];
|
||||
|
||||
// Fill the order.
|
||||
FillOrderResults memory results;
|
||||
if (state.currentOrderType == OrderType.Bridge) {
|
||||
@@ -230,6 +242,8 @@ contract FillQuoteTransformer is
|
||||
results = _fillLimitOrder(data.limitOrders[orderIndex], data, state);
|
||||
} else if (state.currentOrderType == OrderType.Rfq) {
|
||||
results = _fillRfqOrder(data.rfqOrders[orderIndex], data, state);
|
||||
} else if (state.currentOrderType == OrderType.Otc) {
|
||||
results = _fillOtcOrder(data.otcOrders[orderIndex], data, state);
|
||||
} else {
|
||||
revert("INVALID_ORDER_TYPE");
|
||||
}
|
||||
@@ -402,6 +416,42 @@ contract FillQuoteTransformer is
|
||||
} catch {}
|
||||
}
|
||||
|
||||
// Fill a single OTC order.
|
||||
function _fillOtcOrder(
|
||||
OtcOrderInfo memory orderInfo,
|
||||
TransformData memory data,
|
||||
FillState memory state
|
||||
)
|
||||
private
|
||||
returns (FillOrderResults memory results)
|
||||
{
|
||||
|
||||
uint256 takerTokenFillAmount = LibSafeMathV06.min256(
|
||||
_computeTakerTokenFillAmount(
|
||||
data,
|
||||
state,
|
||||
orderInfo.order.takerAmount,
|
||||
orderInfo.order.makerAmount,
|
||||
0
|
||||
),
|
||||
orderInfo.maxTakerTokenFillAmount
|
||||
);
|
||||
try
|
||||
zeroEx.fillOtcOrder
|
||||
(
|
||||
orderInfo.order,
|
||||
orderInfo.signature,
|
||||
takerTokenFillAmount.safeDowncastToUint128()
|
||||
)
|
||||
returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount)
|
||||
{
|
||||
results.takerTokenSoldAmount = takerTokenFilledAmount;
|
||||
results.makerTokenBoughtAmount = makerTokenFilledAmount;
|
||||
} catch {
|
||||
revert("FillQuoteTransformer/OTC_ORDER_FILL_FAILED");
|
||||
}
|
||||
}
|
||||
|
||||
// Compute the next taker token fill amount of a generic order.
|
||||
function _computeTakerTokenFillAmount(
|
||||
TransformData memory data,
|
||||
|
@@ -1,113 +0,0 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
/*
|
||||
|
||||
Copyright 2022 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 "./AbstractBridgeAdapter.sol";
|
||||
import "./BridgeProtocols.sol";
|
||||
import "./mixins/MixinBalancerV2.sol";
|
||||
import "./mixins/MixinCurve.sol";
|
||||
import "./mixins/MixinDodoV2.sol";
|
||||
import "./mixins/MixinGMX.sol";
|
||||
import "./mixins/MixinUniswapV3.sol";
|
||||
import "./mixins/MixinZeroExBridge.sol";
|
||||
|
||||
contract ArbitrumBridgeAdapter is
|
||||
AbstractBridgeAdapter(42161, "Arbitrum"),
|
||||
MixinBalancerV2,
|
||||
MixinCurve,
|
||||
MixinDodoV2,
|
||||
MixinGMX,
|
||||
MixinUniswapV3,
|
||||
MixinZeroExBridge
|
||||
{
|
||||
constructor(IEtherTokenV06 weth)
|
||||
public
|
||||
MixinCurve(weth)
|
||||
{}
|
||||
|
||||
function _trade(
|
||||
BridgeOrder memory order,
|
||||
IERC20TokenV06 sellToken,
|
||||
IERC20TokenV06 buyToken,
|
||||
uint256 sellAmount,
|
||||
bool dryRun
|
||||
)
|
||||
internal
|
||||
override
|
||||
returns (uint256 boughtAmount, bool supportedSource)
|
||||
{
|
||||
uint128 protocolId = uint128(uint256(order.source) >> 128);
|
||||
if (protocolId == BridgeProtocols.BALANCERV2) {
|
||||
if (dryRun) { return (0, true); }
|
||||
boughtAmount = _tradeBalancerV2(
|
||||
sellToken,
|
||||
buyToken,
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.CURVE) {
|
||||
if (dryRun) { return (0, true); }
|
||||
boughtAmount = _tradeCurve(
|
||||
sellToken,
|
||||
buyToken,
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.DODOV2) {
|
||||
if (dryRun) { return (0, true); }
|
||||
boughtAmount = _tradeDodoV2(
|
||||
sellToken,
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.UNISWAPV3) {
|
||||
if (dryRun) { return (0, true); }
|
||||
boughtAmount = _tradeUniswapV3(
|
||||
sellToken,
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.GMX) {
|
||||
if (dryRun) { return (0, true); }
|
||||
boughtAmount = _tradeGMX(
|
||||
sellToken,
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
} else if (protocolId == BridgeProtocols.UNKNOWN) {
|
||||
if (dryRun) { return (0, true); }
|
||||
boughtAmount = _tradeZeroExBridge(
|
||||
sellToken,
|
||||
buyToken,
|
||||
sellAmount,
|
||||
order.bridgeData
|
||||
);
|
||||
}
|
||||
|
||||
emit BridgeFill(
|
||||
order.source,
|
||||
sellToken,
|
||||
buyToken,
|
||||
sellAmount,
|
||||
boughtAmount
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-zero-ex",
|
||||
"version": "0.36.6",
|
||||
"version": "0.36.3",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -20,6 +20,7 @@
|
||||
"test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
|
||||
"test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
|
||||
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
|
||||
"fqt": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' -g 'sell quotes' --timeout 100000 --bail --exit",
|
||||
"compile": "sol-compiler",
|
||||
"watch": "sol-compiler -w",
|
||||
"clean": "shx rm -rf lib test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
|
||||
@@ -56,14 +57,14 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contract-addresses": "^6.22.0",
|
||||
"@0x/contracts-erc20": "^3.3.39",
|
||||
"@0x/contracts-gen": "^2.0.47",
|
||||
"@0x/contracts-test-utils": "^5.4.30",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/abi-gen": "^5.8.0",
|
||||
"@0x/contract-addresses": "^6.19.2",
|
||||
"@0x/contracts-erc20": "^3.3.36",
|
||||
"@0x/contracts-gen": "^2.0.46",
|
||||
"@0x/contracts-test-utils": "^5.4.27",
|
||||
"@0x/dev-utils": "^4.2.14",
|
||||
"@0x/order-utils": "^10.4.28",
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
"@0x/sol-compiler": "^4.8.1",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@typechain/ethers-v5": "^10.0.0",
|
||||
@@ -85,14 +86,14 @@
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/protocol-utils": "^11.16.6",
|
||||
"@0x/subproviders": "^7.0.0",
|
||||
"@0x/base-contract": "^6.5.0",
|
||||
"@0x/protocol-utils": "^11.16.3",
|
||||
"@0x/subproviders": "^6.6.5",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"ethereum-types": "^3.7.1",
|
||||
"@0x/utils": "^6.5.3",
|
||||
"@0x/web3-wrapper": "^7.6.5",
|
||||
"ethereum-types": "^3.7.0",
|
||||
"ethereumjs-util": "^7.0.10",
|
||||
"ethers": "~4.0.4"
|
||||
},
|
||||
|
@@ -30,7 +30,7 @@ blockchainTests.resets('MetaTransactions feature', env => {
|
||||
let maker: string;
|
||||
let sender: string;
|
||||
let notSigner: string;
|
||||
const signers: string[] = [];
|
||||
let signers: string[];
|
||||
let zeroEx: IZeroExContract;
|
||||
let feature: MetaTransactionsFeatureContract;
|
||||
let feeToken: TestMintableERC20TokenContract;
|
||||
@@ -45,8 +45,7 @@ blockchainTests.resets('MetaTransactions feature', env => {
|
||||
const REENTRANCY_FLAG_MTX = 0x1;
|
||||
|
||||
before(async () => {
|
||||
let possibleSigners: string[];
|
||||
[owner, maker, sender, notSigner, ...possibleSigners] = await env.getAccountAddressesAsync();
|
||||
[owner, maker, sender, notSigner, ...signers] = await env.getAccountAddressesAsync();
|
||||
transformERC20Feature = await TestMetaTransactionsTransformERC20FeatureContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TestMetaTransactionsTransformERC20Feature,
|
||||
env.provider,
|
||||
@@ -75,26 +74,20 @@ blockchainTests.resets('MetaTransactions feature', env => {
|
||||
env.txDefaults,
|
||||
{},
|
||||
);
|
||||
|
||||
// some accounts returned can be unfunded
|
||||
for (const possibleSigner of possibleSigners) {
|
||||
const balance = await env.web3Wrapper.getBalanceInWeiAsync(possibleSigner);
|
||||
if (balance.isGreaterThan(0)) {
|
||||
signers.push(possibleSigner);
|
||||
await feeToken
|
||||
.approve(zeroEx.address, MAX_FEE_AMOUNT)
|
||||
.awaitTransactionSuccessAsync({ from: possibleSigner });
|
||||
await feeToken.mint(possibleSigner, MAX_FEE_AMOUNT).awaitTransactionSuccessAsync();
|
||||
}
|
||||
}
|
||||
// Fund signers with fee tokens.
|
||||
await Promise.all(
|
||||
signers.map(async signer => {
|
||||
await feeToken.mint(signer, MAX_FEE_AMOUNT).awaitTransactionSuccessAsync();
|
||||
await feeToken.approve(zeroEx.address, MAX_FEE_AMOUNT).awaitTransactionSuccessAsync({ from: signer });
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
function getRandomMetaTransaction(fields: Partial<MetaTransactionFields> = {}): MetaTransaction {
|
||||
return new MetaTransaction({
|
||||
signer: _.sampleSize(signers)[0],
|
||||
sender,
|
||||
// TODO: dekz Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
|
||||
minGasPrice: ZERO_AMOUNT,
|
||||
minGasPrice: getRandomInteger('2', '1e9'),
|
||||
maxGasPrice: getRandomInteger('1e9', '100e9'),
|
||||
expirationTimeSeconds: new BigNumber(Math.floor(_.now() / 1000) + 360),
|
||||
salt: new BigNumber(hexUtils.random()),
|
||||
@@ -152,7 +145,6 @@ blockchainTests.resets('MetaTransactions feature', env => {
|
||||
gasPrice: mtx.minGasPrice,
|
||||
value: mtx.value,
|
||||
};
|
||||
|
||||
const rawResult = await feature.executeMetaTransaction(mtx, signature).callAsync(callOpts);
|
||||
expect(rawResult).to.eq(RAW_ORDER_SUCCESS_RESULT);
|
||||
const receipt = await feature.executeMetaTransaction(mtx, signature).awaitTransactionSuccessAsync(callOpts);
|
||||
@@ -442,8 +434,7 @@ blockchainTests.resets('MetaTransactions feature', env => {
|
||||
);
|
||||
});
|
||||
|
||||
// Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
|
||||
it.skip('fails if gas price too low', async () => {
|
||||
it('fails if gas price too low', async () => {
|
||||
const mtx = getRandomMetaTransaction();
|
||||
const mtxHash = mtx.getHash();
|
||||
const signature = await mtx.getSignatureWithProviderAsync(env.provider);
|
||||
@@ -462,8 +453,7 @@ blockchainTests.resets('MetaTransactions feature', env => {
|
||||
);
|
||||
});
|
||||
|
||||
// Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
|
||||
it.skip('fails if gas price too high', async () => {
|
||||
it('fails if gas price too high', async () => {
|
||||
const mtx = getRandomMetaTransaction();
|
||||
const mtxHash = mtx.getHash();
|
||||
const signature = await mtx.getSignatureWithProviderAsync(env.provider);
|
||||
|
@@ -938,8 +938,7 @@ blockchainTests.resets('NativeOrdersFeature', env => {
|
||||
);
|
||||
});
|
||||
|
||||
// TODO: dekz Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
|
||||
it.skip('fails if no protocol fee attached', async () => {
|
||||
it('fails if no protocol fee attached', async () => {
|
||||
const order = getTestLimitOrder();
|
||||
await testUtils.prepareBalancesForOrdersAsync([order]);
|
||||
const tx = zeroEx
|
||||
|
@@ -10,8 +10,7 @@ import {
|
||||
TestWethContract,
|
||||
} from './wrappers';
|
||||
|
||||
// TODO: dekz Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
|
||||
blockchainTests.resets.skip('ProtocolFees', env => {
|
||||
blockchainTests.resets('ProtocolFees', env => {
|
||||
const FEE_MULTIPLIER = 70e3;
|
||||
let taker: string;
|
||||
let unauthorized: string;
|
||||
@@ -63,7 +62,7 @@ blockchainTests.resets.skip('ProtocolFees', env => {
|
||||
it('should disallow unauthorized initialization', async () => {
|
||||
const pool = hexUtils.random();
|
||||
|
||||
await protocolFees.collectProtocolFee(pool).awaitTransactionSuccessAsync({ value: 1e9 });
|
||||
await protocolFees.collectProtocolFee(pool).awaitTransactionSuccessAsync({ value: singleFeeAmount });
|
||||
await protocolFees.transferFeesForPool(pool).awaitTransactionSuccessAsync();
|
||||
|
||||
const feeCollector = new FeeCollectorContract(
|
||||
@@ -90,7 +89,6 @@ blockchainTests.resets.skip('ProtocolFees', env => {
|
||||
feeCollector2Address = await protocolFees.getFeeCollector(pool2).callAsync();
|
||||
});
|
||||
|
||||
// Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
|
||||
it('should revert if insufficient ETH transferred', async () => {
|
||||
const tooLittle = singleFeeAmount.minus(1);
|
||||
const tx = protocolFees.collectProtocolFee(pool1).awaitTransactionSuccessAsync({ value: tooLittle });
|
||||
|
@@ -12,21 +12,26 @@ import {
|
||||
FillQuoteTransformerData,
|
||||
FillQuoteTransformerLimitOrderInfo,
|
||||
FillQuoteTransformerOrderType as OrderType,
|
||||
FillQuoteTransformerOtcOrderInfo,
|
||||
FillQuoteTransformerRfqOrderInfo,
|
||||
FillQuoteTransformerSide as Side,
|
||||
LimitOrder,
|
||||
LimitOrderFields,
|
||||
OtcOrder,
|
||||
OtcOrderFields,
|
||||
RfqOrder,
|
||||
RfqOrderFields,
|
||||
Signature,
|
||||
} from '@0x/protocol-utils';
|
||||
import { BigNumber, hexUtils, ZeroExRevertErrors } from '@0x/utils';
|
||||
import { assert } from 'chai';
|
||||
import { TransactionReceiptWithDecodedLogs as TxReceipt } from 'ethereum-types';
|
||||
import { ethers } from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { artifacts } from '../artifacts';
|
||||
import { TestFillQuoteTransformerBridgeContract } from '../generated-wrappers/test_fill_quote_transformer_bridge';
|
||||
import { getRandomLimitOrder, getRandomRfqOrder } from '../utils/orders';
|
||||
import { getRandomLimitOrder, getRandomOtcOrder, getRandomRfqOrder } from '../utils/orders';
|
||||
import {
|
||||
EthereumBridgeAdapterContract,
|
||||
FillQuoteTransformerContract,
|
||||
@@ -132,6 +137,18 @@ blockchainTests.resets('FillQuoteTransformer', env => {
|
||||
});
|
||||
}
|
||||
|
||||
function createOtcOrder(fields: Partial<OtcOrderFields> = {}): OtcOrder {
|
||||
return getRandomOtcOrder({
|
||||
makerToken: makerToken.address,
|
||||
takerToken: takerToken.address,
|
||||
makerAmount: getRandomInteger('0.1e18', '1e18'),
|
||||
takerAmount: getRandomInteger('0.1e18', '1e18'),
|
||||
maker,
|
||||
taker,
|
||||
...fields,
|
||||
});
|
||||
}
|
||||
|
||||
function createBridgeOrder(fillRatio: Numberish = 1.0): BridgeOrder {
|
||||
const makerTokenAmount = getRandomInteger('0.1e18', '1e18');
|
||||
return {
|
||||
@@ -191,7 +208,7 @@ blockchainTests.resets('FillQuoteTransformer', env => {
|
||||
let soldAmount = ZERO_AMOUNT;
|
||||
let boughtAmount = ZERO_AMOUNT;
|
||||
const fillAmount = normalizeFillAmount(data.fillAmount, state.takerTokenBalance);
|
||||
const orderIndices = [0, 0, 0];
|
||||
const orderIndices = [0, 0, 0, 0];
|
||||
|
||||
function computeTakerTokenFillAmount(
|
||||
orderTakerTokenAmount: BigNumber,
|
||||
@@ -272,6 +289,24 @@ blockchainTests.resets('FillQuoteTransformer', env => {
|
||||
};
|
||||
}
|
||||
|
||||
function fillOtcOrder(oi: FillQuoteTransformerOtcOrderInfo): FillOrderResults {
|
||||
const preFilledTakerAmount = orderSignatureToPreFilledTakerAmount(oi.signature);
|
||||
if (preFilledTakerAmount.gte(oi.order.takerAmount) || preFilledTakerAmount.eq(REVERT_AMOUNT)) {
|
||||
return EMPTY_FILL_ORDER_RESULTS;
|
||||
}
|
||||
const takerTokenFillAmount = BigNumber.min(
|
||||
computeTakerTokenFillAmount(oi.order.takerAmount, oi.order.makerAmount),
|
||||
oi.order.takerAmount.minus(preFilledTakerAmount),
|
||||
oi.maxTakerTokenFillAmount,
|
||||
);
|
||||
const fillRatio = takerTokenFillAmount.div(oi.order.takerAmount);
|
||||
return {
|
||||
...EMPTY_FILL_ORDER_RESULTS,
|
||||
takerTokenSoldAmount: takerTokenFillAmount,
|
||||
makerTokenBoughtAmount: fillRatio.times(oi.order.makerAmount).integerValue(BigNumber.ROUND_DOWN),
|
||||
};
|
||||
}
|
||||
|
||||
// tslint:disable-next-line: prefer-for-of
|
||||
for (let i = 0; i < data.fillSequence.length; ++i) {
|
||||
const orderType = data.fillSequence[i];
|
||||
@@ -301,6 +336,11 @@ blockchainTests.resets('FillQuoteTransformer', env => {
|
||||
results = fillRfqOrder(data.rfqOrders[orderIndices[orderType]]);
|
||||
}
|
||||
break;
|
||||
case OrderType.Otc:
|
||||
{
|
||||
results = fillOtcOrder(data.otcOrders[orderIndices[orderType]]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Error('Unknown order type');
|
||||
}
|
||||
@@ -393,6 +433,7 @@ blockchainTests.resets('FillQuoteTransformer', env => {
|
||||
buyToken: makerToken.address,
|
||||
bridgeOrders: [],
|
||||
limitOrders: [],
|
||||
otcOrders: [],
|
||||
rfqOrders: [],
|
||||
fillSequence: [],
|
||||
fillAmount: MAX_UINT256,
|
||||
@@ -446,7 +487,7 @@ blockchainTests.resets('FillQuoteTransformer', env => {
|
||||
await assertCurrentBalancesAsync(exchange.address, { ...ZERO_BALANCES, ethBalance: qfr.protocolFeePaid });
|
||||
}
|
||||
|
||||
describe('sell quotes', () => {
|
||||
describe.only('sell quotes', () => {
|
||||
it('can fully sell to a single bridge order with -1 fillAmount', async () => {
|
||||
const bridgeOrders = [createBridgeOrder()];
|
||||
const data = createTransformData({
|
||||
@@ -662,6 +703,44 @@ blockchainTests.resets('FillQuoteTransformer', env => {
|
||||
return assertFinalBalancesAsync(qfr);
|
||||
});
|
||||
|
||||
it.only('can fully buy to a single OTC order', async () => {
|
||||
const ethersMakerWallet = ethers.Wallet.createRandom();
|
||||
const _otcOrder = createOtcOrder({maker: ethersMakerWallet.address});
|
||||
await makerToken.mint(ethersMakerWallet.address, MAX_UINT256).awaitTransactionSuccessAsync();
|
||||
await takerToken.mint(taker, MAX_UINT256).awaitTransactionSuccessAsync();
|
||||
let balMaker = await makerToken.balanceOf(ethersMakerWallet.address).callAsync();
|
||||
let balTaker = await takerToken.balanceOf(taker).callAsync();
|
||||
const otcOrders = [_otcOrder];
|
||||
const totalTakerTokens = BigNumber.sum(...otcOrders.map(o => o.takerAmount));
|
||||
const _otcOrderSignature = await ethersMakerWallet.signMessage(ethers.utils.arrayify(_otcOrder.getHash()));
|
||||
const { v, r, s } = ethers.utils.splitSignature(_otcOrderSignature);
|
||||
const _orderSignature : Signature = {
|
||||
v : v!,
|
||||
r,
|
||||
s,
|
||||
signatureType: 3
|
||||
};
|
||||
const data = createTransformData({
|
||||
side: Side.Buy,
|
||||
otcOrders: otcOrders.map(o => ({
|
||||
order: o,
|
||||
maxTakerTokenFillAmount: MAX_UINT256,
|
||||
signature: _orderSignature,
|
||||
})),
|
||||
fillAmount: BigNumber.sum(...otcOrders.map(o => o.makerAmount)),
|
||||
fillSequence: otcOrders.map(() => OrderType.Otc),
|
||||
});
|
||||
const qfr = getExpectedQuoteFillResults(
|
||||
data,
|
||||
createSimulationState({ takerTokenBalance: totalTakerTokens }),
|
||||
);
|
||||
await executeTransformAsync({
|
||||
data,
|
||||
takerTokenBalance: qfr.takerTokensSpent,
|
||||
});
|
||||
return assertFinalBalancesAsync(qfr);
|
||||
});
|
||||
|
||||
it('can fully sell to one of each order type', async () => {
|
||||
const rfqOrders = [createRfqOrder()];
|
||||
const limitOrders = [createLimitOrder()];
|
||||
@@ -1117,6 +1196,30 @@ blockchainTests.resets('FillQuoteTransformer', env => {
|
||||
return assertFinalBalancesAsync(qfr);
|
||||
});
|
||||
|
||||
it('can fully buy to a single OTC order', async () => {
|
||||
const otcOrders = [createOtcOrder()];
|
||||
const totalTakerTokens = BigNumber.sum(...otcOrders.map(o => o.takerAmount));
|
||||
const data = createTransformData({
|
||||
side: Side.Buy,
|
||||
otcOrders: otcOrders.map(o => ({
|
||||
order: o,
|
||||
maxTakerTokenFillAmount: MAX_UINT256,
|
||||
signature: createOrderSignature(),
|
||||
})),
|
||||
fillAmount: BigNumber.sum(...otcOrders.map(o => o.makerAmount)),
|
||||
fillSequence: otcOrders.map(() => OrderType.Rfq),
|
||||
});
|
||||
const qfr = getExpectedQuoteFillResults(
|
||||
data,
|
||||
createSimulationState({ takerTokenBalance: totalTakerTokens }),
|
||||
);
|
||||
await executeTransformAsync({
|
||||
data,
|
||||
takerTokenBalance: qfr.takerTokensSpent,
|
||||
});
|
||||
return assertFinalBalancesAsync(qfr);
|
||||
});
|
||||
|
||||
it('can fully buy to a single RFQ order', async () => {
|
||||
const rfqOrders = [createRfqOrder()];
|
||||
const totalTakerTokens = BigNumber.sum(...rfqOrders.map(o => o.takerAmount));
|
||||
|
@@ -52,7 +52,7 @@
|
||||
},
|
||||
"config": {
|
||||
"contractsPackages": "@0x/contracts-erc20 @0x/contracts-test-utils @0x/contracts-utils @0x/contracts-zero-ex @0x/contracts-treasury",
|
||||
"nonContractPackages": "@0x/contract-wrappers @0x/contract-addresses @0x/contract-artifacts @0x/contract-wrappers-test",
|
||||
"nonContractPackages": "@0x/contract-wrappers @0x/contract-addresses @0x/contract-artifacts @0x/contract-wrappers-test @0x/asset-swapper",
|
||||
"ignoreTestsForPackages": "",
|
||||
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic",
|
||||
"packagesWithDocPages": "@0x/contract-wrappers",
|
||||
@@ -75,6 +75,7 @@
|
||||
"wsrun": "^5.2.4"
|
||||
},
|
||||
"resolutions": {
|
||||
"merkle-patricia-tree": "3.0.0",
|
||||
"**/bignumber.js": "^9.0.2"
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,12 @@
|
||||
[
|
||||
{
|
||||
"version": "16.67.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Add Otc order support to the fillQuoteTransformer"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "16.66.4",
|
||||
"changes": [
|
||||
@@ -10,8 +18,7 @@
|
||||
"note": "Change WooFi gas estimates",
|
||||
"pr": 551
|
||||
}
|
||||
],
|
||||
"timestamp": 1661145612
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1660093941,
|
||||
|
@@ -5,11 +5,6 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v16.66.4 - _August 22, 2022_
|
||||
|
||||
* Offboard Cream (#546)
|
||||
* Change WooFi gas estimates (#551)
|
||||
|
||||
## v16.66.3 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,5 +1,3 @@
|
||||
> :warning: **@0x/asset-swapper has been deprecated!** The `asset-swapper` code has been moved to [0x-api](https://github.com/0xProject/0x-api). Please do not open a PR with `asset-swapper` changes.
|
||||
|
||||
## @0x/asset-swapper
|
||||
|
||||
Convenience package for swapping assets represented on the Ethereum blockchain using 0x. The package helps to perform all the off-chain computations to execute a marketBuy or marketSell function execution with 0x exchange contracts, or 0x extension contracts. Given some liquidity (0x signed orders), it helps estimate the cost of buying or selling a certain asset (giving a range) and then provide varying consumable outputs to execute the buy or sell.
|
||||
|
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"name": "@0x/asset-swapper",
|
||||
"version": "16.66.6",
|
||||
"private": true,
|
||||
"version": "16.66.3",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -9,8 +8,8 @@
|
||||
"main": "lib/src/index.js",
|
||||
"types": "lib/src/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "#yarn pre_build && tsc -b",
|
||||
"build:ts": "#tsc -b",
|
||||
"build": "yarn pre_build && tsc -b",
|
||||
"build:ts": "tsc -b",
|
||||
"watch": "tsc -w -p tsconfig.json",
|
||||
"watch:contracts": "sol-compiler -w",
|
||||
"build:ci": "yarn build",
|
||||
@@ -20,11 +19,11 @@
|
||||
"lint-contracts": "#solhint -c .solhint.json contracts/**/**/**/**/*.sol",
|
||||
"prettier": "prettier --write '**/*.{ts,tsx,json}' --config ../../.prettierrc --ignore-path ../../.prettierignore",
|
||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-wrappers/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"test": "#yarn run_mocha",
|
||||
"test": "yarn run_mocha",
|
||||
"rebuild_and_test": "run-s clean build test",
|
||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
||||
"test:circleci": "#yarn test:coverage",
|
||||
"test:circleci": "yarn test:coverage",
|
||||
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*_test.js' lib/test/global_hooks.js --timeout 30000 --bail --exit",
|
||||
"clean": "shx rm -rf lib test_temp generated_docs test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
|
||||
"diff_docs": "git diff --exit-code ./docs",
|
||||
@@ -60,21 +59,21 @@
|
||||
"registry": "git@github.com:0xProject/gitpkg-registry.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.35",
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/contract-addresses": "^6.22.0",
|
||||
"@0x/contract-wrappers": "^13.21.3",
|
||||
"@0x/contracts-erc20": "^3.3.39",
|
||||
"@0x/contracts-zero-ex": "^0.36.6",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/assert": "^3.0.34",
|
||||
"@0x/base-contract": "^6.5.0",
|
||||
"@0x/contract-addresses": "^6.19.2",
|
||||
"@0x/contract-wrappers": "^13.20.8",
|
||||
"@0x/contracts-erc20": "^3.3.36",
|
||||
"@0x/contracts-zero-ex": "^0.36.3",
|
||||
"@0x/dev-utils": "^4.2.14",
|
||||
"@0x/fast-abi": "^0.0.5",
|
||||
"@0x/json-schemas": "^6.4.4",
|
||||
"@0x/neon-router": "^0.3.5",
|
||||
"@0x/protocol-utils": "^11.16.6",
|
||||
"@0x/protocol-utils": "^11.16.3",
|
||||
"@0x/quote-server": "^8.0.0",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"@0x/utils": "^6.5.3",
|
||||
"@0x/web3-wrapper": "^7.6.5",
|
||||
"@balancer-labs/sdk": "0.1.6",
|
||||
"@bancor/sdk": "0.2.9",
|
||||
"@ethersproject/abi": "^5.0.1",
|
||||
@@ -85,7 +84,7 @@
|
||||
"axios": "^0.21.1",
|
||||
"axios-mock-adapter": "^1.19.0",
|
||||
"balancer-labs-sor-v1": "npm:@balancer-labs/sor@0.3.2",
|
||||
"ethereum-types": "^3.7.1",
|
||||
"ethereum-types": "^3.7.0",
|
||||
"graphql": "^15.4.0",
|
||||
"graphql-request": "^3.4.0",
|
||||
"heartbeats": "^5.0.1",
|
||||
@@ -93,11 +92,11 @@
|
||||
"msw": "^0.44.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contracts-gen": "^2.0.47",
|
||||
"@0x/contracts-test-utils": "^5.4.30",
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
"@0x/subproviders": "^7.0.0",
|
||||
"@0x/abi-gen": "^5.8.0",
|
||||
"@0x/contracts-gen": "^2.0.46",
|
||||
"@0x/contracts-test-utils": "^5.4.27",
|
||||
"@0x/sol-compiler": "^4.8.1",
|
||||
"@0x/subproviders": "^6.6.5",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@types/lodash": "4.14.137",
|
||||
|
@@ -40,12 +40,14 @@ import {
|
||||
FinalUniswapV3FillData,
|
||||
LiquidityProviderFillData,
|
||||
NativeRfqOrderFillData,
|
||||
NativeOtcOrderFillData,
|
||||
OptimizedMarketBridgeOrder,
|
||||
OptimizedMarketOrder,
|
||||
UniswapV2FillData,
|
||||
} from '../utils/market_operation_utils/types';
|
||||
|
||||
import {
|
||||
multiplexOtcOrder,
|
||||
multiplexPlpEncoder,
|
||||
multiplexRfqEncoder,
|
||||
MultiplexSubcall,
|
||||
@@ -312,18 +314,7 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
||||
!requiresTransformERC20(optsWithDefaults)
|
||||
) {
|
||||
const rfqOrdersData = quote.orders.map(o => o.fillData as NativeRfqOrderFillData);
|
||||
const fillAmountPerOrder = (() => {
|
||||
// Don't think order taker amounts are clipped to actual sell amount
|
||||
// (the last one might be too large) so figure them out manually.
|
||||
let remaining = sellAmount;
|
||||
const fillAmounts = [];
|
||||
for (const o of quote.orders) {
|
||||
const fillAmount = BigNumber.min(o.takerAmount, remaining);
|
||||
fillAmounts.push(fillAmount);
|
||||
remaining = remaining.minus(fillAmount);
|
||||
}
|
||||
return fillAmounts;
|
||||
})();
|
||||
const fillAmountPerOrder = generateFillAmounts(sellAmount, quote);
|
||||
const callData =
|
||||
quote.orders.length === 1
|
||||
? this._exchangeProxy
|
||||
@@ -346,6 +337,46 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
||||
};
|
||||
}
|
||||
|
||||
// OTC orders
|
||||
if (
|
||||
[ChainId.Mainnet, ChainId.Ropsten].includes(this.chainId) && // @todo goerli and polygon?
|
||||
quote.orders.every(o => o.type === FillQuoteTransformerOrderType.Otc) &&
|
||||
!requiresTransformERC20(optsWithDefaults)
|
||||
) {
|
||||
const otcOrdersData = quote.orders.map(o => o.fillData as NativeOtcOrderFillData);
|
||||
const fillAmountPerOrder = generateFillAmounts(sellAmount, quote);
|
||||
// grab the amount to fill on each OtcOrder (if more than 1, fallback to multiplexBatchFill)
|
||||
|
||||
let callData;
|
||||
// if we have more than one otc order we want to batch fill them,
|
||||
if (quote.orders.length === 1) {
|
||||
// if the otc orders takerToken is the native asset
|
||||
if (isFromETH) {
|
||||
callData = this._exchangeProxy
|
||||
.fillOtcOrderWithEth(otcOrdersData[0].order, otcOrdersData[0].signature)
|
||||
.getABIEncodedTransactionData();
|
||||
}
|
||||
// if the otc orders makerToken is the native asset
|
||||
if (isToETH) {
|
||||
callData = this._exchangeProxy
|
||||
.fillOtcOrderForEth(otcOrdersData[0].order, otcOrdersData[0].signature, fillAmountPerOrder[0])
|
||||
.getABIEncodedTransactionData();
|
||||
} else {
|
||||
// if the otc order contains 2 erc20 tokens
|
||||
callData = this._exchangeProxy
|
||||
.fillOtcOrder(otcOrdersData[0].order, otcOrdersData[0].signature, fillAmountPerOrder[0])
|
||||
.getABIEncodedTransactionData();
|
||||
}
|
||||
return {
|
||||
calldataHexString: callData,
|
||||
ethAmount: isFromETH ? sellAmount : ZERO_AMOUNT,
|
||||
toAddress: this._exchangeProxy.address,
|
||||
allowanceTarget: this._exchangeProxy.address,
|
||||
gasOverhead: ZERO_AMOUNT,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (this.chainId === ChainId.Mainnet && isMultiplexBatchFillCompatible(quote, optsWithDefaults)) {
|
||||
return {
|
||||
calldataHexString: this._encodeMultiplexBatchFillCalldata(
|
||||
@@ -539,19 +570,30 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
||||
for_loop: for (const [i, order] of quote.orders.entries()) {
|
||||
switch_statement: switch (order.source) {
|
||||
case ERC20BridgeSource.Native:
|
||||
if (order.type !== FillQuoteTransformerOrderType.Rfq) {
|
||||
if (order.type !== FillQuoteTransformerOrderType.Rfq && order.type !== FillQuoteTransformerOrderType.Otc) {
|
||||
// Should never happen because we check `isMultiplexBatchFillCompatible`
|
||||
// before calling this function.
|
||||
throw new Error('Multiplex batch fill only supported for RFQ native orders');
|
||||
throw new Error('Multiplex batch fill only supported for RFQ native orders and OTC Orders');
|
||||
}
|
||||
if (order.type !== FillQuoteTransformerOrderType.Otc) {
|
||||
subcalls.push({
|
||||
id: MultiplexSubcall.Rfq,
|
||||
sellAmount: order.takerAmount,
|
||||
data: multiplexRfqEncoder.encode({
|
||||
order: order.fillData.order,
|
||||
signature: order.fillData.signature,
|
||||
}),
|
||||
});
|
||||
} else {
|
||||
subcalls.push({
|
||||
id: MultiplexSubcall.Otc,
|
||||
sellAmount: order.takerAmount,
|
||||
data: multiplexOtcOrder.encode({
|
||||
order: order.fillData.order,
|
||||
signature: order.fillData.signature,
|
||||
}),
|
||||
});
|
||||
}
|
||||
subcalls.push({
|
||||
id: MultiplexSubcall.Rfq,
|
||||
sellAmount: order.takerAmount,
|
||||
data: multiplexRfqEncoder.encode({
|
||||
order: order.fillData.order,
|
||||
signature: order.fillData.signature,
|
||||
}),
|
||||
});
|
||||
break switch_statement;
|
||||
case ERC20BridgeSource.UniswapV2:
|
||||
case ERC20BridgeSource.SushiSwap:
|
||||
@@ -702,6 +744,17 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
||||
}
|
||||
}
|
||||
|
||||
function generateFillAmounts(sellAmount: BigNumber, quote: MarketBuySwapQuote | MarketSellSwapQuote): BigNumber[] {
|
||||
let remaining = sellAmount;
|
||||
const fillAmounts = [];
|
||||
for (const o of quote.orders) {
|
||||
const fillAmount = BigNumber.min(o.takerAmount, remaining);
|
||||
fillAmounts.push(fillAmount);
|
||||
remaining = remaining.minus(fillAmount);
|
||||
}
|
||||
return fillAmounts;
|
||||
}
|
||||
|
||||
function slipNonNativeOrders(quote: MarketSellSwapQuote | MarketBuySwapQuote): OptimizedMarketOrder[] {
|
||||
const slippage = getMaxQuoteSlippageRate(quote);
|
||||
if (slippage === 0) {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { RfqOrder, SIGNATURE_ABI } from '@0x/protocol-utils';
|
||||
import { OtcOrder, RfqOrder, SIGNATURE_ABI } from '@0x/protocol-utils';
|
||||
import { AbiEncoder } from '@0x/utils';
|
||||
|
||||
export enum MultiplexSubcall {
|
||||
@@ -26,6 +26,10 @@ export const multiplexRfqEncoder = AbiEncoder.create([
|
||||
{ name: 'order', type: 'tuple', components: RfqOrder.STRUCT_ABI },
|
||||
{ name: 'signature', type: 'tuple', components: SIGNATURE_ABI },
|
||||
]);
|
||||
export const multiplexOtcOrder = AbiEncoder.create([
|
||||
{ name: 'order', type: 'tuple', components: OtcOrder.STRUCT_ABI },
|
||||
{ name: 'signature', type: 'tuple', components: SIGNATURE_ABI },
|
||||
]);
|
||||
export const multiplexUniswapEncoder = AbiEncoder.create([
|
||||
{ name: 'tokens', type: 'address[]' },
|
||||
{ name: 'isSushi', type: 'bool' },
|
||||
|
@@ -8,6 +8,7 @@ import {
|
||||
import {
|
||||
ERC20BridgeSource,
|
||||
NativeLimitOrderFillData,
|
||||
NativeOtcOrderFillData,
|
||||
NativeRfqOrderFillData,
|
||||
OptimizedMarketBridgeOrder,
|
||||
OptimizedMarketOrder,
|
||||
@@ -107,19 +108,27 @@ function isOptimizedRfqOrder(x: OptimizedMarketOrder): x is OptimizedMarketOrder
|
||||
return x.type === FillQuoteTransformerOrderType.Rfq;
|
||||
}
|
||||
|
||||
function isOptimizedOtcOrder(x: OptimizedMarketOrder): x is OptimizedMarketOrderBase<NativeOtcOrderFillData> {
|
||||
return x.type === FillQuoteTransformerOrderType.Otc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the given `OptimizedMarketOrder`s into bridge, limit, and RFQ orders for
|
||||
* FillQuoteTransformer.
|
||||
*/
|
||||
export function getFQTTransformerDataFromOptimizedOrders(
|
||||
orders: OptimizedMarketOrder[],
|
||||
): Pick<FillQuoteTransformerData, 'bridgeOrders' | 'limitOrders' | 'rfqOrders' | 'fillSequence'> {
|
||||
const fqtData: Pick<FillQuoteTransformerData, 'bridgeOrders' | 'limitOrders' | 'rfqOrders' | 'fillSequence'> = {
|
||||
bridgeOrders: [],
|
||||
limitOrders: [],
|
||||
rfqOrders: [],
|
||||
fillSequence: [],
|
||||
};
|
||||
): Pick<FillQuoteTransformerData, 'bridgeOrders' | 'limitOrders' | 'rfqOrders' | 'otcOrders' | 'fillSequence'> {
|
||||
const fqtData: Pick<
|
||||
FillQuoteTransformerData,
|
||||
'bridgeOrders' | 'limitOrders' | 'rfqOrders' | 'otcOrders' | 'fillSequence'
|
||||
> = {
|
||||
bridgeOrders: [],
|
||||
limitOrders: [],
|
||||
rfqOrders: [],
|
||||
otcOrders: [],
|
||||
fillSequence: [],
|
||||
};
|
||||
|
||||
for (const order of orders) {
|
||||
if (isOptimizedBridgeOrder(order)) {
|
||||
@@ -141,6 +150,12 @@ export function getFQTTransformerDataFromOptimizedOrders(
|
||||
signature: order.fillData.signature,
|
||||
maxTakerTokenFillAmount: order.takerAmount,
|
||||
});
|
||||
} else if (isOptimizedOtcOrder(order)) {
|
||||
fqtData.otcOrders.push({
|
||||
order: order.fillData.order,
|
||||
signature: order.fillData.signature,
|
||||
maxTakerTokenFillAmount: order.takerAmount,
|
||||
});
|
||||
} else {
|
||||
// Should never happen
|
||||
throw new Error('Unknown Order type');
|
||||
|
@@ -71,8 +71,6 @@ function valueByChainId<T>(rest: Partial<{ [key in ChainId]: T }>, defaultValue:
|
||||
[ChainId.Fantom]: defaultValue,
|
||||
[ChainId.Celo]: defaultValue,
|
||||
[ChainId.Optimism]: defaultValue,
|
||||
[ChainId.ArbitrumRinkeby]: defaultValue,
|
||||
[ChainId.Arbitrum]: defaultValue,
|
||||
...(rest || {}),
|
||||
};
|
||||
}
|
||||
@@ -224,10 +222,6 @@ export const SELL_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
|
||||
ERC20BridgeSource.Velodrome,
|
||||
ERC20BridgeSource.Synthetix,
|
||||
]),
|
||||
[ChainId.ArbitrumRinkeby]: new SourceFilters([
|
||||
ERC20BridgeSource.Native,
|
||||
ERC20BridgeSource.UniswapV3,
|
||||
]),
|
||||
},
|
||||
new SourceFilters([]),
|
||||
);
|
||||
@@ -379,10 +373,6 @@ export const BUY_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
|
||||
ERC20BridgeSource.Velodrome,
|
||||
ERC20BridgeSource.Synthetix,
|
||||
]),
|
||||
[ChainId.ArbitrumRinkeby]: new SourceFilters([
|
||||
ERC20BridgeSource.Native,
|
||||
ERC20BridgeSource.UniswapV3,
|
||||
]),
|
||||
},
|
||||
new SourceFilters([]),
|
||||
);
|
||||
@@ -407,7 +397,6 @@ export const FEE_QUOTE_SOURCES_BY_CHAIN_ID = valueByChainId<ERC20BridgeSource[]>
|
||||
[ChainId.Fantom]: [ERC20BridgeSource.SpiritSwap, ERC20BridgeSource.SpookySwap, ERC20BridgeSource.SushiSwap],
|
||||
[ChainId.Celo]: [ERC20BridgeSource.UbeSwap, ERC20BridgeSource.SushiSwap],
|
||||
[ChainId.Optimism]: [ERC20BridgeSource.UniswapV3],
|
||||
[ChainId.ArbitrumRinkeby]: [ERC20BridgeSource.UniswapV3],
|
||||
},
|
||||
[],
|
||||
);
|
||||
@@ -925,11 +914,6 @@ export const DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID = valueByChainId<string[]>(
|
||||
'0x11fE4B6AE13d2a6055C8D9cF65c55bac32B5d844', // DAI
|
||||
'0x07865c6E87B9F70255377e024ace6630C1Eaa37F', // USDC
|
||||
],
|
||||
[ChainId.ArbitrumRinkeby]: [
|
||||
getContractAddressesForChainOrThrow(ChainId.ArbitrumRinkeby).etherToken,
|
||||
'0x237b3B5238D2022aA80cAd1f67dAE53f353F74bF', // USDT
|
||||
'0xF61Cffd6071a8DB7cD5E8DF1D3A5450D9903cF1c', // USDC
|
||||
],
|
||||
[ChainId.PolygonMumbai]: [
|
||||
getContractAddressesForChainOrThrow(ChainId.PolygonMumbai).etherToken,
|
||||
'0xe6b8a5CF854791412c1f6EFC7CAf629f5Df1c747', // USDC
|
||||
@@ -1061,7 +1045,6 @@ export const NATIVE_FEE_TOKEN_BY_CHAIN_ID = valueByChainId<string>(
|
||||
[ChainId.Ropsten]: getContractAddressesForChainOrThrow(ChainId.Ropsten).etherToken,
|
||||
[ChainId.Goerli]: getContractAddressesForChainOrThrow(ChainId.Goerli).etherToken,
|
||||
[ChainId.PolygonMumbai]: getContractAddressesForChainOrThrow(ChainId.PolygonMumbai).etherToken,
|
||||
[ChainId.ArbitrumRinkeby]: getContractAddressesForChainOrThrow(ChainId.ArbitrumRinkeby).etherToken,
|
||||
[ChainId.Rinkeby]: getContractAddressesForChainOrThrow(ChainId.Rinkeby).etherToken,
|
||||
[ChainId.Kovan]: getContractAddressesForChainOrThrow(ChainId.Kovan).etherToken,
|
||||
[ChainId.Polygon]: getContractAddressesForChainOrThrow(ChainId.Polygon).etherToken,
|
||||
@@ -2240,10 +2223,6 @@ export const UNISWAPV3_CONFIG_BY_CHAIN_ID = valueByChainId(
|
||||
quoter: '0x61ffe014ba17989e743c5f6cb21bf9697530b21e',
|
||||
router: '0xe592427a0aece92de3edee1f18e0157c05861564',
|
||||
},
|
||||
[ChainId.ArbitrumRinkeby]: {
|
||||
quoter: '0x61ffe014ba17989e743c5f6cb21bf9697530b21e',
|
||||
router: '0xe592427a0aece92de3edee1f18e0157c05861564',
|
||||
},
|
||||
},
|
||||
{ quoter: NULL_ADDRESS, router: NULL_ADDRESS },
|
||||
);
|
||||
|
@@ -2,6 +2,7 @@ import { ChainId } from '@0x/contract-addresses';
|
||||
import {
|
||||
FillQuoteTransformerLimitOrderInfo,
|
||||
FillQuoteTransformerOrderType,
|
||||
FillQuoteTransformerOtcOrderInfo,
|
||||
FillQuoteTransformerRfqOrderInfo,
|
||||
} from '@0x/protocol-utils';
|
||||
import { MarketOperation } from '@0x/types';
|
||||
@@ -194,7 +195,8 @@ export interface FillData {}
|
||||
// `FillData` for native fills. Represents a single native order
|
||||
export type NativeRfqOrderFillData = FillQuoteTransformerRfqOrderInfo;
|
||||
export type NativeLimitOrderFillData = FillQuoteTransformerLimitOrderInfo;
|
||||
export type NativeFillData = NativeRfqOrderFillData | NativeLimitOrderFillData;
|
||||
export type NativeOtcOrderFillData = FillQuoteTransformerOtcOrderInfo;
|
||||
export type NativeFillData = NativeRfqOrderFillData | NativeLimitOrderFillData | NativeOtcOrderFillData;
|
||||
|
||||
// Represents an individual DEX sample from the sampler contract
|
||||
export interface DexSample<TFillData extends FillData = FillData> {
|
||||
@@ -450,7 +452,8 @@ export interface OptimizedRfqOrder extends OptimizedMarketOrderBase<NativeRfqOrd
|
||||
export type OptimizedMarketOrder =
|
||||
| OptimizedMarketBridgeOrder<FillData>
|
||||
| OptimizedMarketOrderBase<NativeLimitOrderFillData>
|
||||
| OptimizedMarketOrderBase<NativeRfqOrderFillData>;
|
||||
| OptimizedMarketOrderBase<NativeRfqOrderFillData>
|
||||
| OptimizedMarketOrderBase<NativeOtcOrderFillData>;
|
||||
|
||||
export interface GetMarketOrdersRfqOpts extends RfqRequestOpts {
|
||||
rfqClient?: IRfqClient;
|
||||
|
@@ -353,7 +353,7 @@ function _isNativeOrderFromCollapsedFill(cf: Fill): cf is Fill<NativeFillData> {
|
||||
*/
|
||||
export function nativeOrderToReportEntry(
|
||||
type: FillQuoteTransformerOrderType,
|
||||
fillData: NativeLimitOrderFillData | NativeRfqOrderFillData,
|
||||
fillData: NativeFillData,
|
||||
fillableAmount: BigNumber,
|
||||
comparisonPrice?: BigNumber | undefined,
|
||||
quoteRequestor?: QuoteRequestor,
|
||||
|
@@ -43,7 +43,7 @@ blockchainTests.resets('BalanceChecker contract', env => {
|
||||
|
||||
const testResults = await contract.balances([owner, owner2], [makerToken.address, ETH_ADDRESS]).callAsync();
|
||||
|
||||
expect(testResults).to.eql([new BigNumber(100), new BigNumber(1000000000000000000000)]);
|
||||
expect(testResults).to.eql([new BigNumber(100), new BigNumber(100000000000000000000)]);
|
||||
});
|
||||
it('it throws an error if the input arrays of different lengths', async () => {
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
|
@@ -68,7 +68,7 @@ export const testHelpers = {
|
||||
const { endpoint, mmApiKey, requestData, responseData, responseCode } = mockedResponse;
|
||||
const requestHeaders = {
|
||||
Accept: 'application/json, text/plain, */*',
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
Authorization: `Bearer ${mmApiKey}`,
|
||||
};
|
||||
mockedAxios
|
||||
|
@@ -1,31 +1,11 @@
|
||||
[
|
||||
{
|
||||
"version": "6.22.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Arbitrum Rinkeby support",
|
||||
"pr": 552
|
||||
}
|
||||
],
|
||||
"timestamp": 1661462289
|
||||
},
|
||||
{
|
||||
"version": "6.21.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Arbitrum addresses: need to be updated when deployed"
|
||||
}
|
||||
],
|
||||
"timestamp": 1661459661
|
||||
},
|
||||
{
|
||||
"version": "6.20.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Revert: Remove contract addresses that are no longer needed"
|
||||
}
|
||||
],
|
||||
"timestamp": 1661145612
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "6.20.0",
|
||||
|
@@ -5,22 +5,6 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v6.22.0 - _August 25, 2022_
|
||||
|
||||
* Arbitrum Rinkeby support (#552)
|
||||
|
||||
## v6.21.0 - _August 25, 2022_
|
||||
|
||||
* Arbitrum addresses: need to be updated when deployed
|
||||
|
||||
## v6.20.1 - _August 22, 2022_
|
||||
|
||||
* Revert: Remove contract addresses that are no longer needed
|
||||
|
||||
## v6.20.0 - _Invalid date_
|
||||
|
||||
* Remove contract addresses that are no longer needed (#548)
|
||||
|
||||
## v6.19.2 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -544,90 +544,5 @@
|
||||
"fillQuoteTransformer": "0x96499c097efc56ba5cf6b2a474392db17790ce96",
|
||||
"positiveSlippageFeeTransformer": "0xb11e14565dfbeb702dea9bc0cb47f1a8b32f4783"
|
||||
}
|
||||
},
|
||||
"421611": {
|
||||
"erc20Proxy": "0x0000000000000000000000000000000000000000",
|
||||
"erc721Proxy": "0x0000000000000000000000000000000000000000",
|
||||
"zrxToken": "0x0000000000000000000000000000000000000000",
|
||||
"etherToken": "0x4200000000000000000000000000000000000006",
|
||||
"exchangeV2": "0x0000000000000000000000000000000000000000",
|
||||
"exchange": "0x0000000000000000000000000000000000000000",
|
||||
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
|
||||
"zeroExGovernor": "0x0000000000000000000000000000000000000000",
|
||||
"forwarder": "0x0000000000000000000000000000000000000000",
|
||||
"coordinatorRegistry": "0x0000000000000000000000000000000000000000",
|
||||
"coordinator": "0x0000000000000000000000000000000000000000",
|
||||
"multiAssetProxy": "0x0000000000000000000000000000000000000000",
|
||||
"staticCallProxy": "0x0000000000000000000000000000000000000000",
|
||||
"erc1155Proxy": "0x0000000000000000000000000000000000000000",
|
||||
"devUtils": "0x0000000000000000000000000000000000000000",
|
||||
"zrxVault": "0x0000000000000000000000000000000000000000",
|
||||
"staking": "0x0000000000000000000000000000000000000000",
|
||||
"stakingProxy": "0x0000000000000000000000000000000000000000",
|
||||
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
|
||||
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
|
||||
"chaiBridge": "0x0000000000000000000000000000000000000000",
|
||||
"dydxBridge": "0x0000000000000000000000000000000000000000",
|
||||
"godsUnchainedValidator": "0x0000000000000000000000000000000000000000",
|
||||
"broker": "0x0000000000000000000000000000000000000000",
|
||||
"chainlinkStopLimit": "0x0000000000000000000000000000000000000000",
|
||||
"maximumGasPrice": "0x0000000000000000000000000000000000000000",
|
||||
"dexForwarderBridge": "0x0000000000000000000000000000000000000000",
|
||||
"exchangeProxyGovernor": "0xf5e66206eb523988eae22dd7d4e06e36999fef94",
|
||||
"exchangeProxy": "0x2c1994270ae589deae7b4bb6c2446c57d40b99d4",
|
||||
"exchangeProxyTransformerDeployer": "0x42b43abe1358a7b2c00f8eb5b2668f821ee8edbf",
|
||||
"exchangeProxyFlashWallet": "0xc1831049d451b69a9dccc391f8285eb83c94c940",
|
||||
"exchangeProxyLiquidityProviderSandbox": "0x0000000000000000000000000000000000000000",
|
||||
"zrxTreasury": "0x0000000000000000000000000000000000000000",
|
||||
"transformers": {
|
||||
"wethTransformer": "0x7c0ef1020f9ee63bcf8248006174b9cbaa29af5a",
|
||||
"payTakerTransformer": "0xb5c5ebd57ccf14480e30ce85f891f894cedbc694",
|
||||
"affiliateFeeTransformer": "0xfa3d8ca1c877185af1ce2ec558e586e12cdbc50c",
|
||||
"fillQuoteTransformer": "0xd6ddb08beb4c48e35352ee4df5ebc028e72f3c81",
|
||||
"positiveSlippageFeeTransformer": "0x8830f7c5925b129efcc7831397f30c1c02953bac"
|
||||
}
|
||||
},
|
||||
"42161": {
|
||||
"erc20Proxy": "0x0000000000000000000000000000000000000000",
|
||||
"erc721Proxy": "0x0000000000000000000000000000000000000000",
|
||||
"zrxToken": "0x0000000000000000000000000000000000000000",
|
||||
"etherToken": "0x4200000000000000000000000000000000000006",
|
||||
"exchangeV2": "0x0000000000000000000000000000000000000000",
|
||||
"exchange": "0x0000000000000000000000000000000000000000",
|
||||
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
|
||||
"zeroExGovernor": "0x0000000000000000000000000000000000000000",
|
||||
"forwarder": "0x0000000000000000000000000000000000000000",
|
||||
"coordinatorRegistry": "0x0000000000000000000000000000000000000000",
|
||||
"coordinator": "0x0000000000000000000000000000000000000000",
|
||||
"multiAssetProxy": "0x0000000000000000000000000000000000000000",
|
||||
"staticCallProxy": "0x0000000000000000000000000000000000000000",
|
||||
"erc1155Proxy": "0x0000000000000000000000000000000000000000",
|
||||
"devUtils": "0x0000000000000000000000000000000000000000",
|
||||
"zrxVault": "0x0000000000000000000000000000000000000000",
|
||||
"staking": "0x0000000000000000000000000000000000000000",
|
||||
"stakingProxy": "0x0000000000000000000000000000000000000000",
|
||||
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
|
||||
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
|
||||
"chaiBridge": "0x0000000000000000000000000000000000000000",
|
||||
"dydxBridge": "0x0000000000000000000000000000000000000000",
|
||||
"godsUnchainedValidator": "0x0000000000000000000000000000000000000000",
|
||||
"broker": "0x0000000000000000000000000000000000000000",
|
||||
"chainlinkStopLimit": "0x0000000000000000000000000000000000000000",
|
||||
"maximumGasPrice": "0x0000000000000000000000000000000000000000",
|
||||
"dexForwarderBridge": "0x0000000000000000000000000000000000000000",
|
||||
"exchangeProxyGovernor": "0x1fe80d5ad9464dba2d60b88e449305f184823f8a",
|
||||
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
|
||||
"exchangeProxyTransformerDeployer": "0x29f80c1f685e19ae1807063eda432f431ac623d0",
|
||||
"exchangeProxyFlashWallet": "0xdb6f1920a889355780af7570773609bd8cb1f498",
|
||||
"exchangeProxyLiquidityProviderSandbox": "0x0000000000000000000000000000000000000000",
|
||||
"zrxTreasury": "0x0000000000000000000000000000000000000000",
|
||||
"transformers": {
|
||||
"wethTransformer": "0x10e968968f49dd66a5efeebbb2edcb9c49c4fc49",
|
||||
"payTakerTransformer": "0xae3e8cf7bf340d7084f312dfae2aa8b01c885b02",
|
||||
"affiliateFeeTransformer": "0x05a24978471869327904ea13da3c4322128e2aaa",
|
||||
"fillQuoteTransformer": "0x24760a755a4ffe4e44f661336fd0dc646fd6f723",
|
||||
"positiveSlippageFeeTransformer": "0xd56b9c014b45ed95e2a048a0c28121db30265f13"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-addresses",
|
||||
"version": "6.22.0",
|
||||
"version": "6.19.2",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
|
@@ -56,9 +56,8 @@ export enum ChainId {
|
||||
Avalanche = 43114,
|
||||
Fantom = 250,
|
||||
Celo = 42220,
|
||||
// Arbitrum = 42161,
|
||||
Optimism = 10,
|
||||
Arbitrum = 42161,
|
||||
ArbitrumRinkeby = 421611
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,13 +1,4 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1661145612,
|
||||
"version": "3.18.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "3.18.0",
|
||||
"changes": [
|
||||
|
@@ -5,10 +5,6 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.18.1 - _August 22, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.18.0 - _March 31, 2022_
|
||||
|
||||
* Regenerate all artifacts (#449)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-artifacts",
|
||||
"version": "3.18.1",
|
||||
"version": "3.18.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -30,7 +30,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/packages/contract-artifacts",
|
||||
"devDependencies": {
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@0x/utils": "^6.5.3",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"chai": "^4.0.1",
|
||||
"lodash": "^4.17.11",
|
||||
|
@@ -1,30 +1,11 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1661462289,
|
||||
"version": "13.21.3",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1661459661,
|
||||
"version": "13.21.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "13.21.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Revert: Remove deprecated contracts"
|
||||
}
|
||||
],
|
||||
"timestamp": 1661145612
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "13.21.0",
|
||||
|
@@ -5,22 +5,6 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v13.21.3 - _August 25, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v13.21.2 - _August 25, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v13.21.1 - _August 22, 2022_
|
||||
|
||||
* Revert: Remove deprecated contracts
|
||||
|
||||
## v13.21.0 - _Invalid date_
|
||||
|
||||
* Remove deprecated contracts
|
||||
|
||||
## v13.20.8 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-wrappers",
|
||||
"version": "13.21.3",
|
||||
"version": "13.20.8",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -55,14 +55,14 @@
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.35",
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/contract-addresses": "^6.22.0",
|
||||
"@0x/assert": "^3.0.34",
|
||||
"@0x/base-contract": "^6.5.0",
|
||||
"@0x/contract-addresses": "^6.19.2",
|
||||
"@0x/json-schemas": "^6.4.4",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"ethereum-types": "^3.7.1",
|
||||
"@0x/utils": "^6.5.3",
|
||||
"@0x/web3-wrapper": "^7.6.5",
|
||||
"ethereum-types": "^3.7.0",
|
||||
"ethers": "~4.0.4"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -1,31 +1,4 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1661462289,
|
||||
"version": "11.16.6",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1661459661,
|
||||
"version": "11.16.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1661145612,
|
||||
"version": "11.16.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1660093941,
|
||||
"version": "11.16.3",
|
||||
|
@@ -5,18 +5,6 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v11.16.6 - _August 25, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v11.16.5 - _August 25, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v11.16.4 - _August 22, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v11.16.3 - _August 10, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/protocol-utils",
|
||||
"version": "11.16.6",
|
||||
"version": "11.16.3",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -41,7 +41,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/packages/protocol-utils",
|
||||
"devDependencies": {
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/dev-utils": "^4.2.14",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
"@0x/types": "^3.3.6",
|
||||
@@ -51,7 +51,7 @@
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "12.12.54",
|
||||
"@types/web3-provider-engine": "^14.0.0",
|
||||
"ethereum-types": "^3.7.1",
|
||||
"ethereum-types": "^3.7.0",
|
||||
"mocha": "^6.2.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
@@ -62,13 +62,13 @@
|
||||
"web3-provider-engine": "14.0.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.35",
|
||||
"@0x/contract-addresses": "^6.22.0",
|
||||
"@0x/contract-wrappers": "^13.21.3",
|
||||
"@0x/assert": "^3.0.34",
|
||||
"@0x/contract-addresses": "^6.19.2",
|
||||
"@0x/contract-wrappers": "^13.20.8",
|
||||
"@0x/json-schemas": "^6.4.4",
|
||||
"@0x/subproviders": "^7.0.0",
|
||||
"@0x/utils": "^7.0.0",
|
||||
"@0x/web3-wrapper": "^8.0.0",
|
||||
"@0x/subproviders": "^6.6.5",
|
||||
"@0x/utils": "^6.5.3",
|
||||
"@0x/web3-wrapper": "^7.6.5",
|
||||
"chai": "^4.0.1",
|
||||
"ethereumjs-util": "^7.0.10",
|
||||
"ethers": "~4.0.4",
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { AbiEncoder, BigNumber, hexUtils, NULL_ADDRESS } from '@0x/utils';
|
||||
import * as ethjs from 'ethereumjs-util';
|
||||
|
||||
import { LimitOrder, LimitOrderFields, RfqOrder, RfqOrderFields } from './orders';
|
||||
import { LimitOrder, LimitOrderFields, RfqOrder, RfqOrderFields, OtcOrder, OtcOrderFields } from './orders';
|
||||
import { Signature, SIGNATURE_ABI } from './signature_utils';
|
||||
|
||||
const BRIDGE_ORDER_ABI_COMPONENTS = [
|
||||
@@ -39,6 +39,20 @@ const RFQ_ORDER_INFO_ABI_COMPONENTS = [
|
||||
{ name: 'maxTakerTokenFillAmount', type: 'uint256' },
|
||||
];
|
||||
|
||||
const OTC_ORDER_INFO_ABI_COMPONENTS = [
|
||||
{
|
||||
name: 'order',
|
||||
type: 'tuple',
|
||||
components: OtcOrder.STRUCT_ABI,
|
||||
},
|
||||
{
|
||||
name: 'signature',
|
||||
type: 'tuple',
|
||||
components: SIGNATURE_ABI,
|
||||
},
|
||||
{ name: 'maxTakerTokenFillAmount', type: 'uint256' },
|
||||
];
|
||||
|
||||
/**
|
||||
* ABI encoder for `FillQuoteTransformer.TransformData`
|
||||
*/
|
||||
@@ -60,6 +74,11 @@ export const fillQuoteTransformerDataEncoder = AbiEncoder.create([
|
||||
type: 'tuple[]',
|
||||
components: LIMIT_ORDER_INFO_ABI_COMPONENTS,
|
||||
},
|
||||
{
|
||||
name: 'otcOrders',
|
||||
type: 'tuple[]',
|
||||
components: OTC_ORDER_INFO_ABI_COMPONENTS,
|
||||
},
|
||||
{
|
||||
name: 'rfqOrders',
|
||||
type: 'tuple[]',
|
||||
@@ -87,6 +106,7 @@ export enum FillQuoteTransformerOrderType {
|
||||
Bridge,
|
||||
Limit,
|
||||
Rfq,
|
||||
Otc
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,6 +119,7 @@ export interface FillQuoteTransformerData {
|
||||
bridgeOrders: FillQuoteTransformerBridgeOrder[];
|
||||
limitOrders: FillQuoteTransformerLimitOrderInfo[];
|
||||
rfqOrders: FillQuoteTransformerRfqOrderInfo[];
|
||||
otcOrders: FillQuoteTransformerOtcOrderInfo[];
|
||||
fillSequence: FillQuoteTransformerOrderType[];
|
||||
fillAmount: BigNumber;
|
||||
refundReceiver: string;
|
||||
@@ -178,6 +199,11 @@ export type FillQuoteTransformerLimitOrderInfo = FillQuoteTransformerNativeOrder
|
||||
*/
|
||||
export type FillQuoteTransformerRfqOrderInfo = FillQuoteTransformerNativeOrderInfo<RfqOrderFields>;
|
||||
|
||||
/**
|
||||
* `FillQuoteTransformer.OtcOrderInfo`
|
||||
*/
|
||||
export type FillQuoteTransformerOtcOrderInfo = FillQuoteTransformerNativeOrderInfo<OtcOrderFields>;
|
||||
|
||||
/**
|
||||
* ABI-encode a `FillQuoteTransformer.TransformData` type.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user