Compare commits
25 Commits
@0x/contra
...
@0x/protoc
Author | SHA1 | Date | |
---|---|---|---|
|
6fd269db34 | ||
|
033db23929 | ||
|
891d173705 | ||
|
091a10676c | ||
|
0ae6f3e64f | ||
|
8197fee50a | ||
|
ee48d4006b | ||
|
d2be56c30f | ||
|
c4097e4203 | ||
|
8f21d167cc | ||
|
b33fc27220 | ||
|
dcb17768cc | ||
|
82907f99a2 | ||
|
2e157cc307 | ||
|
3164d7882c | ||
|
91587efe2e | ||
|
008f00ba2f | ||
|
0e38b0e54a | ||
|
f6af4abd67 | ||
|
6dc3084c30 | ||
|
fd1f7a8a42 | ||
|
3a03174a92 | ||
|
f5e34bce3b | ||
|
3f8dbf3fe9 | ||
|
b040e55202 |
@@ -1,339 +0,0 @@
|
||||
version: 2.1
|
||||
|
||||
parameters:
|
||||
cache_version:
|
||||
type: string
|
||||
default: v5
|
||||
|
||||
jobs:
|
||||
build:
|
||||
resource_class: xlarge
|
||||
docker:
|
||||
- image: node:16
|
||||
environment:
|
||||
NODE_OPTIONS: '--max-old-space-size=16384'
|
||||
steps:
|
||||
- checkout
|
||||
- run: git submodule update --init --recursive
|
||||
- run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_SHA1 }}-feat/NerveMixinArbitrum
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- run:
|
||||
name: install-yarn
|
||||
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
|
||||
- save_cache:
|
||||
key: cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
paths:
|
||||
- ~/project/node_modules
|
||||
- ~/.cache/yarn
|
||||
- save_cache:
|
||||
key: lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
|
||||
paths:
|
||||
- ~/project/contracts/erc20/generated-artifacts/
|
||||
- ~/project/contracts/erc20/generated-wrappers/
|
||||
- ~/project/contracts/erc20/lib/
|
||||
- ~/project/contracts/erc20/node_modules
|
||||
- ~/project/contracts/erc20/test/generated-artifacts/
|
||||
- ~/project/contracts/erc20/test/generated-wrappers/
|
||||
- ~/project/contracts/test-utils/lib/
|
||||
- ~/project/contracts/test-utils/node_modules
|
||||
- ~/project/contracts/treasury/generated-artifacts/
|
||||
- ~/project/contracts/treasury/generated-wrappers/
|
||||
- ~/project/contracts/treasury/lib/
|
||||
- ~/project/contracts/treasury/node_modules
|
||||
- ~/project/contracts/treasury/test/generated-artifacts/
|
||||
- ~/project/contracts/treasury/test/generated-wrappers/
|
||||
- ~/project/contracts/utils/generated-artifacts/
|
||||
- ~/project/contracts/utils/generated-wrappers/
|
||||
- ~/project/contracts/utils/lib/
|
||||
- ~/project/contracts/utils/node_modules
|
||||
- ~/project/contracts/utils/test/generated-artifacts/
|
||||
- ~/project/contracts/utils/test/generated-wrappers/
|
||||
- ~/project/contracts/zero-ex/generated-artifacts/
|
||||
- ~/project/contracts/zero-ex/generated-wrappers/
|
||||
- ~/project/contracts/zero-ex/lib/
|
||||
- ~/project/contracts/zero-ex/node_modules
|
||||
- ~/project/contracts/zero-ex/test/generated-artifacts/
|
||||
- ~/project/contracts/zero-ex/test/generated-wrappers/
|
||||
- ~/project/packages/asset-swapper/node_modules
|
||||
- ~/project/packages/contract-addresses/lib/
|
||||
- ~/project/packages/contract-addresses/node_modules
|
||||
- ~/project/packages/contract-artifacts/lib/
|
||||
- ~/project/packages/contract-artifacts/node_modules
|
||||
- ~/project/packages/contract-wrappers/lib/
|
||||
- ~/project/packages/contract-wrappers/node_modules
|
||||
- ~/project/packages/protocol-utils/lib/
|
||||
- ~/project/packages/protocol-utils/node_modules
|
||||
- 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
|
||||
docker:
|
||||
- image: node:16
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
|
||||
- run: yarn wsrun -p @0x/contracts-exchange -m --serial -c test:circleci
|
||||
test-integrations-ganache:
|
||||
resource_class: xlarge
|
||||
docker:
|
||||
- image: node:16
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
|
||||
- run: yarn wsrun -p @0x/contracts-integrations -m --serial -c test:circleci
|
||||
test-contracts-staking-ganache:
|
||||
resource_class: xlarge
|
||||
docker:
|
||||
- image: node:16
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
|
||||
- run: yarn wsrun -p @0x/contracts-staking -m --serial -c test:circleci
|
||||
test-contracts-extra-ganache:
|
||||
resource_class: xlarge
|
||||
docker:
|
||||
- image: node:16
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "yarn.lock" }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
|
||||
- run: yarn wsrun -p @0x/contracts-exchange-forwarder -p @0x/contracts-coordinator -m --serial -c test:circleci
|
||||
test-contracts-rest-ganache:
|
||||
resource_class: xlarge
|
||||
docker:
|
||||
- image: node:16
|
||||
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:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_SHA1 }}-<< 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
|
||||
test-foundry:
|
||||
resource_class: xlarge
|
||||
docker:
|
||||
- image: ghcr.io/foundry-rs/foundry:latest
|
||||
steps:
|
||||
- checkout
|
||||
- run: |
|
||||
git diff --name-only development >> changed.txt
|
||||
cat changed.txt
|
||||
if ! grep -q \.sol changed.txt; then
|
||||
circleci-agent step halt
|
||||
fi
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
|
||||
- run: git submodule update --init --recursive
|
||||
- run:
|
||||
command: forge test
|
||||
working_directory: ~/project/contracts/zero-ex
|
||||
test-publish:
|
||||
resource_class: large
|
||||
environment:
|
||||
NODE_OPTIONS: '--max-old-space-size=6442'
|
||||
docker:
|
||||
- image: node:16
|
||||
- image: 0xorg/verdaccio
|
||||
steps:
|
||||
- checkout
|
||||
- run: |
|
||||
git diff --name-only development >> changed.txt
|
||||
cat changed.txt
|
||||
if ! grep -q packages/ changed.txt; then
|
||||
circleci-agent step halt
|
||||
fi
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
|
||||
- run:
|
||||
command: yarn test:publish:circleci
|
||||
no_output_timeout: 1800
|
||||
- store_artifacts:
|
||||
path: ~/.npm/_logs
|
||||
test-doc-generation:
|
||||
docker:
|
||||
- image: node:16
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
|
||||
- run:
|
||||
command: yarn test:generate_docs:circleci
|
||||
no_output_timeout: 1200
|
||||
test-rest:
|
||||
docker:
|
||||
- image: node:16
|
||||
environment:
|
||||
RUST_ROUTER: 'true'
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
|
||||
- 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
|
||||
- save_cache:
|
||||
key: coverage-contract-wrappers-test-{{ checksum "yarn.lock" }}
|
||||
paths:
|
||||
- ~/repo/packages/contract-wrappers-test/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-order-utils-{{ checksum "yarn.lock" }}
|
||||
paths:
|
||||
- ~/repo/packages/order-utils/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-web3-wrapper-{{ checksum "yarn.lock" }}
|
||||
paths:
|
||||
- ~/repo/packages/web3-wrapper/coverage/lcov.info
|
||||
static-tests:
|
||||
resource_class: large
|
||||
docker:
|
||||
- image: node:16
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
|
||||
- run:
|
||||
command: yarn lerna run lint
|
||||
- run:
|
||||
command: yarn prettier:ci
|
||||
- run:
|
||||
command: yarn deps_versions:ci
|
||||
- run:
|
||||
command: yarn diff_md_docs:ci
|
||||
- run:
|
||||
command: yarn test:links
|
||||
submit-coverage:
|
||||
docker:
|
||||
- image: node:16
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- lib-{{ .Environment.CIRCLE_SHA1 }}-<< pipeline.parameters.cache_version >>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-contract-wrappers-test-{{ checksum "yarn.lock" }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-order-utils-{{ checksum "yarn.lock" }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-contracts-{{ checksum "yarn.lock" }}
|
||||
- run: yarn report_coverage
|
||||
workflows:
|
||||
version: 2
|
||||
main:
|
||||
jobs:
|
||||
- build
|
||||
# Disabled until we begin actively developing on these packages again.
|
||||
# - test-exchange-ganache:
|
||||
# requires:
|
||||
# - build
|
||||
# - test-integrations-ganache:
|
||||
# requires:
|
||||
# - build
|
||||
# - test-contracts-staking-ganache:
|
||||
# requires:
|
||||
# - build
|
||||
# - test-contracts-extra-ganache:
|
||||
# requires:
|
||||
# - build
|
||||
- test-foundry:
|
||||
requires:
|
||||
- build
|
||||
- test-contracts-rest-ganache:
|
||||
requires:
|
||||
- build
|
||||
- test-rest:
|
||||
requires:
|
||||
- build
|
||||
- static-tests:
|
||||
requires:
|
||||
- build
|
||||
- test-publish:
|
||||
requires:
|
||||
- build
|
||||
- test-doc-generation:
|
||||
requires:
|
||||
- build
|
||||
# Disabled until this repo has a coveralls API key
|
||||
# - submit-coverage:
|
||||
# requires:
|
||||
# # Disabled until we begin actively developing on these packages again.
|
||||
# # - test-exchange-ganache
|
||||
# # - test-integrations-ganache
|
||||
# # - test-contracts-staking-ganache
|
||||
# # - test-contracts-extra-ganache
|
||||
# - test-contracts-rest-ganache
|
||||
# - test-rest
|
||||
# - static-tests
|
2
CODEOWNERS → .github/CODEOWNERS
vendored
2
CODEOWNERS → .github/CODEOWNERS
vendored
@@ -8,7 +8,7 @@
|
||||
|
||||
# Dev tools & setup
|
||||
|
||||
.circleci/ @dekz
|
||||
.github/ @dekz
|
||||
packages/contract-addresses/ @dekz @dextracker @kyu-c
|
||||
packages/contract-artifacts/ @dekz
|
||||
packages/protocol-utils/ @dekz
|
12
CONTRIBUTING.md → .github/CONTRIBUTING.md
vendored
12
CONTRIBUTING.md → .github/CONTRIBUTING.md
vendored
@@ -89,15 +89,3 @@ A few of our coding conventions are not yet enforced by the linter/auto-formatte
|
||||
1. If you _must_ cast a variable to any - try to type it back as fast as possible. (e.g., `const cw = ((zeroEx as any)._contractWrappers as ContractWrappers);`). This ensures subsequent code is type-safe.
|
||||
1. Our enum conventions coincide with the recommended TypeScript conventions, using capitalized keys, and all-caps snake-case values. Eg `GetStats = 'GET_STATS'`
|
||||
1. All public, exported methods/functions/classes must have associated Javadoc-style comments.
|
||||
|
||||
### Fix `submit-coverage` CI failure
|
||||
|
||||
If you simply fork the repo and then create a PR from it, your PR will fail the `submit-coverage` check on CI. This is because the 0x CircleCI configuration sets the `COVERALLS_REPO_TOKEN` environment variable to the token for `0xProject/0x-tools`, but when running the check against your fork the token needs to match your repo's name `your-username/0x-tools`.
|
||||
|
||||
To facilitate this check, after creating your fork, but before creating the branch for your PR, do the following:
|
||||
|
||||
1. Log in to [coveralls.io](https://coveralls.io/), go to `Add Repos`, and enable your fork. Then go to the settings for that repo, and copy the `Repo Token` identifier.
|
||||
2. Log in to [CircleCI](https://circleci.com/login), go to `Add Projects`, click the `Set Up Project` button corresponding to your fork, and then click `Start Building`. (Aside from step 3 below, no actual set up is needed, since it will use the `.circleci/config.yml` file in 0x-tools, so you can ignore all of the instruction/explanation given on the page with the `Start Building` button.)
|
||||
3. In CircleCI, configure your project to add an environment variable, with name `COVERALLS_REPO_TOKEN`, and for the value paste in the `Repo Token` you copied in step 1.
|
||||
|
||||
Now, when you push to your branch, CircleCI will automatically run all of the checks in your own instance, and the coverage check will work since it has the proper `Repo Token`, and the PR will magically refer to your own checks rather than running them in the 0x CircleCI instance.
|
12
ISSUE_TEMPLATE.md → .github/ISSUE_TEMPLATE.md
vendored
12
ISSUE_TEMPLATE.md → .github/ISSUE_TEMPLATE.md
vendored
@@ -2,15 +2,13 @@
|
||||
|
||||
<!--- Before submitting please check to see if this issue was already reported -->
|
||||
|
||||
<!--- Prefix your issue title with the package name it relates to (e.g., `0x.js: ` or `general:`) -->
|
||||
|
||||
## Expected Behavior
|
||||
|
||||
<!--- If you're describing a bug, tell us what should happen -->
|
||||
|
||||
<!--- If you're suggesting a package change/improvement, tell us how it should work -->
|
||||
|
||||
<!--- If you're suggesting a contract or protocol change/improvement, visit our ZEIPs repo -->
|
||||
<!--- If you're suggesting a contract or protocol change/improvement, visit our ZEIPs repo https://github.com/0xProject/ZEIPs -->
|
||||
|
||||
## Current Behavior
|
||||
|
||||
@@ -50,8 +48,8 @@
|
||||
| ------: | :------ |
|
||||
|
||||
<!-- For example:
|
||||
| `0x.js` | 2.0.4 |
|
||||
| `Exchange Contract` | v2 |
|
||||
| `protocol-utils` | 2.0.4 |
|
||||
| `Exchange Contract` | v3 |
|
||||
-->
|
||||
|
||||
| Network |
|
||||
@@ -60,6 +58,6 @@
|
||||
|
||||
<!-- For example:
|
||||
| mainnet |
|
||||
| kovan |
|
||||
| testrpc |
|
||||
| goerli |
|
||||
| development |
|
||||
-->
|
8
.github/autolabeler.yml
vendored
8
.github/autolabeler.yml
vendored
@@ -1,6 +1,2 @@
|
||||
python: ['python-packages']
|
||||
contracts: ['contracts']
|
||||
@0x/contract-addresses: ['packages/contract-addresses']
|
||||
@0x/order-utils: ['packages/order-utils']
|
||||
@0x/contract-artifacts: ['packages/contract-artifacts']
|
||||
@0x/contract-wrappers: ['packages/contract-wrappers']
|
||||
documentation: ['docs']
|
||||
liquidity integrations: ['contracts/zero-ex/contracts/src/transformers']
|
||||
|
7
.github/dependabot.yml
vendored
Normal file
7
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: monthly
|
||||
target-branch: "development"
|
19
.github/stale.yml
vendored
19
.github/stale.yml
vendored
@@ -1,19 +0,0 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 30
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 30
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- pinned
|
||||
- security
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: stale
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: >
|
||||
This issue has been automatically closed because no activity occured in 7 days after being marked as stale. If it's still relevant - feel free to reopen. Thank you
|
||||
for your contributions.
|
105
.github/workflows/ci.yml
vendored
Normal file
105
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
name: Continuous Integration
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- development
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "16"
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Build solution
|
||||
run: yarn build
|
||||
|
||||
- name: Lint typescript
|
||||
run: yarn lint:ts
|
||||
|
||||
- name: Lint solidity
|
||||
run: yarn lint:contracts
|
||||
|
||||
- name: Run prettier
|
||||
run: yarn prettier:ci
|
||||
|
||||
- name: Check dependent packages have consistent versions
|
||||
run: yarn deps_versions:ci
|
||||
|
||||
- name: Check diff in docs
|
||||
run: yarn diff_md_docs:ci
|
||||
|
||||
- name: Check for broken links in markdown files
|
||||
run: yarn test:links
|
||||
|
||||
- name: Test doc generation
|
||||
run: yarn test:generate_docs:ci
|
||||
|
||||
- name: Test @0x/contracts-*
|
||||
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:ci
|
||||
|
||||
- name: Test local @0x/contracts-*
|
||||
run: |
|
||||
yarn wsrun \
|
||||
-p @0x/contracts-test-utils \
|
||||
-p @0x/contract-addresses \
|
||||
-p @0x/contract-artifacts \
|
||||
-p @0x/contract-wrappers-test \
|
||||
-p @0x/order-utils \
|
||||
-m --serial -c test:ci
|
||||
|
||||
- name: Add foundry
|
||||
uses: foundry-rs/foundry-toolchain@v1
|
||||
with:
|
||||
version: nightly
|
||||
|
||||
- name: Run Forge build
|
||||
working-directory: contracts/zero-ex
|
||||
run: |
|
||||
forge --version
|
||||
forge build --sizes
|
||||
|
||||
- name: Run Forge tests
|
||||
working-directory: contracts/zero-ex
|
||||
run: |
|
||||
forge test -vvv --gas-report
|
||||
|
||||
- name: Run Forge coverage
|
||||
working-directory: contracts/zero-ex
|
||||
run: |
|
||||
forge coverage --report lcov
|
||||
|
||||
- name: Upload the coverage report to Coveralls
|
||||
uses: coverallsapp/github-action@master
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
base-path: ./contracts/zero-ex/
|
||||
path-to-lcov: ./contracts/zero-ex/lcov.info
|
||||
|
||||
|
||||
|
||||
|
||||
|
40
.github/workflows/stale.yml
vendored
Normal file
40
.github/workflows/stale.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
name: "Close stale issues and PRs"
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 8 * * 1-5" # This is in UTC.
|
||||
# Do a dry-run (debug-only: true) whenever this workflow itself is changed.
|
||||
pull_request:
|
||||
paths:
|
||||
- .github/workflows/stale.yml
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v7
|
||||
with:
|
||||
ascending: true # Spend API operations budget on older, more-likely-to-get-closed issues first
|
||||
close-issue-message: "" # Leave no comment when closing
|
||||
close-pr-message: "" # Leave no comment when closing
|
||||
days-before-issue-stale: 30
|
||||
days-before-pr-stale: 30
|
||||
days-before-close: 14
|
||||
debug-only: ${{ github.event_name == 'pull_request' }} # Dry-run when true.
|
||||
exempt-issue-labels: bug,enhancement,feature,question
|
||||
# No actual changes get made in debug-only mode, so we can raise the operations ceiling.
|
||||
operations-per-run: ${{ github.event_name == 'pull_request' && 100 || 30}}
|
||||
stale-issue-label: stale
|
||||
stale-issue-message: "This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions."
|
||||
stale-pr-label: stale
|
||||
stale-pr-message: "This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions."
|
||||
# Time immemorial when in debug-only mode (ie. on pull requests).
|
||||
# `STALEBOT_START_DATE` otherwise.
|
||||
# You can use this as a killswitch by setting `STALEBOT_START_DATE` in the far future.
|
||||
start-date: ${{ github.event_name == 'pull_request' && '1970-01-01T00:00:00Z' || secrets.STALEBOT_START_DATE }} # ISO 8601 or RFC 2822
|
104
.gitignore
vendored
104
.gitignore
vendored
@@ -15,9 +15,6 @@ pids
|
||||
*.db
|
||||
*.sqlite
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
@@ -80,104 +77,19 @@ TODO.md
|
||||
.idea
|
||||
|
||||
# generated contract artifacts/
|
||||
contracts/broker/generated-artifacts/
|
||||
contracts/broker/test/generated-artifacts/
|
||||
contracts/erc20-bridge-sampler/generated-artifacts/
|
||||
contracts/erc20-bridge-sampler/test/generated-artifacts/
|
||||
contracts/integrations/generated-artifacts/
|
||||
contracts/integrations/test/generated-artifacts/
|
||||
contracts/staking/generated-artifacts/
|
||||
contracts/staking/test/generated-artifacts/
|
||||
contracts/coordinator/generated-artifacts/
|
||||
contracts/coordinator/test/generated-artifacts/
|
||||
contracts/exchange/generated-artifacts/
|
||||
contracts/exchange/test/generated-artifacts/
|
||||
contracts/asset-proxy/generated-artifacts/
|
||||
contracts/asset-proxy/test/generated-artifacts/
|
||||
contracts/multisig/generated-artifacts/
|
||||
contracts/multisig/test/generated-artifacts/
|
||||
contracts/utils/generated-artifacts/
|
||||
contracts/utils/test/generated-artifacts/
|
||||
contracts/exchange-libs/generated-artifacts/
|
||||
contracts/exchange-libs/test/generated-artifacts/
|
||||
contracts/erc20/generated-artifacts/
|
||||
contracts/erc20/test/generated-artifacts/
|
||||
contracts/erc721/generated-artifacts/
|
||||
contracts/erc721/test/generated-artifacts/
|
||||
contracts/erc1155/generated-artifacts/
|
||||
contracts/erc1155/test/generated-artifacts/
|
||||
contracts/extensions/generated-artifacts/
|
||||
contracts/extensions/test/generated-artifacts/
|
||||
contracts/exchange-forwarder/generated-artifacts/
|
||||
contracts/exchange-forwarder/test/generated-artifacts/
|
||||
contracts/dev-utils/generated-artifacts/
|
||||
contracts/dev-utils/test/generated-artifacts/
|
||||
contracts/zero-ex/generated-artifacts/
|
||||
contracts/zero-ex/test/generated-artifacts/
|
||||
contracts/treasury/generated-artifacts/
|
||||
contracts/treasury/test/generated-artifacts/
|
||||
|
||||
# generated truffle contract artifacts/
|
||||
contracts/broker/build/
|
||||
contracts/erc20-bridge-sampler/build/
|
||||
contracts/staking/build/
|
||||
contracts/coordinator/build/
|
||||
contracts/exchange/build/
|
||||
contracts/asset-proxy/build/
|
||||
contracts/multisig/build/
|
||||
contracts/utils/build/
|
||||
contracts/exchange-libs/build/
|
||||
contracts/erc20/build/
|
||||
contracts/erc721/build/
|
||||
contracts/erc1155/build/
|
||||
contracts/extensions/build/
|
||||
contracts/exchange-forwarder/build/
|
||||
contracts/dev-utils/build/
|
||||
generated-artifacts/
|
||||
|
||||
# generated contract wrappers
|
||||
contracts/broker/generated-wrappers/
|
||||
contracts/broker/test/generated-wrappers/
|
||||
packages/python-contract-wrappers/generated/
|
||||
contracts/erc20-bridge-sampler/generated-wrappers/
|
||||
contracts/erc20-bridge-sampler/test/generated-wrappers/
|
||||
contracts/integrations/generated-wrappers/
|
||||
contracts/integrations/test/generated-wrappers/
|
||||
contracts/staking/generated-wrappers/
|
||||
contracts/staking/test/generated-wrappers/
|
||||
contracts/coordinator/generated-wrappers/
|
||||
contracts/coordinator/test/generated-wrappers/
|
||||
contracts/exchange/generated-wrappers/
|
||||
contracts/exchange/test/generated-wrappers/
|
||||
contracts/asset-proxy/generated-wrappers/
|
||||
contracts/asset-proxy/test/generated-wrappers/
|
||||
contracts/multisig/generated-wrappers/
|
||||
contracts/multisig/test/generated-wrappers/
|
||||
contracts/utils/generated-wrappers/
|
||||
contracts/utils/test/generated-wrappers/
|
||||
contracts/exchange-libs/generated-wrappers/
|
||||
contracts/exchange-libs/test/generated-wrappers/
|
||||
contracts/erc20/generated-wrappers/
|
||||
contracts/erc20/test/generated-wrappers/
|
||||
contracts/erc721/generated-wrappers/
|
||||
contracts/erc721/test/generated-wrappers/
|
||||
contracts/erc1155/generated-wrappers/
|
||||
contracts/erc1155/test/generated-wrappers/
|
||||
contracts/extensions/generated-wrappers/
|
||||
contracts/extensions/test/generated-wrappers/
|
||||
contracts/exchange-forwarder/generated-wrappers/
|
||||
contracts/exchange-forwarder/test/generated-wrappers/
|
||||
contracts/dev-utils/generated-wrappers/
|
||||
contracts/dev-utils/test/generated-wrappers/
|
||||
contracts/zero-ex/generated-wrappers/
|
||||
contracts/zero-ex/test/generated-wrappers/
|
||||
contracts/treasury/generated-wrappers/
|
||||
contracts/treasury/test/generated-wrappers/
|
||||
generated-wrappers/
|
||||
|
||||
# foundry artifacts
|
||||
contracts/zero-ex/foundry-artifacts/
|
||||
foundry-artifacts/
|
||||
|
||||
# foundry cache
|
||||
contracts/zero-ex/foundry-cache/
|
||||
# foundry cache
|
||||
cache/
|
||||
|
||||
#foundry output artifacts
|
||||
out/
|
||||
|
||||
# typechain wrappers
|
||||
contracts/zero-ex/typechain-wrappers/
|
||||
|
4
.husky/pre-commit
Executable file
4
.husky/pre-commit
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
npx lint-staged --no-stash
|
@@ -1,88 +1,10 @@
|
||||
lib
|
||||
deps
|
||||
.nyc_output
|
||||
/contracts/broker/generated-wrappers
|
||||
/contracts/broker/test/generated-wrappers
|
||||
/contracts/broker/generated-artifacts
|
||||
/contracts/broker/test/generated-artifacts
|
||||
/contracts/integrations/generated-wrappers
|
||||
/contracts/integrations/test/generated-wrappers
|
||||
/contracts/integrations/generated-artifacts
|
||||
/contracts/integrations/test/generated-artifacts
|
||||
/contracts/staking/generated-wrappers
|
||||
/contracts/staking/test/generated-wrappers
|
||||
/contracts/staking/generated-artifacts
|
||||
/contracts/staking/test/generated-artifacts
|
||||
/contracts/coordinator/generated-wrappers
|
||||
/contracts/coordinator/test/generated-wrappers
|
||||
/contracts/coordinator/generated-artifacts
|
||||
/contracts/coordinator/test/generated-artifacts
|
||||
/contracts/exchange/generated-wrappers
|
||||
/contracts/exchange/test/generated-wrappers
|
||||
/contracts/exchange/generated-artifacts
|
||||
/contracts/exchange/test/generated-artifacts
|
||||
/contracts/asset-proxy/generated-wrappers
|
||||
/contracts/asset-proxy/test/generated-wrappers
|
||||
/contracts/asset-proxy/generated-artifacts
|
||||
/contracts/asset-proxy/test/generated-artifacts
|
||||
/contracts/multisig/generated-wrappers
|
||||
/contracts/multisig/test/generated-wrappers
|
||||
/contracts/multisig/generated-artifacts
|
||||
/contracts/multisig/test/generated-artifacts
|
||||
/contracts/utils/generated-wrappers
|
||||
/contracts/utils/test/generated-wrappers
|
||||
/contracts/utils/generated-artifacts
|
||||
/contracts/utils/test/generated-artifacts
|
||||
/contracts/exchange-libs/generated-wrappers
|
||||
/contracts/exchange-libs/test/generated-wrappers
|
||||
/contracts/exchange-libs/generated-artifacts
|
||||
/contracts/exchange-libs/test/generated-artifacts
|
||||
/contracts/erc20/generated-wrappers
|
||||
/contracts/erc20/test/generated-wrappers
|
||||
/contracts/erc20/generated-artifacts
|
||||
/contracts/erc20/test/generated-artifacts
|
||||
/contracts/erc721/generated-wrappers
|
||||
/contracts/erc721/test/generated-wrappers
|
||||
/contracts/erc721/generated-artifacts
|
||||
/contracts/erc721/test/generated-artifacts
|
||||
/contracts/erc1155/generated-wrappers
|
||||
/contracts/erc1155/test/generated-wrappers
|
||||
/contracts/erc1155/generated-artifacts
|
||||
/contracts/erc1155/test/generated-artifacts
|
||||
/contracts/extensions/generated-wrappers
|
||||
/contracts/extensions/test/generated-wrappers
|
||||
/contracts/extensions/generated-artifacts
|
||||
/contracts/extensions/test/generated-artifacts
|
||||
/contracts/exchange-forwarder/generated-wrappers
|
||||
/contracts/exchange-forwarder/test/generated-wrappers
|
||||
/contracts/exchange-forwarder/generated-artifacts
|
||||
/contracts/exchange-forwarder/test/generated-artifacts
|
||||
/contracts/dev-utils/generated-wrappers
|
||||
/contracts/dev-utils/test/generated-wrappers
|
||||
/contracts/dev-utils/generated-artifacts
|
||||
/contracts/dev-utils/test/generated-artifacts
|
||||
/contracts/zero-ex/foundry-artifacts
|
||||
/contracts/zero-ex/generated-wrappers
|
||||
/contracts/zero-ex/test/generated-wrappers
|
||||
/contracts/zero-ex/generated-artifacts
|
||||
/contracts/zero-ex/test/generated-artifacts
|
||||
/contracts/treasury/generated-wrappers
|
||||
/contracts/treasury/test/generated-wrappers
|
||||
/contracts/treasury/generated-artifacts
|
||||
/contracts/treasury/test/generated-artifacts
|
||||
/contracts/staking/build/
|
||||
/contracts/coordinator/build/
|
||||
/contracts/exchange/build/
|
||||
/contracts/asset-proxy/build/
|
||||
/contracts/multisig/build/
|
||||
/contracts/utils/build/
|
||||
/contracts/exchange-libs/build/
|
||||
/contracts/erc20/build/
|
||||
/contracts/erc721/build/
|
||||
/contracts/erc1155/build/
|
||||
/contracts/extensions/build/
|
||||
/contracts/exchange-forwarder/build/
|
||||
/packages/asset-swapper/
|
||||
/packages/contract-wrappers/src/generated-wrappers/
|
||||
generated-artifacts/
|
||||
generated-wrappers/
|
||||
foundry-artifacts/
|
||||
out/
|
||||
cache/
|
||||
package.json
|
||||
packages/*/docs
|
||||
docs/
|
||||
packages
|
||||
|
@@ -1 +1,9 @@
|
||||
contracts/erc20/contracts/src/ZRXToken.sol
|
||||
node_modules/
|
||||
lib
|
||||
deps
|
||||
generated-artifacts/
|
||||
generated-wrappers/
|
||||
foundry-artifacts/
|
||||
out/
|
||||
cache/
|
||||
|
@@ -8,8 +8,7 @@ This repository is a monorepo including the 0x protocol smart contracts and nume
|
||||
|
||||
[website-url]: https://0x.org
|
||||
|
||||
[](https://circleci.com/gh/0xProject/protocool)
|
||||
[](https://coveralls.io/github/0xProject/0x-monorepo?branch=development)
|
||||
[](https://coveralls.io/github/0xProject/protocol?branch=development)
|
||||
[](https://discordapp.com/invite/d3FTX3M)
|
||||
[](https://opensource.org/licenses/Apache-2.0)
|
||||
|
||||
@@ -54,7 +53,7 @@ You can include those by prepending the `@0x/typescript-typings` package to your
|
||||
|
||||
We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
|
||||
|
||||
#### Read our [contribution guidelines](./CONTRIBUTING.md).
|
||||
#### Read our [contribution guidelines](.github/CONTRIBUTING.md).
|
||||
|
||||
### Install dependencies
|
||||
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1674517560,
|
||||
"version": "3.3.55",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1670879498,
|
||||
"version": "3.3.54",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1669235113,
|
||||
"version": "3.3.53",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.3.55 - _January 23, 2023_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.3.54 - _December 12, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.3.53 - _November 23, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -20,7 +20,7 @@ We strongly recommend that the community help us make improvements and determine
|
||||
|
||||
For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
|
||||
|
||||
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
|
||||
Please read our [contribution guidelines](../../.github/CONTRIBUTING.md) before getting started.
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
|
63
contracts/erc20/contracts/src/v08/IERC20TokenV08.sol
Normal file
63
contracts/erc20/contracts/src/v08/IERC20TokenV08.sol
Normal file
@@ -0,0 +1,63 @@
|
||||
// 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.8.0;
|
||||
|
||||
interface IERC20TokenV08 {
|
||||
event Transfer(address indexed from, address indexed to, uint256 value);
|
||||
|
||||
event Approval(address indexed owner, address indexed spender, uint256 value);
|
||||
|
||||
/// @dev send `value` token to `to` from `msg.sender`
|
||||
/// @param to The address of the recipient
|
||||
/// @param value The amount of token to be transferred
|
||||
/// @return True if transfer was successful
|
||||
function transfer(address to, uint256 value) external returns (bool);
|
||||
|
||||
/// @dev send `value` token to `to` from `from` on the condition it is approved by `from`
|
||||
/// @param from The address of the sender
|
||||
/// @param to The address of the recipient
|
||||
/// @param value The amount of token to be transferred
|
||||
/// @return True if transfer was successful
|
||||
function transferFrom(address from, address to, uint256 value) external returns (bool);
|
||||
|
||||
/// @dev `msg.sender` approves `spender` to spend `value` tokens
|
||||
/// @param spender The address of the account able to transfer the tokens
|
||||
/// @param value The amount of wei to be approved for transfer
|
||||
/// @return Always true if the call has enough gas to complete execution
|
||||
function approve(address spender, uint256 value) external returns (bool);
|
||||
|
||||
/// @dev Query total supply of token
|
||||
/// @return Total supply of token
|
||||
function totalSupply() external view returns (uint256);
|
||||
|
||||
/// @dev Get the balance of `owner`.
|
||||
/// @param owner The address from which the balance will be retrieved
|
||||
/// @return Balance of owner
|
||||
function balanceOf(address owner) external view returns (uint256);
|
||||
|
||||
/// @dev Get the allowance for `spender` to spend from `owner`.
|
||||
/// @param owner The address of the account owning tokens
|
||||
/// @param spender The address of the account able to transfer the tokens
|
||||
/// @return Amount of remaining tokens allowed to spent
|
||||
function allowance(address owner, address spender) external view returns (uint256);
|
||||
|
||||
/// @dev Get the number of decimals this token has.
|
||||
function decimals() external view returns (uint8);
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
/*
|
||||
|
||||
Copyright 2022 ZeroEx Intl.
|
||||
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.
|
||||
@@ -17,14 +17,14 @@
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity ^0.6;
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import "forge-std/Test.sol";
|
||||
import "./IERC20TokenV08.sol";
|
||||
|
||||
contract ContractTest is Test {
|
||||
function setUp() public {}
|
||||
interface IEtherTokenV08 is IERC20TokenV08 {
|
||||
/// @dev Wrap ether.
|
||||
function deposit() external payable;
|
||||
|
||||
function testExample() public {
|
||||
assertTrue(true);
|
||||
}
|
||||
/// @dev Unwrap ether.
|
||||
function withdraw(uint256 amount) external;
|
||||
}
|
146
contracts/erc20/contracts/src/v08/LibERC20TokenV08.sol
Normal file
146
contracts/erc20/contracts/src/v08/LibERC20TokenV08.sol
Normal file
@@ -0,0 +1,146 @@
|
||||
// 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.8.0;
|
||||
|
||||
import "@0x/contracts-utils/contracts/src/v08/errors/LibRichErrorsV08.sol";
|
||||
import "@0x/contracts-utils/contracts/src/v08/LibBytesV08.sol";
|
||||
import "./IERC20TokenV08.sol";
|
||||
|
||||
library LibERC20TokenV08 {
|
||||
bytes private constant DECIMALS_CALL_DATA = hex"313ce567";
|
||||
|
||||
/// @dev Calls `IERC20TokenV08(token).approve()`.
|
||||
/// Reverts if the return data is invalid or the call reverts.
|
||||
/// @param token The address of the token contract.
|
||||
/// @param spender The address that receives an allowance.
|
||||
/// @param allowance The allowance to set.
|
||||
function compatApprove(IERC20TokenV08 token, address spender, uint256 allowance) internal {
|
||||
bytes memory callData = abi.encodeCall(token.approve, (spender, allowance));
|
||||
_callWithOptionalBooleanResult(address(token), callData);
|
||||
}
|
||||
|
||||
/// @dev Calls `IERC20TokenV08(token).approve()` and sets the allowance to the
|
||||
/// maximum if the current approval is not already >= an amount.
|
||||
/// Reverts if the return data is invalid or the call reverts.
|
||||
/// @param token The address of the token contract.
|
||||
/// @param spender The address that receives an allowance.
|
||||
/// @param amount The minimum allowance needed.
|
||||
function approveIfBelow(IERC20TokenV08 token, address spender, uint256 amount) internal {
|
||||
if (token.allowance(address(this), spender) < amount) {
|
||||
compatApprove(token, spender, type(uint256).max);
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Calls `IERC20TokenV08(token).transfer()`.
|
||||
/// Reverts if the return data is invalid or the call reverts.
|
||||
/// @param token The address of the token contract.
|
||||
/// @param to The address that receives the tokens
|
||||
/// @param amount Number of tokens to transfer.
|
||||
function compatTransfer(IERC20TokenV08 token, address to, uint256 amount) internal {
|
||||
bytes memory callData = abi.encodeCall(token.transfer, (to, amount));
|
||||
_callWithOptionalBooleanResult(address(token), callData);
|
||||
}
|
||||
|
||||
/// @dev Calls `IERC20TokenV08(token).transferFrom()`.
|
||||
/// Reverts if the return data is invalid or the call reverts.
|
||||
/// @param token The address of the token contract.
|
||||
/// @param from The owner of the tokens.
|
||||
/// @param to The address that receives the tokens
|
||||
/// @param amount Number of tokens to transfer.
|
||||
function compatTransferFrom(IERC20TokenV08 token, address from, address to, uint256 amount) internal {
|
||||
bytes memory callData = abi.encodeCall(token.transferFrom, (from, to, amount));
|
||||
_callWithOptionalBooleanResult(address(token), callData);
|
||||
}
|
||||
|
||||
/// @dev Retrieves the number of decimals for a token.
|
||||
/// Returns `18` if the call reverts.
|
||||
/// @param token The address of the token contract.
|
||||
/// @return tokenDecimals The number of decimals places for the token.
|
||||
function compatDecimals(IERC20TokenV08 token) internal view returns (uint8 tokenDecimals) {
|
||||
tokenDecimals = 18;
|
||||
(bool didSucceed, bytes memory resultData) = address(token).staticcall(DECIMALS_CALL_DATA);
|
||||
if (didSucceed && resultData.length >= 32) {
|
||||
tokenDecimals = abi.decode(resultData, (uint8));
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Retrieves the allowance for a token, owner, and spender.
|
||||
/// Returns `0` if the call reverts.
|
||||
/// @param token The address of the token contract.
|
||||
/// @param owner The owner of the tokens.
|
||||
/// @param spender The address the spender.
|
||||
/// @return allowance_ The allowance for a token, owner, and spender.
|
||||
function compatAllowance(
|
||||
IERC20TokenV08 token,
|
||||
address owner,
|
||||
address spender
|
||||
) internal view returns (uint256 allowance_) {
|
||||
(bool didSucceed, bytes memory resultData) = address(token).staticcall(
|
||||
abi.encodeCall(token.allowance, (owner, spender))
|
||||
);
|
||||
if (didSucceed && resultData.length >= 32) {
|
||||
allowance_ = abi.decode(resultData, (uint256));
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Retrieves the balance for a token owner.
|
||||
/// Returns `0` if the call reverts.
|
||||
/// @param token The address of the token contract.
|
||||
/// @param owner The owner of the tokens.
|
||||
/// @return balance The token balance of an owner.
|
||||
function compatBalanceOf(IERC20TokenV08 token, address owner) internal view returns (uint256 balance) {
|
||||
(bool didSucceed, bytes memory resultData) = address(token).staticcall(
|
||||
abi.encodeCall(token.balanceOf, (owner))
|
||||
);
|
||||
if (didSucceed && resultData.length >= 32) {
|
||||
balance = abi.decode(resultData, (uint256));
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Executes a call on address `target` with calldata `callData`
|
||||
/// and asserts that either nothing was returned or a single boolean
|
||||
/// was returned equal to `true`.
|
||||
/// @param target The call target.
|
||||
/// @param callData The abi-encoded call data.
|
||||
function _callWithOptionalBooleanResult(address target, bytes memory callData) private {
|
||||
(bool didSucceed, bytes memory resultData) = target.call(callData);
|
||||
// Revert if the call reverted.
|
||||
if (!didSucceed) {
|
||||
LibRichErrorsV08.rrevert(resultData);
|
||||
}
|
||||
// If we get back 0 returndata, this may be a non-standard ERC-20 that
|
||||
// does not return a boolean. Check that it at least contains code.
|
||||
if (resultData.length == 0) {
|
||||
require(target.code.length > 0, "invalid token address, contains no code");
|
||||
return;
|
||||
}
|
||||
// If we get back at least 32 bytes, we know the target address
|
||||
// contains code, and we assume it is a token that returned a boolean
|
||||
// success value, which must be true.
|
||||
if (resultData.length >= 32) {
|
||||
if (!abi.decode(resultData, (bool))) {
|
||||
LibRichErrorsV08.rrevert(resultData);
|
||||
}
|
||||
}
|
||||
// If 0 < returndatasize < 32, the target is a contract, but not a
|
||||
// valid token.
|
||||
LibRichErrorsV08.rrevert(resultData);
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-erc20",
|
||||
"version": "3.3.53",
|
||||
"version": "3.3.55",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -15,7 +15,6 @@
|
||||
"pre_build": "run-s compile contracts:gen generate_contract_wrappers contracts:copy",
|
||||
"test": "yarn run_mocha",
|
||||
"rebuild_and_test": "run-s build test",
|
||||
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
|
||||
"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",
|
||||
@@ -25,11 +24,7 @@
|
||||
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
|
||||
"lint": "eslint src test",
|
||||
"fix": "eslint --fix src test",
|
||||
"coverage:report:text": "istanbul report text",
|
||||
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||
"profiler:report:html": "istanbul report html && open coverage/index.html",
|
||||
"coverage:report:lcov": "istanbul report lcov",
|
||||
"test:circleci": "yarn test",
|
||||
"test:ci": "yarn test",
|
||||
"contracts:gen": "contracts-gen generate",
|
||||
"contracts:copy": "contracts-gen copy",
|
||||
"docs:md": "ts-doc-gen --sourceDir='$PROJECT_FILES' --output=$MD_FILE_DIR --fileExtension=mdx --tsconfig=./typedoc-tsconfig.json",
|
||||
@@ -37,7 +32,7 @@
|
||||
},
|
||||
"config": {
|
||||
"publicInterfaceContracts": "DummyERC20Token,ERC20Token,WETH9,ZRXToken,DummyNoReturnERC20Token,DummyMultipleReturnERC20Token",
|
||||
"abis": "./test/generated-artifacts/@(DummyERC20Token|DummyMultipleReturnERC20Token|DummyNoReturnERC20Token|ERC20Token|IERC20Token|IERC20TokenV06|IEtherToken|IEtherTokenV06|LibERC20Token|LibERC20TokenV06|MintableERC20Token|TestLibERC20Token|TestLibERC20TokenTarget|UnlimitedAllowanceERC20Token|UntransferrableDummyERC20Token|WETH9|ZRXToken).json",
|
||||
"abis": "./test/generated-artifacts/@(DummyERC20Token|DummyMultipleReturnERC20Token|DummyNoReturnERC20Token|ERC20Token|IERC20Token|IERC20TokenV06|IERC20TokenV08|IEtherToken|IEtherTokenV06|IEtherTokenV08|LibERC20Token|LibERC20TokenV06|LibERC20TokenV08|MintableERC20Token|TestLibERC20Token|TestLibERC20TokenTarget|UnlimitedAllowanceERC20Token|UntransferrableDummyERC20Token|WETH9|ZRXToken).json",
|
||||
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
|
||||
},
|
||||
"repository": {
|
||||
@@ -52,8 +47,8 @@
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contracts-gen": "^2.0.48",
|
||||
"@0x/contracts-test-utils": "^5.4.43",
|
||||
"@0x/contracts-utils": "^4.8.34",
|
||||
"@0x/contracts-test-utils": "^5.4.45",
|
||||
"@0x/contracts-utils": "^4.8.36",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
|
@@ -11,10 +11,13 @@ import * as DummyNoReturnERC20Token from '../test/generated-artifacts/DummyNoRet
|
||||
import * as ERC20Token from '../test/generated-artifacts/ERC20Token.json';
|
||||
import * as IERC20Token from '../test/generated-artifacts/IERC20Token.json';
|
||||
import * as IERC20TokenV06 from '../test/generated-artifacts/IERC20TokenV06.json';
|
||||
import * as IERC20TokenV08 from '../test/generated-artifacts/IERC20TokenV08.json';
|
||||
import * as IEtherToken from '../test/generated-artifacts/IEtherToken.json';
|
||||
import * as IEtherTokenV06 from '../test/generated-artifacts/IEtherTokenV06.json';
|
||||
import * as IEtherTokenV08 from '../test/generated-artifacts/IEtherTokenV08.json';
|
||||
import * as LibERC20Token from '../test/generated-artifacts/LibERC20Token.json';
|
||||
import * as LibERC20TokenV06 from '../test/generated-artifacts/LibERC20TokenV06.json';
|
||||
import * as LibERC20TokenV08 from '../test/generated-artifacts/LibERC20TokenV08.json';
|
||||
import * as MintableERC20Token from '../test/generated-artifacts/MintableERC20Token.json';
|
||||
import * as TestLibERC20Token from '../test/generated-artifacts/TestLibERC20Token.json';
|
||||
import * as TestLibERC20TokenTarget from '../test/generated-artifacts/TestLibERC20TokenTarget.json';
|
||||
@@ -34,6 +37,9 @@ export const artifacts = {
|
||||
IERC20TokenV06: IERC20TokenV06 as ContractArtifact,
|
||||
IEtherTokenV06: IEtherTokenV06 as ContractArtifact,
|
||||
LibERC20TokenV06: LibERC20TokenV06 as ContractArtifact,
|
||||
IERC20TokenV08: IERC20TokenV08 as ContractArtifact,
|
||||
IEtherTokenV08: IEtherTokenV08 as ContractArtifact,
|
||||
LibERC20TokenV08: LibERC20TokenV08 as ContractArtifact,
|
||||
DummyERC20Token: DummyERC20Token as ContractArtifact,
|
||||
DummyMultipleReturnERC20Token: DummyMultipleReturnERC20Token as ContractArtifact,
|
||||
DummyNoReturnERC20Token: DummyNoReturnERC20Token as ContractArtifact,
|
||||
|
@@ -1,19 +0,0 @@
|
||||
import { env, EnvVars } from '@0x/dev-utils';
|
||||
|
||||
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
|
||||
import { providerUtils } from '@0x/utils';
|
||||
|
||||
before('start web3 provider', () => {
|
||||
providerUtils.startProviderEngine(provider);
|
||||
});
|
||||
after('generate coverage report', async () => {
|
||||
if (env.parseBoolean(EnvVars.SolidityCoverage)) {
|
||||
const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
|
||||
await coverageSubprovider.writeCoverageAsync();
|
||||
}
|
||||
if (env.parseBoolean(EnvVars.SolidityProfiler)) {
|
||||
const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
|
||||
await profilerSubprovider.writeProfilerOutputAsync();
|
||||
}
|
||||
provider.stop();
|
||||
});
|
@@ -9,10 +9,13 @@ export * from '../test/generated-wrappers/dummy_no_return_erc20_token';
|
||||
export * from '../test/generated-wrappers/erc20_token';
|
||||
export * from '../test/generated-wrappers/i_erc20_token';
|
||||
export * from '../test/generated-wrappers/i_erc20_token_v06';
|
||||
export * from '../test/generated-wrappers/i_erc20_token_v08';
|
||||
export * from '../test/generated-wrappers/i_ether_token';
|
||||
export * from '../test/generated-wrappers/i_ether_token_v06';
|
||||
export * from '../test/generated-wrappers/i_ether_token_v08';
|
||||
export * from '../test/generated-wrappers/lib_erc20_token';
|
||||
export * from '../test/generated-wrappers/lib_erc20_token_v06';
|
||||
export * from '../test/generated-wrappers/lib_erc20_token_v08';
|
||||
export * from '../test/generated-wrappers/mintable_erc20_token';
|
||||
export * from '../test/generated-wrappers/test_lib_erc20_token';
|
||||
export * from '../test/generated-wrappers/test_lib_erc20_token_target';
|
||||
|
@@ -1,96 +0,0 @@
|
||||
/**
|
||||
* Use this file to configure your truffle project. It's seeded with some
|
||||
* common settings for different networks and features like migrations,
|
||||
* compilation and testing. Uncomment the ones you need or modify
|
||||
* them to suit your project as necessary.
|
||||
*
|
||||
* More information about configuration can be found at:
|
||||
*
|
||||
* truffleframework.com/docs/advanced/configuration
|
||||
*
|
||||
* To deploy via Infura you'll need a wallet provider (like truffle-hdwallet-provider)
|
||||
* to sign your transactions before they're sent to a remote public node. Infura accounts
|
||||
* are available for free at: infura.io/register.
|
||||
*
|
||||
* You'll also need a mnemonic - the twelve word phrase the wallet uses to generate
|
||||
* public/private key pairs. If you're publishing your code to GitHub make sure you load this
|
||||
* phrase from a file you've .gitignored so it doesn't accidentally become public.
|
||||
*
|
||||
*/
|
||||
|
||||
// const HDWalletProvider = require('truffle-hdwallet-provider');
|
||||
// const infuraKey = "fj4jll3k.....";
|
||||
//
|
||||
// const fs = require('fs');
|
||||
// const mnemonic = fs.readFileSync(".secret").toString().trim();
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* Networks define how you connect to your ethereum client and let you set the
|
||||
* defaults web3 uses to send transactions. If you don't specify one truffle
|
||||
* will spin up a development blockchain for you on port 9545 when you
|
||||
* run `develop` or `test`. You can ask a truffle command to use a specific
|
||||
* network from the command line, e.g
|
||||
*
|
||||
* $ truffle test --network <network-name>
|
||||
*/
|
||||
|
||||
networks: {
|
||||
// Useful for testing. The `development` name is special - truffle uses it by default
|
||||
// if it's defined here and no other network is specified at the command line.
|
||||
// You should run a client (like ganache-cli, geth or parity) in a separate terminal
|
||||
// tab if you use this network and you must also set the `host`, `port` and `network_id`
|
||||
// options below to some value.
|
||||
//
|
||||
// development: {
|
||||
// host: "127.0.0.1", // Localhost (default: none)
|
||||
// port: 8545, // Standard Ethereum port (default: none)
|
||||
// network_id: "*", // Any network (default: none)
|
||||
// },
|
||||
// Another network with more advanced options...
|
||||
// advanced: {
|
||||
// port: 8777, // Custom port
|
||||
// network_id: 1342, // Custom network
|
||||
// gas: 8500000, // Gas sent with each transaction (default: ~6700000)
|
||||
// gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei)
|
||||
// from: <address>, // Account to send txs from (default: accounts[0])
|
||||
// websockets: true // Enable EventEmitter interface for web3 (default: false)
|
||||
// },
|
||||
// Useful for deploying to a public network.
|
||||
// NB: It's important to wrap the provider as a function.
|
||||
// ropsten: {
|
||||
// provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`),
|
||||
// network_id: 3, // Ropsten's id
|
||||
// gas: 5500000, // Ropsten has a lower block limit than mainnet
|
||||
// confirmations: 2, // # of confs to wait between deployments. (default: 0)
|
||||
// timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
|
||||
// skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
|
||||
// },
|
||||
// Useful for private networks
|
||||
// private: {
|
||||
// provider: () => new HDWalletProvider(mnemonic, `https://network.io`),
|
||||
// network_id: 2111, // This network is yours, in the cloud.
|
||||
// production: true // Treats this network as if it was a public net. (default: false)
|
||||
// }
|
||||
},
|
||||
|
||||
// Set default mocha options here, use special reporters etc.
|
||||
mocha: {
|
||||
// timeout: 100000
|
||||
},
|
||||
|
||||
// Configure your compilers
|
||||
compilers: {
|
||||
solc: {
|
||||
version: '0.5.9',
|
||||
settings: {
|
||||
evmVersion: 'constantinople',
|
||||
optimizer: {
|
||||
enabled: true,
|
||||
runs: 1000000,
|
||||
details: { yul: true, deduplicate: true, cse: true, constantOptimizer: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
@@ -15,10 +15,13 @@
|
||||
"test/generated-artifacts/ERC20Token.json",
|
||||
"test/generated-artifacts/IERC20Token.json",
|
||||
"test/generated-artifacts/IERC20TokenV06.json",
|
||||
"test/generated-artifacts/IERC20TokenV08.json",
|
||||
"test/generated-artifacts/IEtherToken.json",
|
||||
"test/generated-artifacts/IEtherTokenV06.json",
|
||||
"test/generated-artifacts/IEtherTokenV08.json",
|
||||
"test/generated-artifacts/LibERC20Token.json",
|
||||
"test/generated-artifacts/LibERC20TokenV06.json",
|
||||
"test/generated-artifacts/LibERC20TokenV08.json",
|
||||
"test/generated-artifacts/MintableERC20Token.json",
|
||||
"test/generated-artifacts/TestLibERC20Token.json",
|
||||
"test/generated-artifacts/TestLibERC20TokenTarget.json",
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1674517560,
|
||||
"version": "5.4.45",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1670879498,
|
||||
"version": "5.4.44",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1669235113,
|
||||
"version": "5.4.43",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v5.4.45 - _January 23, 2023_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v5.4.44 - _December 12, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v5.4.43 - _November 23, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -24,7 +24,7 @@ import {
|
||||
|
||||
We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
|
||||
|
||||
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
|
||||
Please read our [contribution guidelines](../../.github/CONTRIBUTING.md) before getting started.
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-test-utils",
|
||||
"version": "5.4.43",
|
||||
"version": "5.4.45",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -13,16 +13,11 @@
|
||||
"build": "tsc -b",
|
||||
"build:ci": "yarn build",
|
||||
"test": "yarn run_mocha",
|
||||
"test:coverage": "run-s build run_mocha coverage:report:text coverage:report:lcov",
|
||||
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
|
||||
"clean": "shx rm -rf lib",
|
||||
"lint": "eslint src test",
|
||||
"fix": "eslint --fix src test",
|
||||
"coverage:report:text": "istanbul report text",
|
||||
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||
"profiler:report:html": "istanbul report html && open coverage/index.html",
|
||||
"coverage:report:lcov": "istanbul report lcov",
|
||||
"test:circleci": "yarn test"
|
||||
"test:ci": "yarn test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -46,11 +41,10 @@
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.35",
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/contract-addresses": "^7.4.1",
|
||||
"@0x/contract-addresses": "^8.0.1",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@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",
|
||||
|
@@ -1,26 +0,0 @@
|
||||
import { devConstants } from '@0x/dev-utils';
|
||||
import { CoverageSubprovider, SolCompilerArtifactAdapter } from '@0x/sol-coverage';
|
||||
let coverageSubprovider: CoverageSubprovider;
|
||||
|
||||
export const coverage = {
|
||||
getCoverageSubproviderSingleton(): CoverageSubprovider {
|
||||
if (coverageSubprovider === undefined) {
|
||||
coverageSubprovider = coverage._getCoverageSubprovider();
|
||||
}
|
||||
return coverageSubprovider;
|
||||
},
|
||||
_getCoverageSubprovider(): CoverageSubprovider {
|
||||
const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS;
|
||||
const solCompilerArtifactAdapter = new SolCompilerArtifactAdapter();
|
||||
const coverageSubproviderConfig = {
|
||||
isVerbose: true,
|
||||
ignoreFilesGlobs: ['**/node_modules/**', '**/interfaces/**', '**/test/**'],
|
||||
};
|
||||
const subprovider = new CoverageSubprovider(
|
||||
solCompilerArtifactAdapter,
|
||||
defaultFromAddress,
|
||||
coverageSubproviderConfig,
|
||||
);
|
||||
return subprovider;
|
||||
},
|
||||
};
|
@@ -1,15 +0,0 @@
|
||||
import { env, EnvVars } from '@0x/dev-utils';
|
||||
|
||||
import { coverage } from './coverage';
|
||||
import { profiler } from './profiler';
|
||||
|
||||
after('generate coverage report', async () => {
|
||||
if (env.parseBoolean(EnvVars.SolidityCoverage)) {
|
||||
const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
|
||||
await coverageSubprovider.writeCoverageAsync();
|
||||
}
|
||||
if (env.parseBoolean(EnvVars.SolidityProfiler)) {
|
||||
const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
|
||||
await profilerSubprovider.writeProfilerOutputAsync();
|
||||
}
|
||||
});
|
@@ -20,7 +20,6 @@ export { signingUtils } from './signing_utils';
|
||||
export { orderUtils } from './order_utils';
|
||||
export { typeEncodingUtils } from './type_encoding_utils';
|
||||
export { profiler } from './profiler';
|
||||
export { coverage } from './coverage';
|
||||
export { Web3ProviderEngine } from '@0x/subproviders';
|
||||
export { randomAddress } from './address_utils';
|
||||
export { OrderFactory } from './order_factory';
|
||||
|
@@ -5,7 +5,6 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { constants } from './constants';
|
||||
import { coverage } from './coverage';
|
||||
import { profiler } from './profiler';
|
||||
import { revertTrace } from './revert_trace';
|
||||
|
||||
@@ -39,11 +38,7 @@ const enabledSubproviderCount = _.filter(
|
||||
_.identity.bind(_),
|
||||
).length;
|
||||
if (enabledSubproviderCount > 1) {
|
||||
throw new Error(`Only one of coverage, profiler, or revert trace subproviders can be enabled at a time`);
|
||||
}
|
||||
if (isCoverageEnabled) {
|
||||
const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
|
||||
prependSubprovider(provider, coverageSubprovider);
|
||||
throw new Error(`Only one of profiler or revert trace subproviders can be enabled at a time`);
|
||||
}
|
||||
if (isProfilerEnabled) {
|
||||
const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1674517560,
|
||||
"version": "1.4.38",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1670879498,
|
||||
"version": "1.4.37",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1669235113,
|
||||
"version": "1.4.36",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.4.38 - _January 23, 2023_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.4.37 - _December 12, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.4.36 - _November 23, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -16,7 +16,7 @@ We strongly recommend that the community help us make improvements and determine
|
||||
|
||||
For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
|
||||
|
||||
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
|
||||
Please read our [contribution guidelines](../../.github/CONTRIBUTING.md) before getting started.
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-treasury",
|
||||
"version": "1.4.36",
|
||||
"version": "1.4.38",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -23,7 +23,7 @@
|
||||
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
|
||||
"lint": "eslint src test",
|
||||
"fix": "eslint --fix src test",
|
||||
"test:circleci": "yarn test",
|
||||
"test:ci": "yarn test",
|
||||
"contracts:gen": "contracts-gen generate",
|
||||
"contracts:copy": "contracts-gen copy",
|
||||
"docs:md": "ts-doc-gen --sourceDir='$PROJECT_FILES' --output=$MD_FILE_DIR --fileExtension=mdx --tsconfig=./typedoc-tsconfig.json",
|
||||
@@ -46,12 +46,12 @@
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contract-addresses": "^7.4.1",
|
||||
"@0x/contract-addresses": "^8.0.1",
|
||||
"@0x/contracts-asset-proxy": "^3.7.19",
|
||||
"@0x/contracts-erc20": "^3.3.53",
|
||||
"@0x/contracts-erc20": "^3.3.55",
|
||||
"@0x/contracts-gen": "^2.0.48",
|
||||
"@0x/contracts-staking": "^2.0.45",
|
||||
"@0x/contracts-test-utils": "^5.4.43",
|
||||
"@0x/contracts-test-utils": "^5.4.45",
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@types/isomorphic-fetch": "^0.0.35",
|
||||
@@ -73,7 +73,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/protocol-utils": "^11.17.2",
|
||||
"@0x/protocol-utils": "^11.17.4",
|
||||
"@0x/subproviders": "^7.0.0",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1674517560,
|
||||
"version": "4.8.36",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1670879498,
|
||||
"version": "4.8.35",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1669235113,
|
||||
"version": "4.8.34",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v4.8.36 - _January 23, 2023_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.8.35 - _December 12, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.8.34 - _November 23, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -16,7 +16,7 @@ We strongly recommend that the community help us make improvements and determine
|
||||
|
||||
For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
|
||||
|
||||
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
|
||||
Please read our [contribution guidelines](../../.github/CONTRIBUTING.md) before getting started.
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
|
125
contracts/utils/contracts/src/v08/AuthorizableV08.sol
Normal file
125
contracts/utils/contracts/src/v08/AuthorizableV08.sol
Normal file
@@ -0,0 +1,125 @@
|
||||
// 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.8;
|
||||
|
||||
import "./interfaces/IAuthorizableV08.sol";
|
||||
import "./errors/LibRichErrorsV08.sol";
|
||||
import "./errors/LibAuthorizableRichErrorsV08.sol";
|
||||
import "./OwnableV08.sol";
|
||||
|
||||
contract AuthorizableV08 is OwnableV08, IAuthorizableV08 {
|
||||
/// @dev Only authorized addresses can invoke functions with this modifier.
|
||||
modifier onlyAuthorized() {
|
||||
_assertSenderIsAuthorized();
|
||||
_;
|
||||
}
|
||||
|
||||
// @dev Whether an address is authorized to call privileged functions.
|
||||
// @param 0 Address to query.
|
||||
// @return 0 Whether the address is authorized.
|
||||
mapping(address => bool) public override authorized;
|
||||
// @dev Whether an address is authorized to call privileged functions.
|
||||
// @param 0 Index of authorized address.
|
||||
// @return 0 Authorized address.
|
||||
address[] public override authorities;
|
||||
|
||||
/// @dev Initializes the `owner` address.
|
||||
constructor() OwnableV08() {}
|
||||
|
||||
/// @dev Authorizes an address.
|
||||
/// @param target Address to authorize.
|
||||
function addAuthorizedAddress(address target) external override onlyOwner {
|
||||
_addAuthorizedAddress(target);
|
||||
}
|
||||
|
||||
/// @dev Removes authorizion of an address.
|
||||
/// @param target Address to remove authorization from.
|
||||
function removeAuthorizedAddress(address target) external override onlyOwner {
|
||||
if (!authorized[target]) {
|
||||
LibRichErrorsV08.rrevert(LibAuthorizableRichErrorsV08.TargetNotAuthorizedError(target));
|
||||
}
|
||||
for (uint256 i = 0; i < authorities.length; i++) {
|
||||
if (authorities[i] == target) {
|
||||
_removeAuthorizedAddressAtIndex(target, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Removes authorizion of an address.
|
||||
/// @param target Address to remove authorization from.
|
||||
/// @param index Index of target in authorities array.
|
||||
function removeAuthorizedAddressAtIndex(address target, uint256 index) external override onlyOwner {
|
||||
_removeAuthorizedAddressAtIndex(target, index);
|
||||
}
|
||||
|
||||
/// @dev Gets all authorized addresses.
|
||||
/// @return Array of authorized addresses.
|
||||
function getAuthorizedAddresses() external view override returns (address[] memory) {
|
||||
return authorities;
|
||||
}
|
||||
|
||||
/// @dev Reverts if msg.sender is not authorized.
|
||||
function _assertSenderIsAuthorized() internal view {
|
||||
if (!authorized[msg.sender]) {
|
||||
LibRichErrorsV08.rrevert(LibAuthorizableRichErrorsV08.SenderNotAuthorizedError(msg.sender));
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Authorizes an address.
|
||||
/// @param target Address to authorize.
|
||||
function _addAuthorizedAddress(address target) internal {
|
||||
// Ensure that the target is not the zero address.
|
||||
if (target == address(0)) {
|
||||
LibRichErrorsV08.rrevert(LibAuthorizableRichErrorsV08.ZeroCantBeAuthorizedError());
|
||||
}
|
||||
|
||||
// Ensure that the target is not already authorized.
|
||||
if (authorized[target]) {
|
||||
LibRichErrorsV08.rrevert(LibAuthorizableRichErrorsV08.TargetAlreadyAuthorizedError(target));
|
||||
}
|
||||
|
||||
authorized[target] = true;
|
||||
authorities.push(target);
|
||||
emit AuthorizedAddressAdded(target, msg.sender);
|
||||
}
|
||||
|
||||
/// @dev Removes authorizion of an address.
|
||||
/// @param target Address to remove authorization from.
|
||||
/// @param index Index of target in authorities array.
|
||||
function _removeAuthorizedAddressAtIndex(address target, uint256 index) internal {
|
||||
if (!authorized[target]) {
|
||||
LibRichErrorsV08.rrevert(LibAuthorizableRichErrorsV08.TargetNotAuthorizedError(target));
|
||||
}
|
||||
if (index >= authorities.length) {
|
||||
LibRichErrorsV08.rrevert(LibAuthorizableRichErrorsV08.IndexOutOfBoundsError(index, authorities.length));
|
||||
}
|
||||
if (authorities[index] != target) {
|
||||
LibRichErrorsV08.rrevert(
|
||||
LibAuthorizableRichErrorsV08.AuthorizedAddressMismatchError(authorities[index], target)
|
||||
);
|
||||
}
|
||||
|
||||
delete authorized[target];
|
||||
authorities[index] = authorities[authorities.length - 1];
|
||||
authorities.pop();
|
||||
emit AuthorizedAddressRemoved(target, msg.sender);
|
||||
}
|
||||
}
|
434
contracts/utils/contracts/src/v08/LibBytesV08.sol
Normal file
434
contracts/utils/contracts/src/v08/LibBytesV08.sol
Normal file
@@ -0,0 +1,434 @@
|
||||
// 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.8;
|
||||
|
||||
import "./errors/LibBytesRichErrorsV08.sol";
|
||||
import "./errors/LibRichErrorsV08.sol";
|
||||
|
||||
library LibBytesV08 {
|
||||
using LibBytesV08 for bytes;
|
||||
|
||||
/// @dev Gets the memory address for a byte array.
|
||||
/// @param input Byte array to lookup.
|
||||
/// @return memoryAddress Memory address of byte array. This
|
||||
/// points to the header of the byte array which contains
|
||||
/// the length.
|
||||
function rawAddress(bytes memory input) internal pure returns (uint256 memoryAddress) {
|
||||
assembly ("memory-safe") {
|
||||
memoryAddress := input
|
||||
}
|
||||
return memoryAddress;
|
||||
}
|
||||
|
||||
/// @dev Gets the memory address for the contents of a byte array.
|
||||
/// @param input Byte array to lookup.
|
||||
/// @return memoryAddress Memory address of the contents of the byte array.
|
||||
function contentAddress(bytes memory input) internal pure returns (uint256 memoryAddress) {
|
||||
assembly ("memory-safe") {
|
||||
memoryAddress := add(input, 32)
|
||||
}
|
||||
return memoryAddress;
|
||||
}
|
||||
|
||||
/// @dev Copies `length` bytes from memory location `source` to `dest`.
|
||||
/// @param dest memory address to copy bytes to.
|
||||
/// @param source memory address to copy bytes from.
|
||||
/// @param length number of bytes to copy.
|
||||
function memCopy(uint256 dest, uint256 source, uint256 length) internal pure {
|
||||
if (length < 32) {
|
||||
// Handle a partial word by reading destination and masking
|
||||
// off the bits we are interested in.
|
||||
// This correctly handles overlap, zero lengths and source == dest
|
||||
assembly {
|
||||
let mask := sub(exp(256, sub(32, length)), 1)
|
||||
let s := and(mload(source), not(mask))
|
||||
let d := and(mload(dest), mask)
|
||||
mstore(dest, or(s, d))
|
||||
}
|
||||
} else {
|
||||
// Skip the O(length) loop when source == dest.
|
||||
if (source == dest) {
|
||||
return;
|
||||
}
|
||||
|
||||
// For large copies we copy whole words at a time. The final
|
||||
// word is aligned to the end of the range (instead of after the
|
||||
// previous) to handle partial words. So a copy will look like this:
|
||||
//
|
||||
// ####
|
||||
// ####
|
||||
// ####
|
||||
// ####
|
||||
//
|
||||
// We handle overlap in the source and destination range by
|
||||
// changing the copying direction. This prevents us from
|
||||
// overwriting parts of source that we still need to copy.
|
||||
//
|
||||
// This correctly handles source == dest
|
||||
//
|
||||
if (source > dest) {
|
||||
assembly {
|
||||
// We subtract 32 from `sEnd` and `dEnd` because it
|
||||
// is easier to compare with in the loop, and these
|
||||
// are also the addresses we need for copying the
|
||||
// last bytes.
|
||||
length := sub(length, 32)
|
||||
let sEnd := add(source, length)
|
||||
let dEnd := add(dest, length)
|
||||
|
||||
// Remember the last 32 bytes of source
|
||||
// This needs to be done here and not after the loop
|
||||
// because we may have overwritten the last bytes in
|
||||
// source already due to overlap.
|
||||
let last := mload(sEnd)
|
||||
|
||||
// Copy whole words front to back
|
||||
// Note: the first check is always true,
|
||||
// this could have been a do-while loop.
|
||||
for {
|
||||
|
||||
} lt(source, sEnd) {
|
||||
|
||||
} {
|
||||
mstore(dest, mload(source))
|
||||
source := add(source, 32)
|
||||
dest := add(dest, 32)
|
||||
}
|
||||
|
||||
// Write the last 32 bytes
|
||||
mstore(dEnd, last)
|
||||
}
|
||||
} else {
|
||||
assembly {
|
||||
// We subtract 32 from `sEnd` and `dEnd` because those
|
||||
// are the starting points when copying a word at the end.
|
||||
length := sub(length, 32)
|
||||
let sEnd := add(source, length)
|
||||
let dEnd := add(dest, length)
|
||||
|
||||
// Remember the first 32 bytes of source
|
||||
// This needs to be done here and not after the loop
|
||||
// because we may have overwritten the first bytes in
|
||||
// source already due to overlap.
|
||||
let first := mload(source)
|
||||
|
||||
// Copy whole words back to front
|
||||
// We use a signed comparisson here to allow dEnd to become
|
||||
// negative (happens when source and dest < 32). Valid
|
||||
// addresses in local memory will never be larger than
|
||||
// 2**255, so they can be safely re-interpreted as signed.
|
||||
// Note: the first check is always true,
|
||||
// this could have been a do-while loop.
|
||||
for {
|
||||
|
||||
} slt(dest, dEnd) {
|
||||
|
||||
} {
|
||||
mstore(dEnd, mload(sEnd))
|
||||
sEnd := sub(sEnd, 32)
|
||||
dEnd := sub(dEnd, 32)
|
||||
}
|
||||
|
||||
// Write the first 32 bytes
|
||||
mstore(dest, first)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Returns a slices from a byte array.
|
||||
/// @param b The byte array to take a slice from.
|
||||
/// @param from The starting index for the slice (inclusive).
|
||||
/// @param to The final index for the slice (exclusive).
|
||||
/// @return result The slice containing bytes at indices [from, to)
|
||||
function slice(bytes memory b, uint256 from, uint256 to) internal pure returns (bytes memory result) {
|
||||
// Ensure that the from and to positions are valid positions for a slice within
|
||||
// the byte array that is being used.
|
||||
if (from > to) {
|
||||
LibRichErrorsV08.rrevert(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationError(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationErrorCodes.FromLessThanOrEqualsToRequired,
|
||||
from,
|
||||
to
|
||||
)
|
||||
);
|
||||
}
|
||||
if (to > b.length) {
|
||||
LibRichErrorsV08.rrevert(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationError(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationErrorCodes.ToLessThanOrEqualsLengthRequired,
|
||||
to,
|
||||
b.length
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Create a new bytes structure and copy contents
|
||||
result = new bytes(to - from);
|
||||
memCopy(result.contentAddress(), b.contentAddress() + from, result.length);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// @dev Returns a slice from a byte array without preserving the input.
|
||||
/// When `from == 0`, the original array will match the slice.
|
||||
/// In other cases its state will be corrupted.
|
||||
/// @param b The byte array to take a slice from. Will be destroyed in the process.
|
||||
/// @param from The starting index for the slice (inclusive).
|
||||
/// @param to The final index for the slice (exclusive).
|
||||
/// @return result The slice containing bytes at indices [from, to)
|
||||
function sliceDestructive(bytes memory b, uint256 from, uint256 to) internal pure returns (bytes memory result) {
|
||||
// Ensure that the from and to positions are valid positions for a slice within
|
||||
// the byte array that is being used.
|
||||
if (from > to) {
|
||||
LibRichErrorsV08.rrevert(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationError(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationErrorCodes.FromLessThanOrEqualsToRequired,
|
||||
from,
|
||||
to
|
||||
)
|
||||
);
|
||||
}
|
||||
if (to > b.length) {
|
||||
LibRichErrorsV08.rrevert(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationError(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationErrorCodes.ToLessThanOrEqualsLengthRequired,
|
||||
to,
|
||||
b.length
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Create a new bytes structure around [from, to) in-place.
|
||||
assembly {
|
||||
result := add(b, from)
|
||||
mstore(result, sub(to, from))
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// @dev Pops the last byte off of a byte array by modifying its length.
|
||||
/// @param b Byte array that will be modified.
|
||||
/// @return result The byte that was popped off.
|
||||
function popLastByte(bytes memory b) internal pure returns (bytes1 result) {
|
||||
if (b.length == 0) {
|
||||
LibRichErrorsV08.rrevert(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationError(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationErrorCodes.LengthGreaterThanZeroRequired,
|
||||
b.length,
|
||||
0
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Store last byte.
|
||||
result = b[b.length - 1];
|
||||
|
||||
assembly ("memory-safe") {
|
||||
// Decrement length of byte array.
|
||||
let newLen := sub(mload(b), 1)
|
||||
mstore(b, newLen)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// @dev Tests equality of two byte arrays.
|
||||
/// @param lhs First byte array to compare.
|
||||
/// @param rhs Second byte array to compare.
|
||||
/// @return equal True if arrays are the same. False otherwise.
|
||||
function equals(bytes memory lhs, bytes memory rhs) internal pure returns (bool equal) {
|
||||
// Keccak gas cost is 30 + numWords * 6. This is a cheap way to compare.
|
||||
return keccak256(lhs) == keccak256(rhs);
|
||||
}
|
||||
|
||||
/// @dev Reads an address from a position in a byte array.
|
||||
/// @param b Byte array containing an address.
|
||||
/// @param index Index in byte array of address.
|
||||
/// @return result address from byte array.
|
||||
function readAddress(bytes memory b, uint256 index) internal pure returns (address result) {
|
||||
if (b.length < index + 20) {
|
||||
LibRichErrorsV08.rrevert(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationError(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsTwentyRequired,
|
||||
b.length,
|
||||
index + 20 // 20 is length of address
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Add offset to index:
|
||||
// 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)
|
||||
// 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)
|
||||
index += 20;
|
||||
|
||||
// Read address from array memory
|
||||
assembly ("memory-safe") {
|
||||
// 1. Add index to address of bytes array
|
||||
// 2. Load 32-byte word from memory
|
||||
result := mload(add(b, index))
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// @dev Writes an address into a specific position in a byte array.
|
||||
/// @param b Byte array to insert address into.
|
||||
/// @param index Index in byte array of address.
|
||||
/// @param input Address to put into byte array.
|
||||
function writeAddress(bytes memory b, uint256 index, address input) internal pure {
|
||||
if (b.length < index + 20) {
|
||||
LibRichErrorsV08.rrevert(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationError(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsTwentyRequired,
|
||||
b.length,
|
||||
index + 20 // 20 is length of address
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Add offset to index:
|
||||
// 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)
|
||||
// 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)
|
||||
index += 20;
|
||||
|
||||
// Store address into array memory
|
||||
assembly ("memory-safe") {
|
||||
// The address occupies 20 bytes and mstore stores 32 bytes.
|
||||
// First fetch the 32-byte word where we'll be storing the address, then
|
||||
// apply a mask so we have only the bytes in the word that the address will not occupy.
|
||||
// Then combine these bytes with the address and store the 32 bytes back to memory with mstore.
|
||||
|
||||
// 1. Add index to address of bytes array
|
||||
// 2. Load 32-byte word from memory
|
||||
// 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address
|
||||
let neighbors := and(
|
||||
mload(add(b, index)),
|
||||
0xffffffffffffffffffffffff0000000000000000000000000000000000000000
|
||||
)
|
||||
|
||||
// Make sure input address is clean.
|
||||
// (Solidity does not guarantee this)
|
||||
input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)
|
||||
|
||||
// Store the neighbors and address into memory
|
||||
mstore(add(b, index), xor(input, neighbors))
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Reads a bytes32 value from a position in a byte array.
|
||||
/// @param b Byte array containing a bytes32 value.
|
||||
/// @param index Index in byte array of bytes32 value.
|
||||
/// @return result bytes32 value from byte array.
|
||||
function readBytes32(bytes memory b, uint256 index) internal pure returns (bytes32 result) {
|
||||
if (b.length < index + 32) {
|
||||
LibRichErrorsV08.rrevert(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationError(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsThirtyTwoRequired,
|
||||
b.length,
|
||||
index + 32
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Arrays are prefixed by a 256 bit length parameter
|
||||
index += 32;
|
||||
|
||||
// Read the bytes32 from array memory
|
||||
assembly ("memory-safe") {
|
||||
result := mload(add(b, index))
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// @dev Writes a bytes32 into a specific position in a byte array.
|
||||
/// @param b Byte array to insert <input> into.
|
||||
/// @param index Index in byte array of <input>.
|
||||
/// @param input bytes32 to put into byte array.
|
||||
function writeBytes32(bytes memory b, uint256 index, bytes32 input) internal pure {
|
||||
if (b.length < index + 32) {
|
||||
LibRichErrorsV08.rrevert(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationError(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsThirtyTwoRequired,
|
||||
b.length,
|
||||
index + 32
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Arrays are prefixed by a 256 bit length parameter
|
||||
index += 32;
|
||||
|
||||
// Read the bytes32 from array memory
|
||||
assembly ("memory-safe") {
|
||||
mstore(add(b, index), input)
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Reads a uint256 value from a position in a byte array.
|
||||
/// @param b Byte array containing a uint256 value.
|
||||
/// @param index Index in byte array of uint256 value.
|
||||
/// @return result uint256 value from byte array.
|
||||
function readUint256(bytes memory b, uint256 index) internal pure returns (uint256 result) {
|
||||
result = uint256(readBytes32(b, index));
|
||||
return result;
|
||||
}
|
||||
|
||||
/// @dev Writes a uint256 into a specific position in a byte array.
|
||||
/// @param b Byte array to insert <input> into.
|
||||
/// @param index Index in byte array of <input>.
|
||||
/// @param input uint256 to put into byte array.
|
||||
function writeUint256(bytes memory b, uint256 index, uint256 input) internal pure {
|
||||
writeBytes32(b, index, bytes32(input));
|
||||
}
|
||||
|
||||
/// @dev Reads an unpadded bytes4 value from a position in a byte array.
|
||||
/// @param b Byte array containing a bytes4 value.
|
||||
/// @param index Index in byte array of bytes4 value.
|
||||
/// @return result bytes4 value from byte array.
|
||||
function readBytes4(bytes memory b, uint256 index) internal pure returns (bytes4 result) {
|
||||
if (b.length < index + 4) {
|
||||
LibRichErrorsV08.rrevert(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationError(
|
||||
LibBytesRichErrorsV08.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsFourRequired,
|
||||
b.length,
|
||||
index + 4
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Arrays are prefixed by a 32 byte length field
|
||||
index += 32;
|
||||
|
||||
// Read the bytes4 from array memory
|
||||
assembly ("memory-safe") {
|
||||
result := mload(add(b, index))
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// @dev Writes a new length to a byte array.
|
||||
/// Decreasing length will lead to removing the corresponding lower order bytes from the byte array.
|
||||
/// Increasing length may lead to appending adjacent in-memory bytes to the end of the byte array.
|
||||
/// @param b Bytes array to write new length to.
|
||||
/// @param length New length of byte array.
|
||||
function writeLength(bytes memory b, uint256 length) internal pure {
|
||||
assembly {
|
||||
mstore(b, length)
|
||||
}
|
||||
}
|
||||
}
|
201
contracts/utils/contracts/src/v08/LibMathV08.sol
Normal file
201
contracts/utils/contracts/src/v08/LibMathV08.sol
Normal file
@@ -0,0 +1,201 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
/*
|
||||
|
||||
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.8;
|
||||
|
||||
import "./errors/LibRichErrorsV08.sol";
|
||||
import "./errors/LibMathRichErrorsV08.sol";
|
||||
import "./errors/LibSafeMathRichErrorsV08.sol";
|
||||
|
||||
library LibMathV08 {
|
||||
function max256(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||
return a >= b ? a : b;
|
||||
}
|
||||
|
||||
function min256(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||
return a < b ? a : b;
|
||||
}
|
||||
|
||||
function max128(uint128 a, uint128 b) internal pure returns (uint128) {
|
||||
return a >= b ? a : b;
|
||||
}
|
||||
|
||||
function min128(uint128 a, uint128 b) internal pure returns (uint128) {
|
||||
return a < b ? a : b;
|
||||
}
|
||||
|
||||
function safeDowncastToUint128(uint256 a) internal pure returns (uint128) {
|
||||
if (a > type(uint128).max) {
|
||||
LibRichErrorsV08.rrevert(
|
||||
LibSafeMathRichErrorsV08.Uint256DowncastError(
|
||||
LibSafeMathRichErrorsV08.DowncastErrorCodes.VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT128,
|
||||
a
|
||||
)
|
||||
);
|
||||
}
|
||||
return uint128(a);
|
||||
}
|
||||
|
||||
/// @dev Calculates partial value given a numerator and denominator rounded down.
|
||||
/// Reverts if rounding error is >= 0.1%
|
||||
/// @param numerator Numerator.
|
||||
/// @param denominator Denominator.
|
||||
/// @param target Value to calculate partial of.
|
||||
/// @return partialAmount Partial value of target rounded down.
|
||||
function safeGetPartialAmountFloor(
|
||||
uint256 numerator,
|
||||
uint256 denominator,
|
||||
uint256 target
|
||||
) internal pure returns (uint256 partialAmount) {
|
||||
if (isRoundingErrorFloor(numerator, denominator, target)) {
|
||||
LibRichErrorsV08.rrevert(LibMathRichErrorsV08.RoundingError(numerator, denominator, target));
|
||||
}
|
||||
|
||||
partialAmount = (numerator * target) / denominator;
|
||||
return partialAmount;
|
||||
}
|
||||
|
||||
/// @dev Calculates partial value given a numerator and denominator rounded down.
|
||||
/// Reverts if rounding error is >= 0.1%
|
||||
/// @param numerator Numerator.
|
||||
/// @param denominator Denominator.
|
||||
/// @param target Value to calculate partial of.
|
||||
/// @return partialAmount Partial value of target rounded up.
|
||||
function safeGetPartialAmountCeil(
|
||||
uint256 numerator,
|
||||
uint256 denominator,
|
||||
uint256 target
|
||||
) internal pure returns (uint256 partialAmount) {
|
||||
if (isRoundingErrorCeil(numerator, denominator, target)) {
|
||||
LibRichErrorsV08.rrevert(LibMathRichErrorsV08.RoundingError(numerator, denominator, target));
|
||||
}
|
||||
|
||||
// safeDiv computes `floor(a / b)`. We use the identity (a, b integer):
|
||||
// ceil(a / b) = floor((a + b - 1) / b)
|
||||
// To implement `ceil(a / b)` using safeDiv.
|
||||
partialAmount = (numerator * target + (denominator - 1)) / denominator;
|
||||
|
||||
return partialAmount;
|
||||
}
|
||||
|
||||
/// @dev Calculates partial value given a numerator and denominator rounded down.
|
||||
/// @param numerator Numerator.
|
||||
/// @param denominator Denominator.
|
||||
/// @param target Value to calculate partial of.
|
||||
/// @return partialAmount Partial value of target rounded down.
|
||||
function getPartialAmountFloor(
|
||||
uint256 numerator,
|
||||
uint256 denominator,
|
||||
uint256 target
|
||||
) internal pure returns (uint256 partialAmount) {
|
||||
partialAmount = (numerator * target) / denominator;
|
||||
return partialAmount;
|
||||
}
|
||||
|
||||
/// @dev Calculates partial value given a numerator and denominator rounded down.
|
||||
/// @param numerator Numerator.
|
||||
/// @param denominator Denominator.
|
||||
/// @param target Value to calculate partial of.
|
||||
/// @return partialAmount Partial value of target rounded up.
|
||||
function getPartialAmountCeil(
|
||||
uint256 numerator,
|
||||
uint256 denominator,
|
||||
uint256 target
|
||||
) internal pure returns (uint256 partialAmount) {
|
||||
// safeDiv computes `floor(a / b)`. We use the identity (a, b integer):
|
||||
// ceil(a / b) = floor((a + b - 1) / b)
|
||||
// To implement `ceil(a / b)` using safeDiv.
|
||||
partialAmount = (numerator * target + (denominator - 1)) / denominator;
|
||||
|
||||
return partialAmount;
|
||||
}
|
||||
|
||||
/// @dev Checks if rounding error >= 0.1% when rounding down.
|
||||
/// @param numerator Numerator.
|
||||
/// @param denominator Denominator.
|
||||
/// @param target Value to multiply with numerator/denominator.
|
||||
/// @return isError Rounding error is present.
|
||||
function isRoundingErrorFloor(
|
||||
uint256 numerator,
|
||||
uint256 denominator,
|
||||
uint256 target
|
||||
) internal pure returns (bool isError) {
|
||||
if (denominator == 0) {
|
||||
LibRichErrorsV08.rrevert(LibMathRichErrorsV08.DivisionByZeroError());
|
||||
}
|
||||
|
||||
// The absolute rounding error is the difference between the rounded
|
||||
// value and the ideal value. The relative rounding error is the
|
||||
// absolute rounding error divided by the absolute value of the
|
||||
// ideal value. This is undefined when the ideal value is zero.
|
||||
//
|
||||
// The ideal value is `numerator * target / denominator`.
|
||||
// Let's call `numerator * target % denominator` the remainder.
|
||||
// The absolute error is `remainder / denominator`.
|
||||
//
|
||||
// When the ideal value is zero, we require the absolute error to
|
||||
// be zero. Fortunately, this is always the case. The ideal value is
|
||||
// zero iff `numerator == 0` and/or `target == 0`. In this case the
|
||||
// remainder and absolute error are also zero.
|
||||
if (target == 0 || numerator == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Otherwise, we want the relative rounding error to be strictly
|
||||
// less than 0.1%.
|
||||
// The relative error is `remainder / (numerator * target)`.
|
||||
// We want the relative error less than 1 / 1000:
|
||||
// remainder / (numerator * denominator) < 1 / 1000
|
||||
// or equivalently:
|
||||
// 1000 * remainder < numerator * target
|
||||
// so we have a rounding error iff:
|
||||
// 1000 * remainder >= numerator * target
|
||||
uint256 remainder = mulmod(target, numerator, denominator);
|
||||
isError = remainder * 1000 >= numerator * target;
|
||||
return isError;
|
||||
}
|
||||
|
||||
/// @dev Checks if rounding error >= 0.1% when rounding up.
|
||||
/// @param numerator Numerator.
|
||||
/// @param denominator Denominator.
|
||||
/// @param target Value to multiply with numerator/denominator.
|
||||
/// @return isError Rounding error is present.
|
||||
function isRoundingErrorCeil(
|
||||
uint256 numerator,
|
||||
uint256 denominator,
|
||||
uint256 target
|
||||
) internal pure returns (bool isError) {
|
||||
if (denominator == 0) {
|
||||
LibRichErrorsV08.rrevert(LibMathRichErrorsV08.DivisionByZeroError());
|
||||
}
|
||||
|
||||
// See the comments in `isRoundingError`.
|
||||
if (target == 0 || numerator == 0) {
|
||||
// When either is zero, the ideal value and rounded value are zero
|
||||
// and there is no rounding error. (Although the relative error
|
||||
// is undefined.)
|
||||
return false;
|
||||
}
|
||||
// Compute remainder as before
|
||||
uint256 remainder = mulmod(target, numerator, denominator);
|
||||
remainder = denominator - (remainder % denominator);
|
||||
isError = remainder * 1000 >= numerator * target;
|
||||
return isError;
|
||||
}
|
||||
}
|
56
contracts/utils/contracts/src/v08/OwnableV08.sol
Normal file
56
contracts/utils/contracts/src/v08/OwnableV08.sol
Normal file
@@ -0,0 +1,56 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
/*
|
||||
|
||||
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.8;
|
||||
|
||||
import "./interfaces/IOwnableV08.sol";
|
||||
import "./errors/LibRichErrorsV08.sol";
|
||||
import "./errors/LibOwnableRichErrorsV08.sol";
|
||||
|
||||
contract OwnableV08 is IOwnableV08 {
|
||||
/// @dev The owner of this contract.
|
||||
/// @return 0 The owner address.
|
||||
address public override owner;
|
||||
|
||||
constructor() {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
modifier onlyOwner() {
|
||||
_assertSenderIsOwner();
|
||||
_;
|
||||
}
|
||||
|
||||
/// @dev Change the owner of this contract.
|
||||
/// @param newOwner New owner address.
|
||||
function transferOwnership(address newOwner) public override onlyOwner {
|
||||
if (newOwner == address(0)) {
|
||||
LibRichErrorsV08.rrevert(LibOwnableRichErrorsV08.TransferOwnerToZeroError());
|
||||
} else {
|
||||
owner = newOwner;
|
||||
emit OwnershipTransferred(msg.sender, newOwner);
|
||||
}
|
||||
}
|
||||
|
||||
function _assertSenderIsOwner() internal view {
|
||||
if (msg.sender != owner) {
|
||||
LibRichErrorsV08.rrevert(LibOwnableRichErrorsV08.OnlyOwnerError(msg.sender, owner));
|
||||
}
|
||||
}
|
||||
}
|
50
contracts/utils/contracts/src/v08/ReentrancyGuardV08.sol
Normal file
50
contracts/utils/contracts/src/v08/ReentrancyGuardV08.sol
Normal file
@@ -0,0 +1,50 @@
|
||||
// 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.8;
|
||||
|
||||
import "./errors/LibReentrancyGuardRichErrorsV08.sol";
|
||||
import "./errors/LibRichErrorsV08.sol";
|
||||
|
||||
contract ReentrancyGuardV08 {
|
||||
// Locked state of mutex.
|
||||
bool private _locked = false;
|
||||
|
||||
/// @dev Functions with this modifer cannot be reentered. The mutex will be locked
|
||||
/// before function execution and unlocked after.
|
||||
modifier nonReentrant() {
|
||||
_lockMutexOrThrowIfAlreadyLocked();
|
||||
_;
|
||||
_unlockMutex();
|
||||
}
|
||||
|
||||
function _lockMutexOrThrowIfAlreadyLocked() internal {
|
||||
// Ensure mutex is unlocked.
|
||||
if (_locked) {
|
||||
LibRichErrorsV08.rrevert(LibReentrancyGuardRichErrorsV08.IllegalReentrancyError());
|
||||
}
|
||||
// Lock mutex.
|
||||
_locked = true;
|
||||
}
|
||||
|
||||
function _unlockMutex() internal {
|
||||
// Unlock mutex.
|
||||
_locked = false;
|
||||
}
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
// 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.8;
|
||||
|
||||
library LibAuthorizableRichErrorsV08 {
|
||||
// bytes4(keccak256("AuthorizedAddressMismatchError(address,address)"))
|
||||
bytes4 internal constant AUTHORIZED_ADDRESS_MISMATCH_ERROR_SELECTOR = 0x140a84db;
|
||||
|
||||
// bytes4(keccak256("IndexOutOfBoundsError(uint256,uint256)"))
|
||||
bytes4 internal constant INDEX_OUT_OF_BOUNDS_ERROR_SELECTOR = 0xe9f83771;
|
||||
|
||||
// bytes4(keccak256("SenderNotAuthorizedError(address)"))
|
||||
bytes4 internal constant SENDER_NOT_AUTHORIZED_ERROR_SELECTOR = 0xb65a25b9;
|
||||
|
||||
// bytes4(keccak256("TargetAlreadyAuthorizedError(address)"))
|
||||
bytes4 internal constant TARGET_ALREADY_AUTHORIZED_ERROR_SELECTOR = 0xde16f1a0;
|
||||
|
||||
// bytes4(keccak256("TargetNotAuthorizedError(address)"))
|
||||
bytes4 internal constant TARGET_NOT_AUTHORIZED_ERROR_SELECTOR = 0xeb5108a2;
|
||||
|
||||
// bytes4(keccak256("ZeroCantBeAuthorizedError()"))
|
||||
bytes internal constant ZERO_CANT_BE_AUTHORIZED_ERROR_BYTES = hex"57654fe4";
|
||||
|
||||
function AuthorizedAddressMismatchError(address authorized, address target) internal pure returns (bytes memory) {
|
||||
return abi.encodeWithSelector(AUTHORIZED_ADDRESS_MISMATCH_ERROR_SELECTOR, authorized, target);
|
||||
}
|
||||
|
||||
function IndexOutOfBoundsError(uint256 index, uint256 length) internal pure returns (bytes memory) {
|
||||
return abi.encodeWithSelector(INDEX_OUT_OF_BOUNDS_ERROR_SELECTOR, index, length);
|
||||
}
|
||||
|
||||
function SenderNotAuthorizedError(address sender) internal pure returns (bytes memory) {
|
||||
return abi.encodeWithSelector(SENDER_NOT_AUTHORIZED_ERROR_SELECTOR, sender);
|
||||
}
|
||||
|
||||
function TargetAlreadyAuthorizedError(address target) internal pure returns (bytes memory) {
|
||||
return abi.encodeWithSelector(TARGET_ALREADY_AUTHORIZED_ERROR_SELECTOR, target);
|
||||
}
|
||||
|
||||
function TargetNotAuthorizedError(address target) internal pure returns (bytes memory) {
|
||||
return abi.encodeWithSelector(TARGET_NOT_AUTHORIZED_ERROR_SELECTOR, target);
|
||||
}
|
||||
|
||||
function ZeroCantBeAuthorizedError() internal pure returns (bytes memory) {
|
||||
return ZERO_CANT_BE_AUTHORIZED_ERROR_BYTES;
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
// 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.8;
|
||||
|
||||
library LibBytesRichErrorsV08 {
|
||||
enum InvalidByteOperationErrorCodes {
|
||||
FromLessThanOrEqualsToRequired,
|
||||
ToLessThanOrEqualsLengthRequired,
|
||||
LengthGreaterThanZeroRequired,
|
||||
LengthGreaterThanOrEqualsFourRequired,
|
||||
LengthGreaterThanOrEqualsTwentyRequired,
|
||||
LengthGreaterThanOrEqualsThirtyTwoRequired,
|
||||
LengthGreaterThanOrEqualsNestedBytesLengthRequired,
|
||||
DestinationLengthGreaterThanOrEqualSourceLengthRequired
|
||||
}
|
||||
|
||||
// bytes4(keccak256("InvalidByteOperationError(uint8,uint256,uint256)"))
|
||||
bytes4 internal constant INVALID_BYTE_OPERATION_ERROR_SELECTOR = 0x28006595;
|
||||
|
||||
function InvalidByteOperationError(
|
||||
InvalidByteOperationErrorCodes errorCode,
|
||||
uint256 offset,
|
||||
uint256 required
|
||||
) internal pure returns (bytes memory) {
|
||||
return abi.encodeWithSelector(INVALID_BYTE_OPERATION_ERROR_SELECTOR, errorCode, offset, required);
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
// 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.8;
|
||||
|
||||
library LibMathRichErrorsV08 {
|
||||
// bytes4(keccak256("DivisionByZeroError()"))
|
||||
bytes internal constant DIVISION_BY_ZERO_ERROR = hex"a791837c";
|
||||
|
||||
// bytes4(keccak256("RoundingError(uint256,uint256,uint256)"))
|
||||
bytes4 internal constant ROUNDING_ERROR_SELECTOR = 0x339f3de2;
|
||||
|
||||
function DivisionByZeroError() internal pure returns (bytes memory) {
|
||||
return DIVISION_BY_ZERO_ERROR;
|
||||
}
|
||||
|
||||
function RoundingError(
|
||||
uint256 numerator,
|
||||
uint256 denominator,
|
||||
uint256 target
|
||||
) internal pure returns (bytes memory) {
|
||||
return abi.encodeWithSelector(ROUNDING_ERROR_SELECTOR, numerator, denominator, target);
|
||||
}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
// 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.8;
|
||||
|
||||
library LibOwnableRichErrorsV08 {
|
||||
// bytes4(keccak256("OnlyOwnerError(address,address)"))
|
||||
bytes4 internal constant ONLY_OWNER_ERROR_SELECTOR = 0x1de45ad1;
|
||||
|
||||
// bytes4(keccak256("TransferOwnerToZeroError()"))
|
||||
bytes internal constant TRANSFER_OWNER_TO_ZERO_ERROR_BYTES = hex"e69edc3e";
|
||||
|
||||
function OnlyOwnerError(address sender, address owner) internal pure returns (bytes memory) {
|
||||
return abi.encodeWithSelector(ONLY_OWNER_ERROR_SELECTOR, sender, owner);
|
||||
}
|
||||
|
||||
function TransferOwnerToZeroError() internal pure returns (bytes memory) {
|
||||
return TRANSFER_OWNER_TO_ZERO_ERROR_BYTES;
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
// 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.8;
|
||||
|
||||
library LibReentrancyGuardRichErrorsV08 {
|
||||
// bytes4(keccak256("IllegalReentrancyError()"))
|
||||
bytes internal constant ILLEGAL_REENTRANCY_ERROR_SELECTOR_BYTES = hex"0c3b823f";
|
||||
|
||||
function IllegalReentrancyError() internal pure returns (bytes memory) {
|
||||
return ILLEGAL_REENTRANCY_ERROR_SELECTOR_BYTES;
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
// 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.8;
|
||||
|
||||
library LibRichErrorsV08 {
|
||||
// bytes4(keccak256("Error(string)"))
|
||||
bytes4 internal constant STANDARD_ERROR_SELECTOR = 0x08c379a0;
|
||||
|
||||
/// @dev ABI encode a standard, string revert error payload.
|
||||
/// This is the same payload that would be included by a `revert(string)`
|
||||
/// solidity statement. It has the function signature `Error(string)`.
|
||||
/// @param message The error string.
|
||||
/// @return The ABI encoded error.
|
||||
function StandardError(string memory message) internal pure returns (bytes memory) {
|
||||
return abi.encodeWithSelector(STANDARD_ERROR_SELECTOR, bytes(message));
|
||||
}
|
||||
|
||||
/// @dev Reverts an encoded rich revert reason `errorData`.
|
||||
/// @param errorData ABI encoded error data.
|
||||
function rrevert(bytes memory errorData) internal pure {
|
||||
assembly ("memory-safe") {
|
||||
revert(add(errorData, 0x20), mload(errorData))
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
// 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.8;
|
||||
|
||||
library LibSafeMathRichErrorsV08 {
|
||||
// bytes4(keccak256("Uint256BinOpError(uint8,uint256,uint256)"))
|
||||
bytes4 internal constant UINT256_BINOP_ERROR_SELECTOR = 0xe946c1bb;
|
||||
|
||||
// bytes4(keccak256("Uint256DowncastError(uint8,uint256)"))
|
||||
bytes4 internal constant UINT256_DOWNCAST_ERROR_SELECTOR = 0xc996af7b;
|
||||
|
||||
enum BinOpErrorCodes {
|
||||
ADDITION_OVERFLOW,
|
||||
MULTIPLICATION_OVERFLOW,
|
||||
SUBTRACTION_UNDERFLOW,
|
||||
DIVISION_BY_ZERO
|
||||
}
|
||||
|
||||
enum DowncastErrorCodes {
|
||||
VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT32,
|
||||
VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT64,
|
||||
VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT96,
|
||||
VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT128
|
||||
}
|
||||
|
||||
function Uint256BinOpError(BinOpErrorCodes errorCode, uint256 a, uint256 b) internal pure returns (bytes memory) {
|
||||
return abi.encodeWithSelector(UINT256_BINOP_ERROR_SELECTOR, errorCode, a, b);
|
||||
}
|
||||
|
||||
function Uint256DowncastError(DowncastErrorCodes errorCode, uint256 a) internal pure returns (bytes memory) {
|
||||
return abi.encodeWithSelector(UINT256_DOWNCAST_ERROR_SELECTOR, errorCode, a);
|
||||
}
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
// 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.8;
|
||||
|
||||
import "./IOwnableV08.sol";
|
||||
|
||||
interface IAuthorizableV08 is IOwnableV08 {
|
||||
// Event logged when a new address is authorized.
|
||||
event AuthorizedAddressAdded(address indexed target, address indexed caller);
|
||||
|
||||
// Event logged when a currently authorized address is unauthorized.
|
||||
event AuthorizedAddressRemoved(address indexed target, address indexed caller);
|
||||
|
||||
/// @dev Authorizes an address.
|
||||
/// @param target Address to authorize.
|
||||
function addAuthorizedAddress(address target) external;
|
||||
|
||||
/// @dev Removes authorizion of an address.
|
||||
/// @param target Address to remove authorization from.
|
||||
function removeAuthorizedAddress(address target) external;
|
||||
|
||||
/// @dev Removes authorizion of an address.
|
||||
/// @param target Address to remove authorization from.
|
||||
/// @param index Index of target in authorities array.
|
||||
function removeAuthorizedAddressAtIndex(address target, uint256 index) external;
|
||||
|
||||
/// @dev Gets all authorized addresses.
|
||||
/// @return authorizedAddresses Array of authorized addresses.
|
||||
function getAuthorizedAddresses() external view returns (address[] memory authorizedAddresses);
|
||||
|
||||
/// @dev Whether an adderss is authorized to call privileged functions.
|
||||
/// @param addr Address to query.
|
||||
/// @return isAuthorized Whether the address is authorized.
|
||||
function authorized(address addr) external view returns (bool isAuthorized);
|
||||
|
||||
/// @dev All addresseses authorized to call privileged functions.
|
||||
/// @param idx Index of authorized address.
|
||||
/// @return addr Authorized address.
|
||||
function authorities(uint256 idx) external view returns (address addr);
|
||||
}
|
35
contracts/utils/contracts/src/v08/interfaces/IOwnableV08.sol
Normal file
35
contracts/utils/contracts/src/v08/interfaces/IOwnableV08.sol
Normal file
@@ -0,0 +1,35 @@
|
||||
// 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.8;
|
||||
|
||||
interface IOwnableV08 {
|
||||
/// @dev Emitted by Ownable when ownership is transferred.
|
||||
/// @param previousOwner The previous owner of the contract.
|
||||
/// @param newOwner The new owner of the contract.
|
||||
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
|
||||
|
||||
/// @dev Transfers ownership of the contract to a new address.
|
||||
/// @param newOwner The address that will become the owner.
|
||||
function transferOwnership(address newOwner) external;
|
||||
|
||||
/// @dev The owner of this contract.
|
||||
/// @return ownerAddress The owner address.
|
||||
function owner() external view returns (address ownerAddress);
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-utils",
|
||||
"version": "4.8.34",
|
||||
"version": "4.8.36",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -15,7 +15,6 @@
|
||||
"pre_build": "run-s compile contracts:gen generate_contract_wrappers contracts:copy",
|
||||
"test": "yarn run_mocha",
|
||||
"rebuild_and_test": "run-s build test",
|
||||
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
|
||||
"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",
|
||||
@@ -25,19 +24,15 @@
|
||||
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
|
||||
"lint": "eslint src test",
|
||||
"fix": "eslint --fix src test",
|
||||
"coverage:report:text": "istanbul report text",
|
||||
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||
"profiler:report:html": "istanbul report html && open coverage/index.html",
|
||||
"coverage:report:lcov": "istanbul report lcov",
|
||||
"test:circleci": "yarn test",
|
||||
"test:ci": "yarn test",
|
||||
"contracts:gen": "contracts-gen generate",
|
||||
"contracts:copy": "contracts-gen copy",
|
||||
"compile:truffle": "truffle compile"
|
||||
"contracts:copy": "contracts-gen copy"
|
||||
},
|
||||
"config": {
|
||||
"publicInterfaceContracts": "Authorizable,IAuthorizable,IOwnable,LibAddress,LibAddressArray,LibAddressArrayRichErrors,LibAuthorizableRichErrors,LibBytes,LibBytesRichErrors,LibEIP1271,LibEIP712,LibFractions,LibOwnableRichErrors,LibReentrancyGuardRichErrors,LibRichErrors,LibMath,LibMathRichErrors,LibSafeMath,LibSafeMathRichErrors,Ownable,ReentrancyGuard,Refundable",
|
||||
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
|
||||
"abis": "./test/generated-artifacts/@(Authorizable|AuthorizableV06|D18|DeploymentConstants|IAuthorizable|IAuthorizableV06|IOwnable|IOwnableV06|LibAddress|LibAddressArray|LibAddressArrayRichErrors|LibAuthorizableRichErrors|LibAuthorizableRichErrorsV06|LibBytes|LibBytesRichErrors|LibBytesRichErrorsV06|LibBytesV06|LibEIP1271|LibEIP712|LibFractions|LibMath|LibMathRichErrors|LibMathRichErrorsV06|LibMathV06|LibOwnableRichErrors|LibOwnableRichErrorsV06|LibReentrancyGuardRichErrors|LibReentrancyGuardRichErrorsV06|LibRichErrors|LibRichErrorsV06|LibSafeMath|LibSafeMathRichErrors|LibSafeMathRichErrorsV06|LibSafeMathV06|Ownable|OwnableV06|ReentrancyGuard|ReentrancyGuardV06|Refundable|TestAuthorizable|TestLibAddress|TestLibAddressArray|TestLibBytes|TestLibEIP712|TestLibMath|TestLibRichErrors|TestLibSafeMath|TestLogDecoding|TestLogDecodingDownstream|TestOwnable|TestReentrancyGuard|TestRefundable|TestRefundableReceiver).json"
|
||||
"abis": "./test/generated-artifacts/@(Authorizable|AuthorizableV06|AuthorizableV08|D18|DeploymentConstants|IAuthorizable|IAuthorizableV06|IAuthorizableV08|IOwnable|IOwnableV06|IOwnableV08|LibAddress|LibAddressArray|LibAddressArrayRichErrors|LibAuthorizableRichErrors|LibAuthorizableRichErrorsV06|LibAuthorizableRichErrorsV08|LibBytes|LibBytesRichErrors|LibBytesRichErrorsV06|LibBytesRichErrorsV08|LibBytesV06|LibBytesV08|LibEIP1271|LibEIP712|LibFractions|LibMath|LibMathRichErrors|LibMathRichErrorsV06|LibMathRichErrorsV08|LibMathV06|LibMathV08|LibOwnableRichErrors|LibOwnableRichErrorsV06|LibOwnableRichErrorsV08|LibReentrancyGuardRichErrors|LibReentrancyGuardRichErrorsV06|LibReentrancyGuardRichErrorsV08|LibRichErrors|LibRichErrorsV06|LibRichErrorsV08|LibSafeMath|LibSafeMathRichErrors|LibSafeMathRichErrorsV06|LibSafeMathRichErrorsV08|LibSafeMathV06|Ownable|OwnableV06|OwnableV08|ReentrancyGuard|ReentrancyGuardV06|ReentrancyGuardV08|Refundable|TestAuthorizable|TestLibAddress|TestLibAddressArray|TestLibBytes|TestLibEIP712|TestLibMath|TestLibRichErrors|TestLibSafeMath|TestLogDecoding|TestLogDecodingDownstream|TestOwnable|TestReentrancyGuard|TestRefundable|TestRefundableReceiver).json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -51,7 +46,7 @@
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contracts-gen": "^2.0.48",
|
||||
"@0x/contracts-test-utils": "^5.4.43",
|
||||
"@0x/contracts-test-utils": "^5.4.45",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/order-utils": "^10.4.28",
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
@@ -75,7 +70,6 @@
|
||||
"mocha": "^6.2.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
"truffle": "^5.0.32",
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@@ -7,42 +7,56 @@ import { ContractArtifact } from 'ethereum-types';
|
||||
|
||||
import * as Authorizable from '../test/generated-artifacts/Authorizable.json';
|
||||
import * as AuthorizableV06 from '../test/generated-artifacts/AuthorizableV06.json';
|
||||
import * as AuthorizableV08 from '../test/generated-artifacts/AuthorizableV08.json';
|
||||
import * as D18 from '../test/generated-artifacts/D18.json';
|
||||
import * as DeploymentConstants from '../test/generated-artifacts/DeploymentConstants.json';
|
||||
import * as IAuthorizable from '../test/generated-artifacts/IAuthorizable.json';
|
||||
import * as IAuthorizableV06 from '../test/generated-artifacts/IAuthorizableV06.json';
|
||||
import * as IAuthorizableV08 from '../test/generated-artifacts/IAuthorizableV08.json';
|
||||
import * as IOwnable from '../test/generated-artifacts/IOwnable.json';
|
||||
import * as IOwnableV06 from '../test/generated-artifacts/IOwnableV06.json';
|
||||
import * as IOwnableV08 from '../test/generated-artifacts/IOwnableV08.json';
|
||||
import * as LibAddress from '../test/generated-artifacts/LibAddress.json';
|
||||
import * as LibAddressArray from '../test/generated-artifacts/LibAddressArray.json';
|
||||
import * as LibAddressArrayRichErrors from '../test/generated-artifacts/LibAddressArrayRichErrors.json';
|
||||
import * as LibAuthorizableRichErrors from '../test/generated-artifacts/LibAuthorizableRichErrors.json';
|
||||
import * as LibAuthorizableRichErrorsV06 from '../test/generated-artifacts/LibAuthorizableRichErrorsV06.json';
|
||||
import * as LibAuthorizableRichErrorsV08 from '../test/generated-artifacts/LibAuthorizableRichErrorsV08.json';
|
||||
import * as LibBytes from '../test/generated-artifacts/LibBytes.json';
|
||||
import * as LibBytesRichErrors from '../test/generated-artifacts/LibBytesRichErrors.json';
|
||||
import * as LibBytesRichErrorsV06 from '../test/generated-artifacts/LibBytesRichErrorsV06.json';
|
||||
import * as LibBytesRichErrorsV08 from '../test/generated-artifacts/LibBytesRichErrorsV08.json';
|
||||
import * as LibBytesV06 from '../test/generated-artifacts/LibBytesV06.json';
|
||||
import * as LibBytesV08 from '../test/generated-artifacts/LibBytesV08.json';
|
||||
import * as LibEIP1271 from '../test/generated-artifacts/LibEIP1271.json';
|
||||
import * as LibEIP712 from '../test/generated-artifacts/LibEIP712.json';
|
||||
import * as LibFractions from '../test/generated-artifacts/LibFractions.json';
|
||||
import * as LibMath from '../test/generated-artifacts/LibMath.json';
|
||||
import * as LibMathRichErrors from '../test/generated-artifacts/LibMathRichErrors.json';
|
||||
import * as LibMathRichErrorsV06 from '../test/generated-artifacts/LibMathRichErrorsV06.json';
|
||||
import * as LibMathRichErrorsV08 from '../test/generated-artifacts/LibMathRichErrorsV08.json';
|
||||
import * as LibMathV06 from '../test/generated-artifacts/LibMathV06.json';
|
||||
import * as LibMathV08 from '../test/generated-artifacts/LibMathV08.json';
|
||||
import * as LibOwnableRichErrors from '../test/generated-artifacts/LibOwnableRichErrors.json';
|
||||
import * as LibOwnableRichErrorsV06 from '../test/generated-artifacts/LibOwnableRichErrorsV06.json';
|
||||
import * as LibOwnableRichErrorsV08 from '../test/generated-artifacts/LibOwnableRichErrorsV08.json';
|
||||
import * as LibReentrancyGuardRichErrors from '../test/generated-artifacts/LibReentrancyGuardRichErrors.json';
|
||||
import * as LibReentrancyGuardRichErrorsV06 from '../test/generated-artifacts/LibReentrancyGuardRichErrorsV06.json';
|
||||
import * as LibReentrancyGuardRichErrorsV08 from '../test/generated-artifacts/LibReentrancyGuardRichErrorsV08.json';
|
||||
import * as LibRichErrors from '../test/generated-artifacts/LibRichErrors.json';
|
||||
import * as LibRichErrorsV06 from '../test/generated-artifacts/LibRichErrorsV06.json';
|
||||
import * as LibRichErrorsV08 from '../test/generated-artifacts/LibRichErrorsV08.json';
|
||||
import * as LibSafeMath from '../test/generated-artifacts/LibSafeMath.json';
|
||||
import * as LibSafeMathRichErrors from '../test/generated-artifacts/LibSafeMathRichErrors.json';
|
||||
import * as LibSafeMathRichErrorsV06 from '../test/generated-artifacts/LibSafeMathRichErrorsV06.json';
|
||||
import * as LibSafeMathRichErrorsV08 from '../test/generated-artifacts/LibSafeMathRichErrorsV08.json';
|
||||
import * as LibSafeMathV06 from '../test/generated-artifacts/LibSafeMathV06.json';
|
||||
import * as Ownable from '../test/generated-artifacts/Ownable.json';
|
||||
import * as OwnableV06 from '../test/generated-artifacts/OwnableV06.json';
|
||||
import * as OwnableV08 from '../test/generated-artifacts/OwnableV08.json';
|
||||
import * as ReentrancyGuard from '../test/generated-artifacts/ReentrancyGuard.json';
|
||||
import * as ReentrancyGuardV06 from '../test/generated-artifacts/ReentrancyGuardV06.json';
|
||||
import * as ReentrancyGuardV08 from '../test/generated-artifacts/ReentrancyGuardV08.json';
|
||||
import * as Refundable from '../test/generated-artifacts/Refundable.json';
|
||||
import * as TestAuthorizable from '../test/generated-artifacts/TestAuthorizable.json';
|
||||
import * as TestLibAddress from '../test/generated-artifacts/TestLibAddress.json';
|
||||
@@ -98,6 +112,20 @@ export const artifacts = {
|
||||
LibSafeMathRichErrorsV06: LibSafeMathRichErrorsV06 as ContractArtifact,
|
||||
IAuthorizableV06: IAuthorizableV06 as ContractArtifact,
|
||||
IOwnableV06: IOwnableV06 as ContractArtifact,
|
||||
AuthorizableV08: AuthorizableV08 as ContractArtifact,
|
||||
LibBytesV08: LibBytesV08 as ContractArtifact,
|
||||
LibMathV08: LibMathV08 as ContractArtifact,
|
||||
OwnableV08: OwnableV08 as ContractArtifact,
|
||||
ReentrancyGuardV08: ReentrancyGuardV08 as ContractArtifact,
|
||||
LibAuthorizableRichErrorsV08: LibAuthorizableRichErrorsV08 as ContractArtifact,
|
||||
LibBytesRichErrorsV08: LibBytesRichErrorsV08 as ContractArtifact,
|
||||
LibMathRichErrorsV08: LibMathRichErrorsV08 as ContractArtifact,
|
||||
LibOwnableRichErrorsV08: LibOwnableRichErrorsV08 as ContractArtifact,
|
||||
LibReentrancyGuardRichErrorsV08: LibReentrancyGuardRichErrorsV08 as ContractArtifact,
|
||||
LibRichErrorsV08: LibRichErrorsV08 as ContractArtifact,
|
||||
LibSafeMathRichErrorsV08: LibSafeMathRichErrorsV08 as ContractArtifact,
|
||||
IAuthorizableV08: IAuthorizableV08 as ContractArtifact,
|
||||
IOwnableV08: IOwnableV08 as ContractArtifact,
|
||||
TestAuthorizable: TestAuthorizable as ContractArtifact,
|
||||
TestLibAddress: TestLibAddress as ContractArtifact,
|
||||
TestLibAddressArray: TestLibAddressArray as ContractArtifact,
|
||||
|
@@ -1,19 +0,0 @@
|
||||
import { env, EnvVars } from '@0x/dev-utils';
|
||||
|
||||
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
|
||||
import { providerUtils } from '@0x/utils';
|
||||
|
||||
before('start web3 provider', () => {
|
||||
providerUtils.startProviderEngine(provider);
|
||||
});
|
||||
after('generate coverage report', async () => {
|
||||
if (env.parseBoolean(EnvVars.SolidityCoverage)) {
|
||||
const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
|
||||
await coverageSubprovider.writeCoverageAsync();
|
||||
}
|
||||
if (env.parseBoolean(EnvVars.SolidityProfiler)) {
|
||||
const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
|
||||
await profilerSubprovider.writeProfilerOutputAsync();
|
||||
}
|
||||
provider.stop();
|
||||
});
|
@@ -5,42 +5,56 @@
|
||||
*/
|
||||
export * from '../test/generated-wrappers/authorizable';
|
||||
export * from '../test/generated-wrappers/authorizable_v06';
|
||||
export * from '../test/generated-wrappers/authorizable_v08';
|
||||
export * from '../test/generated-wrappers/d18';
|
||||
export * from '../test/generated-wrappers/deployment_constants';
|
||||
export * from '../test/generated-wrappers/i_authorizable';
|
||||
export * from '../test/generated-wrappers/i_authorizable_v06';
|
||||
export * from '../test/generated-wrappers/i_authorizable_v08';
|
||||
export * from '../test/generated-wrappers/i_ownable';
|
||||
export * from '../test/generated-wrappers/i_ownable_v06';
|
||||
export * from '../test/generated-wrappers/i_ownable_v08';
|
||||
export * from '../test/generated-wrappers/lib_address';
|
||||
export * from '../test/generated-wrappers/lib_address_array';
|
||||
export * from '../test/generated-wrappers/lib_address_array_rich_errors';
|
||||
export * from '../test/generated-wrappers/lib_authorizable_rich_errors';
|
||||
export * from '../test/generated-wrappers/lib_authorizable_rich_errors_v06';
|
||||
export * from '../test/generated-wrappers/lib_authorizable_rich_errors_v08';
|
||||
export * from '../test/generated-wrappers/lib_bytes';
|
||||
export * from '../test/generated-wrappers/lib_bytes_rich_errors';
|
||||
export * from '../test/generated-wrappers/lib_bytes_rich_errors_v06';
|
||||
export * from '../test/generated-wrappers/lib_bytes_rich_errors_v08';
|
||||
export * from '../test/generated-wrappers/lib_bytes_v06';
|
||||
export * from '../test/generated-wrappers/lib_bytes_v08';
|
||||
export * from '../test/generated-wrappers/lib_e_i_p1271';
|
||||
export * from '../test/generated-wrappers/lib_e_i_p712';
|
||||
export * from '../test/generated-wrappers/lib_fractions';
|
||||
export * from '../test/generated-wrappers/lib_math';
|
||||
export * from '../test/generated-wrappers/lib_math_rich_errors';
|
||||
export * from '../test/generated-wrappers/lib_math_rich_errors_v06';
|
||||
export * from '../test/generated-wrappers/lib_math_rich_errors_v08';
|
||||
export * from '../test/generated-wrappers/lib_math_v06';
|
||||
export * from '../test/generated-wrappers/lib_math_v08';
|
||||
export * from '../test/generated-wrappers/lib_ownable_rich_errors';
|
||||
export * from '../test/generated-wrappers/lib_ownable_rich_errors_v06';
|
||||
export * from '../test/generated-wrappers/lib_ownable_rich_errors_v08';
|
||||
export * from '../test/generated-wrappers/lib_reentrancy_guard_rich_errors';
|
||||
export * from '../test/generated-wrappers/lib_reentrancy_guard_rich_errors_v06';
|
||||
export * from '../test/generated-wrappers/lib_reentrancy_guard_rich_errors_v08';
|
||||
export * from '../test/generated-wrappers/lib_rich_errors';
|
||||
export * from '../test/generated-wrappers/lib_rich_errors_v06';
|
||||
export * from '../test/generated-wrappers/lib_rich_errors_v08';
|
||||
export * from '../test/generated-wrappers/lib_safe_math';
|
||||
export * from '../test/generated-wrappers/lib_safe_math_rich_errors';
|
||||
export * from '../test/generated-wrappers/lib_safe_math_rich_errors_v06';
|
||||
export * from '../test/generated-wrappers/lib_safe_math_rich_errors_v08';
|
||||
export * from '../test/generated-wrappers/lib_safe_math_v06';
|
||||
export * from '../test/generated-wrappers/ownable';
|
||||
export * from '../test/generated-wrappers/ownable_v06';
|
||||
export * from '../test/generated-wrappers/ownable_v08';
|
||||
export * from '../test/generated-wrappers/reentrancy_guard';
|
||||
export * from '../test/generated-wrappers/reentrancy_guard_v06';
|
||||
export * from '../test/generated-wrappers/reentrancy_guard_v08';
|
||||
export * from '../test/generated-wrappers/refundable';
|
||||
export * from '../test/generated-wrappers/test_authorizable';
|
||||
export * from '../test/generated-wrappers/test_lib_address';
|
||||
|
@@ -1,96 +0,0 @@
|
||||
/**
|
||||
* Use this file to configure your truffle project. It's seeded with some
|
||||
* common settings for different networks and features like migrations,
|
||||
* compilation and testing. Uncomment the ones you need or modify
|
||||
* them to suit your project as necessary.
|
||||
*
|
||||
* More information about configuration can be found at:
|
||||
*
|
||||
* truffleframework.com/docs/advanced/configuration
|
||||
*
|
||||
* To deploy via Infura you'll need a wallet provider (like truffle-hdwallet-provider)
|
||||
* to sign your transactions before they're sent to a remote public node. Infura accounts
|
||||
* are available for free at: infura.io/register.
|
||||
*
|
||||
* You'll also need a mnemonic - the twelve word phrase the wallet uses to generate
|
||||
* public/private key pairs. If you're publishing your code to GitHub make sure you load this
|
||||
* phrase from a file you've .gitignored so it doesn't accidentally become public.
|
||||
*
|
||||
*/
|
||||
|
||||
// const HDWalletProvider = require('truffle-hdwallet-provider');
|
||||
// const infuraKey = "fj4jll3k.....";
|
||||
//
|
||||
// const fs = require('fs');
|
||||
// const mnemonic = fs.readFileSync(".secret").toString().trim();
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* Networks define how you connect to your ethereum client and let you set the
|
||||
* defaults web3 uses to send transactions. If you don't specify one truffle
|
||||
* will spin up a development blockchain for you on port 9545 when you
|
||||
* run `develop` or `test`. You can ask a truffle command to use a specific
|
||||
* network from the command line, e.g
|
||||
*
|
||||
* $ truffle test --network <network-name>
|
||||
*/
|
||||
|
||||
networks: {
|
||||
// Useful for testing. The `development` name is special - truffle uses it by default
|
||||
// if it's defined here and no other network is specified at the command line.
|
||||
// You should run a client (like ganache-cli, geth or parity) in a separate terminal
|
||||
// tab if you use this network and you must also set the `host`, `port` and `network_id`
|
||||
// options below to some value.
|
||||
//
|
||||
// development: {
|
||||
// host: "127.0.0.1", // Localhost (default: none)
|
||||
// port: 8545, // Standard Ethereum port (default: none)
|
||||
// network_id: "*", // Any network (default: none)
|
||||
// },
|
||||
// Another network with more advanced options...
|
||||
// advanced: {
|
||||
// port: 8777, // Custom port
|
||||
// network_id: 1342, // Custom network
|
||||
// gas: 8500000, // Gas sent with each transaction (default: ~6700000)
|
||||
// gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei)
|
||||
// from: <address>, // Account to send txs from (default: accounts[0])
|
||||
// websockets: true // Enable EventEmitter interface for web3 (default: false)
|
||||
// },
|
||||
// Useful for deploying to a public network.
|
||||
// NB: It's important to wrap the provider as a function.
|
||||
// ropsten: {
|
||||
// provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`),
|
||||
// network_id: 3, // Ropsten's id
|
||||
// gas: 5500000, // Ropsten has a lower block limit than mainnet
|
||||
// confirmations: 2, // # of confs to wait between deployments. (default: 0)
|
||||
// timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
|
||||
// skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
|
||||
// },
|
||||
// Useful for private networks
|
||||
// private: {
|
||||
// provider: () => new HDWalletProvider(mnemonic, `https://network.io`),
|
||||
// network_id: 2111, // This network is yours, in the cloud.
|
||||
// production: true // Treats this network as if it was a public net. (default: false)
|
||||
// }
|
||||
},
|
||||
|
||||
// Set default mocha options here, use special reporters etc.
|
||||
mocha: {
|
||||
// timeout: 100000
|
||||
},
|
||||
|
||||
// Configure your compilers
|
||||
compilers: {
|
||||
solc: {
|
||||
version: '0.5.9',
|
||||
settings: {
|
||||
evmVersion: 'istanbul',
|
||||
optimizer: {
|
||||
enabled: true,
|
||||
runs: 1000000,
|
||||
details: { yul: true, deduplicate: true, cse: true, constantOptimizer: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
@@ -27,42 +27,56 @@
|
||||
"generated-artifacts/Refundable.json",
|
||||
"test/generated-artifacts/Authorizable.json",
|
||||
"test/generated-artifacts/AuthorizableV06.json",
|
||||
"test/generated-artifacts/AuthorizableV08.json",
|
||||
"test/generated-artifacts/D18.json",
|
||||
"test/generated-artifacts/DeploymentConstants.json",
|
||||
"test/generated-artifacts/IAuthorizable.json",
|
||||
"test/generated-artifacts/IAuthorizableV06.json",
|
||||
"test/generated-artifacts/IAuthorizableV08.json",
|
||||
"test/generated-artifacts/IOwnable.json",
|
||||
"test/generated-artifacts/IOwnableV06.json",
|
||||
"test/generated-artifacts/IOwnableV08.json",
|
||||
"test/generated-artifacts/LibAddress.json",
|
||||
"test/generated-artifacts/LibAddressArray.json",
|
||||
"test/generated-artifacts/LibAddressArrayRichErrors.json",
|
||||
"test/generated-artifacts/LibAuthorizableRichErrors.json",
|
||||
"test/generated-artifacts/LibAuthorizableRichErrorsV06.json",
|
||||
"test/generated-artifacts/LibAuthorizableRichErrorsV08.json",
|
||||
"test/generated-artifacts/LibBytes.json",
|
||||
"test/generated-artifacts/LibBytesRichErrors.json",
|
||||
"test/generated-artifacts/LibBytesRichErrorsV06.json",
|
||||
"test/generated-artifacts/LibBytesRichErrorsV08.json",
|
||||
"test/generated-artifacts/LibBytesV06.json",
|
||||
"test/generated-artifacts/LibBytesV08.json",
|
||||
"test/generated-artifacts/LibEIP1271.json",
|
||||
"test/generated-artifacts/LibEIP712.json",
|
||||
"test/generated-artifacts/LibFractions.json",
|
||||
"test/generated-artifacts/LibMath.json",
|
||||
"test/generated-artifacts/LibMathRichErrors.json",
|
||||
"test/generated-artifacts/LibMathRichErrorsV06.json",
|
||||
"test/generated-artifacts/LibMathRichErrorsV08.json",
|
||||
"test/generated-artifacts/LibMathV06.json",
|
||||
"test/generated-artifacts/LibMathV08.json",
|
||||
"test/generated-artifacts/LibOwnableRichErrors.json",
|
||||
"test/generated-artifacts/LibOwnableRichErrorsV06.json",
|
||||
"test/generated-artifacts/LibOwnableRichErrorsV08.json",
|
||||
"test/generated-artifacts/LibReentrancyGuardRichErrors.json",
|
||||
"test/generated-artifacts/LibReentrancyGuardRichErrorsV06.json",
|
||||
"test/generated-artifacts/LibReentrancyGuardRichErrorsV08.json",
|
||||
"test/generated-artifacts/LibRichErrors.json",
|
||||
"test/generated-artifacts/LibRichErrorsV06.json",
|
||||
"test/generated-artifacts/LibRichErrorsV08.json",
|
||||
"test/generated-artifacts/LibSafeMath.json",
|
||||
"test/generated-artifacts/LibSafeMathRichErrors.json",
|
||||
"test/generated-artifacts/LibSafeMathRichErrorsV06.json",
|
||||
"test/generated-artifacts/LibSafeMathRichErrorsV08.json",
|
||||
"test/generated-artifacts/LibSafeMathV06.json",
|
||||
"test/generated-artifacts/Ownable.json",
|
||||
"test/generated-artifacts/OwnableV06.json",
|
||||
"test/generated-artifacts/OwnableV08.json",
|
||||
"test/generated-artifacts/ReentrancyGuard.json",
|
||||
"test/generated-artifacts/ReentrancyGuardV06.json",
|
||||
"test/generated-artifacts/ReentrancyGuardV08.json",
|
||||
"test/generated-artifacts/Refundable.json",
|
||||
"test/generated-artifacts/TestAuthorizable.json",
|
||||
"test/generated-artifacts/TestLibAddress.json",
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1674517560,
|
||||
"version": "0.38.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1670879498,
|
||||
"version": "0.38.3",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1669235113,
|
||||
"version": "0.38.2",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.38.4 - _January 23, 2023_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.38.3 - _December 12, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.38.2 - _November 23, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -20,7 +20,7 @@ We strongly recommend that the community help us make improvements and determine
|
||||
|
||||
For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
|
||||
|
||||
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
|
||||
Please read our [contribution guidelines](../../.github/CONTRIBUTING.md) before getting started.
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
|
@@ -121,7 +121,6 @@
|
||||
"./contracts/src/transformers/bridges/PolygonBridgeAdapter.sol",
|
||||
"./contracts/src/transformers/bridges/mixins/MixinAaveV2.sol",
|
||||
"./contracts/src/transformers/bridges/mixins/MixinBalancer.sol",
|
||||
"./contracts/src/transformers/bridges/mixins/MixinBalancerV2.sol",
|
||||
"./contracts/src/transformers/bridges/mixins/MixinBalancerV2Batch.sol",
|
||||
"./contracts/src/transformers/bridges/mixins/MixinBancor.sol",
|
||||
"./contracts/src/transformers/bridges/mixins/MixinBancorV3.sol",
|
||||
@@ -158,8 +157,6 @@
|
||||
"./contracts/src/vendor/v3/IERC20Bridge.sol",
|
||||
"./contracts/src/vendor/v3/IStaking.sol",
|
||||
"./contracts/test/ITestSimpleFunctionRegistryFeature.sol",
|
||||
"./contracts/test/TestBridge.sol",
|
||||
"./contracts/test/TestCallTarget.sol",
|
||||
"./contracts/test/TestDelegateCaller.sol",
|
||||
"./contracts/test/TestFeeCollectorController.sol",
|
||||
"./contracts/test/TestFeeRecipient.sol",
|
||||
@@ -193,7 +190,6 @@
|
||||
"./contracts/test/TestTransformerHost.sol",
|
||||
"./contracts/test/TestUniswapV3Feature.sol",
|
||||
"./contracts/test/TestWethTransformerHost.sol",
|
||||
"./contracts/test/TestZeroExFeature.sol",
|
||||
"./contracts/test/integration/TestCurve.sol",
|
||||
"./contracts/test/integration/TestLiquidityProvider.sol",
|
||||
"./contracts/test/integration/TestMooniswap.sol",
|
||||
|
@@ -23,7 +23,6 @@ pragma experimental ABIEncoderV2;
|
||||
import "./AbstractBridgeAdapter.sol";
|
||||
import "./BridgeProtocols.sol";
|
||||
import "./mixins/MixinAaveV3.sol";
|
||||
import "./mixins/MixinBalancerV2.sol";
|
||||
import "./mixins/MixinBalancerV2Batch.sol";
|
||||
import "./mixins/MixinCurve.sol";
|
||||
import "./mixins/MixinCurveV2.sol";
|
||||
@@ -38,7 +37,6 @@ import "./mixins/MixinZeroExBridge.sol";
|
||||
contract ArbitrumBridgeAdapter is
|
||||
AbstractBridgeAdapter(42161, "Arbitrum"),
|
||||
MixinAaveV3,
|
||||
MixinBalancerV2,
|
||||
MixinBalancerV2Batch,
|
||||
MixinCurve,
|
||||
MixinCurveV2,
|
||||
@@ -60,12 +58,7 @@ contract ArbitrumBridgeAdapter is
|
||||
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.BALANCERV2BATCH) {
|
||||
if (protocolId == BridgeProtocols.BALANCERV2BATCH) {
|
||||
if (dryRun) {
|
||||
return (0, true);
|
||||
}
|
||||
|
@@ -24,7 +24,6 @@ import "./AbstractBridgeAdapter.sol";
|
||||
import "./BridgeProtocols.sol";
|
||||
import "./mixins/MixinAaveV2.sol";
|
||||
import "./mixins/MixinBalancer.sol";
|
||||
import "./mixins/MixinBalancerV2.sol";
|
||||
import "./mixins/MixinBalancerV2Batch.sol";
|
||||
import "./mixins/MixinBancor.sol";
|
||||
import "./mixins/MixinBancorV3.sol";
|
||||
@@ -50,7 +49,6 @@ contract EthereumBridgeAdapter is
|
||||
AbstractBridgeAdapter(1, "Ethereum"),
|
||||
MixinAaveV2,
|
||||
MixinBalancer,
|
||||
MixinBalancerV2,
|
||||
MixinBalancerV2Batch,
|
||||
MixinBancor,
|
||||
MixinBancorV3,
|
||||
@@ -122,11 +120,6 @@ contract EthereumBridgeAdapter is
|
||||
return (0, true);
|
||||
}
|
||||
boughtAmount = _tradeBalancer(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||
} else if (protocolId == BridgeProtocols.BALANCERV2) {
|
||||
if (dryRun) {
|
||||
return (0, true);
|
||||
}
|
||||
boughtAmount = _tradeBalancerV2(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||
} else if (protocolId == BridgeProtocols.BALANCERV2BATCH) {
|
||||
if (dryRun) {
|
||||
return (0, true);
|
||||
|
@@ -22,9 +22,6 @@ pragma experimental ABIEncoderV2;
|
||||
|
||||
import "./AbstractBridgeAdapter.sol";
|
||||
import "./BridgeProtocols.sol";
|
||||
import "./mixins/MixinAaveV3.sol";
|
||||
import "./mixins/MixinAaveV2.sol";
|
||||
import "./mixins/MixinBalancerV2.sol";
|
||||
import "./mixins/MixinBalancerV2Batch.sol";
|
||||
import "./mixins/MixinCurve.sol";
|
||||
import "./mixins/MixinCurveV2.sol";
|
||||
@@ -35,9 +32,6 @@ import "./mixins/MixinZeroExBridge.sol";
|
||||
|
||||
contract FantomBridgeAdapter is
|
||||
AbstractBridgeAdapter(250, "Fantom"),
|
||||
MixinAaveV3,
|
||||
MixinAaveV2,
|
||||
MixinBalancerV2,
|
||||
MixinBalancerV2Batch,
|
||||
MixinCurve,
|
||||
MixinCurveV2,
|
||||
@@ -46,7 +40,7 @@ contract FantomBridgeAdapter is
|
||||
MixinWOOFi,
|
||||
MixinZeroExBridge
|
||||
{
|
||||
constructor(IEtherTokenV06 weth) public MixinCurve(weth) MixinAaveV3(false) {}
|
||||
constructor(IEtherTokenV06 weth) public MixinCurve(weth) {}
|
||||
|
||||
function _trade(
|
||||
BridgeOrder memory order,
|
||||
@@ -71,11 +65,6 @@ contract FantomBridgeAdapter is
|
||||
return (0, true);
|
||||
}
|
||||
boughtAmount = _tradeUniswapV2(buyToken, sellAmount, order.bridgeData);
|
||||
} else if (protocolId == BridgeProtocols.BALANCERV2) {
|
||||
if (dryRun) {
|
||||
return (0, true);
|
||||
}
|
||||
boughtAmount = _tradeBalancerV2(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||
} else if (protocolId == BridgeProtocols.BALANCERV2BATCH) {
|
||||
if (dryRun) {
|
||||
return (0, true);
|
||||
@@ -86,11 +75,6 @@ contract FantomBridgeAdapter is
|
||||
return (0, true);
|
||||
}
|
||||
boughtAmount = _tradeNerve(sellToken, sellAmount, order.bridgeData);
|
||||
} else if (protocolId == BridgeProtocols.AAVEV2) {
|
||||
if (dryRun) {
|
||||
return (0, true);
|
||||
}
|
||||
boughtAmount = _tradeAaveV2(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||
} else if (protocolId == BridgeProtocols.WOOFI) {
|
||||
if (dryRun) {
|
||||
return (0, true);
|
||||
@@ -101,11 +85,6 @@ contract FantomBridgeAdapter is
|
||||
return (0, true);
|
||||
}
|
||||
boughtAmount = _tradeZeroExBridge(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||
} else if (protocolId == BridgeProtocols.AAVEV3) {
|
||||
if (dryRun) {
|
||||
return (0, true);
|
||||
}
|
||||
boughtAmount = _tradeAaveV3(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||
}
|
||||
|
||||
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);
|
||||
|
@@ -18,7 +18,6 @@ pragma experimental ABIEncoderV2;
|
||||
import "./AbstractBridgeAdapter.sol";
|
||||
import "./BridgeProtocols.sol";
|
||||
import "./mixins/MixinAaveV3.sol";
|
||||
import "./mixins/MixinBalancerV2.sol";
|
||||
import "./mixins/MixinBalancerV2Batch.sol";
|
||||
import "./mixins/MixinCurve.sol";
|
||||
import "./mixins/MixinCurveV2.sol";
|
||||
@@ -31,7 +30,6 @@ import "./mixins/MixinZeroExBridge.sol";
|
||||
contract OptimismBridgeAdapter is
|
||||
AbstractBridgeAdapter(10, "Optimism"),
|
||||
MixinAaveV3,
|
||||
MixinBalancerV2,
|
||||
MixinBalancerV2Batch,
|
||||
MixinCurve,
|
||||
MixinCurveV2,
|
||||
@@ -86,11 +84,6 @@ contract OptimismBridgeAdapter is
|
||||
return (0, true);
|
||||
}
|
||||
boughtAmount = _tradeZeroExBridge(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||
} else if (protocolId == BridgeProtocols.BALANCERV2) {
|
||||
if (dryRun) {
|
||||
return (0, true);
|
||||
}
|
||||
boughtAmount = _tradeBalancerV2(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||
} else if (protocolId == BridgeProtocols.BALANCERV2BATCH) {
|
||||
if (dryRun) {
|
||||
return (0, true);
|
||||
|
@@ -24,7 +24,6 @@ import "./AbstractBridgeAdapter.sol";
|
||||
import "./BridgeProtocols.sol";
|
||||
import "./mixins/MixinAaveV3.sol";
|
||||
import "./mixins/MixinAaveV2.sol";
|
||||
import "./mixins/MixinBalancerV2.sol";
|
||||
import "./mixins/MixinBalancerV2Batch.sol";
|
||||
import "./mixins/MixinCurve.sol";
|
||||
import "./mixins/MixinCurveV2.sol";
|
||||
@@ -43,7 +42,6 @@ contract PolygonBridgeAdapter is
|
||||
AbstractBridgeAdapter(137, "Polygon"),
|
||||
MixinAaveV3,
|
||||
MixinAaveV2,
|
||||
MixinBalancerV2,
|
||||
MixinBalancerV2Batch,
|
||||
MixinCurve,
|
||||
MixinCurveV2,
|
||||
@@ -88,11 +86,6 @@ contract PolygonBridgeAdapter is
|
||||
return (0, true);
|
||||
}
|
||||
boughtAmount = _tradeUniswapV2(buyToken, sellAmount, order.bridgeData);
|
||||
} else if (protocolId == BridgeProtocols.BALANCERV2) {
|
||||
if (dryRun) {
|
||||
return (0, true);
|
||||
}
|
||||
boughtAmount = _tradeBalancerV2(sellToken, buyToken, sellAmount, order.bridgeData);
|
||||
} else if (protocolId == BridgeProtocols.BALANCERV2BATCH) {
|
||||
if (dryRun) {
|
||||
return (0, true);
|
||||
|
@@ -1,119 +0,0 @@
|
||||
// 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
|
||||
}
|
||||
|
||||
// solhint-disable max-line-length
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
// solhint-enable max-line-length
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@@ -1,49 +0,0 @@
|
||||
// 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/IERC20TokenV06.sol";
|
||||
import "../src/vendor/v3/IERC20Bridge.sol";
|
||||
|
||||
contract TestBridge is IERC20Bridge {
|
||||
IERC20TokenV06 public immutable xAsset;
|
||||
IERC20TokenV06 public immutable yAsset;
|
||||
|
||||
constructor(IERC20TokenV06 xAsset_, IERC20TokenV06 yAsset_) public {
|
||||
xAsset = xAsset_;
|
||||
yAsset = yAsset_;
|
||||
}
|
||||
|
||||
/// @dev Transfers `amount` of the ERC20 `tokenAddress` from `from` to `to`.
|
||||
/// @param tokenAddress The address of the ERC20 token to transfer.
|
||||
/// @param from Address to transfer asset from.
|
||||
/// @param to Address to transfer asset to.
|
||||
/// @param amount Amount of asset to transfer.
|
||||
/// @return success The magic bytes `0xdc1600f3` if successful.
|
||||
function bridgeTransferFrom(
|
||||
address tokenAddress,
|
||||
address from,
|
||||
address to,
|
||||
uint256 amount,
|
||||
bytes calldata /* bridgeData */
|
||||
) external override returns (bytes4 success) {
|
||||
IERC20TokenV06 takerToken = tokenAddress == address(xAsset) ? yAsset : xAsset;
|
||||
uint256 takerTokenBalance = takerToken.balanceOf(address(this));
|
||||
emit ERC20BridgeTransfer(address(takerToken), tokenAddress, takerTokenBalance, amount, from, to);
|
||||
return 0xdecaf000;
|
||||
}
|
||||
}
|
@@ -1,8 +1,7 @@
|
||||
[profile.default]
|
||||
src = 'contracts/src'
|
||||
out = 'foundry-artifacts'
|
||||
test = 'contracts/test/foundry'
|
||||
test = 'tests'
|
||||
libs = ["contracts/deps/", "../utils/contracts/src/"]
|
||||
remappings = ['@0x/contracts-utils/=../utils/', '@0x/contracts-erc20/=../erc20/', 'src/=./contracts/src']
|
||||
cache_path = 'foundry-cache'
|
||||
optimizer_runs = 1000000
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-zero-ex",
|
||||
"version": "0.38.2",
|
||||
"version": "0.38.4",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -16,7 +16,6 @@
|
||||
"pre_build": "run-s compile contracts:gen generate_contract_wrappers contracts:copy",
|
||||
"test": "yarn run_mocha",
|
||||
"rebuild_and_test": "run-s build test",
|
||||
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
|
||||
"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",
|
||||
@@ -26,14 +25,9 @@
|
||||
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
|
||||
"lint": "eslint src test scripts",
|
||||
"fix": "eslint --fix src scripts test",
|
||||
"coverage:report:text": "istanbul report text",
|
||||
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||
"profiler:report:html": "istanbul report html && open coverage/index.html",
|
||||
"coverage:report:lcov": "istanbul report lcov",
|
||||
"test:circleci": "yarn test",
|
||||
"test:ci": "yarn test",
|
||||
"contracts:gen": "contracts-gen generate",
|
||||
"contracts:copy": "contracts-gen copy",
|
||||
"compile:truffle": "truffle compile",
|
||||
"docs:md": "ts-doc-gen --sourceDir='$PROJECT_FILES' --output=$MD_FILE_DIR --fileExtension=mdx --tsconfig=./typedoc-tsconfig.json",
|
||||
"docs:json": "typedoc --excludePrivate --excludeExternals --excludeProtected --ignoreCompilerErrors --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES",
|
||||
"publish:private": "yarn build && gitpkg publish",
|
||||
@@ -43,7 +37,7 @@
|
||||
"config": {
|
||||
"publicInterfaceContracts": "IZeroEx,ZeroEx,FullMigration,InitialMigration,IFlashWallet,IERC20Transformer,IOwnableFeature,ISimpleFunctionRegistryFeature,ITransformERC20Feature,FillQuoteTransformer,PayTakerTransformer,PositiveSlippageFeeTransformer,WethTransformer,OwnableFeature,SimpleFunctionRegistryFeature,TransformERC20Feature,AffiliateFeeTransformer,MetaTransactionsFeature,LogMetadataTransformer,LiquidityProviderFeature,ILiquidityProviderFeature,NativeOrdersFeature,INativeOrdersFeature,FeeCollectorController,FeeCollector,CurveLiquidityProvider,BatchFillNativeOrdersFeature,IBatchFillNativeOrdersFeature,MultiplexFeature,IMultiplexFeature,OtcOrdersFeature,IOtcOrdersFeature,AvalancheBridgeAdapter,BSCBridgeAdapter,CeloBridgeAdapter,EthereumBridgeAdapter,FantomBridgeAdapter,OptimismBridgeAdapter,PolygonBridgeAdapter",
|
||||
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
|
||||
"abis": "./test/generated-artifacts/@(AbstractBridgeAdapter|AffiliateFeeTransformer|AvalancheBridgeAdapter|BSCBridgeAdapter|BatchFillNativeOrdersFeature|BootstrapFeature|BridgeProtocols|CeloBridgeAdapter|CurveLiquidityProvider|ERC1155OrdersFeature|ERC165Feature|ERC721OrdersFeature|EthereumBridgeAdapter|FantomBridgeAdapter|FeeCollector|FeeCollectorController|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinERC1155Spender|FixinERC721Spender|FixinProtocolFees|FixinReentrancyGuard|FixinTokenSpender|FlashWallet|FullMigration|FundRecoveryFeature|IBatchFillNativeOrdersFeature|IBootstrapFeature|IBridgeAdapter|IERC1155OrdersFeature|IERC1155Token|IERC165Feature|IERC20Bridge|IERC20Transformer|IERC721OrdersFeature|IERC721Token|IFeature|IFeeRecipient|IFlashWallet|IFundRecoveryFeature|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IMooniswapPool|IMultiplexFeature|INativeOrdersEvents|INativeOrdersFeature|IOtcOrdersFeature|IOwnableFeature|IPancakeSwapFeature|IPropertyValidator|ISimpleFunctionRegistryFeature|IStaking|ITakerCallback|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IUniswapV2Pair|IUniswapV3Feature|IUniswapV3Pool|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC1155OrdersStorage|LibERC20Transformer|LibERC721OrdersStorage|LibFeeCollector|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibNFTOrder|LibNFTOrdersRichErrors|LibNativeOrder|LibNativeOrdersRichErrors|LibNativeOrdersStorage|LibOtcOrdersStorage|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinAaveV2|MixinBalancer|MixinBalancerV2|MixinBalancerV2Batch|MixinBancor|MixinBancorV3|MixinCompound|MixinCryptoCom|MixinCurve|MixinCurveV2|MixinDodo|MixinDodoV2|MixinGMX|MixinKyberDmm|MixinLido|MixinMStable|MixinMakerPSM|MixinMooniswap|MixinNerve|MixinPlatypus|MixinShell|MixinSolidly|MixinSynthetix|MixinUniswap|MixinUniswapV2|MixinUniswapV3|MixinZeroExBridge|MooniswapLiquidityProvider|MultiplexFeature|MultiplexLiquidityProvider|MultiplexOtc|MultiplexRfq|MultiplexTransformERC20|MultiplexUniswapV2|MultiplexUniswapV3|NFTOrders|NativeOrdersCancellation|NativeOrdersFeature|NativeOrdersInfo|NativeOrdersProtocolFees|NativeOrdersSettlement|OptimismBridgeAdapter|OtcOrdersFeature|OwnableFeature|PancakeSwapFeature|PayTakerTransformer|PermissionlessTransformerDeployer|PolygonBridgeAdapter|PositiveSlippageFeeTransformer|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestCurve|TestDelegateCaller|TestFeeCollectorController|TestFeeRecipient|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFixinProtocolFees|TestFixinTokenSpender|TestFullMigration|TestInitialMigration|TestLibNativeOrder|TestLibSignature|TestLiquidityProvider|TestMetaTransactionsNativeOrdersFeature|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC1155Token|TestMintableERC20Token|TestMintableERC721Token|TestMooniswap|TestNFTOrderPresigner|TestNativeOrdersFeature|TestNoEthRecipient|TestOrderSignerRegistryWithContractWallet|TestPermissionlessTransformerDeployerSuicidal|TestPermissionlessTransformerDeployerTransformer|TestPropertyValidator|TestRfqOriginRegistration|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestStaking|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestUniswapV2Factory|TestUniswapV2Pool|TestUniswapV3Factory|TestUniswapV3Feature|TestUniswapV3Pool|TestWeth|TestWethTransformerHost|TestZeroExFeature|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|UniswapV3Feature|WethTransformer|ZeroEx|ZeroExOptimized).json"
|
||||
"abis": "./test/generated-artifacts/@(AbstractBridgeAdapter|AffiliateFeeTransformer|AvalancheBridgeAdapter|BSCBridgeAdapter|BatchFillNativeOrdersFeature|BootstrapFeature|BridgeProtocols|CeloBridgeAdapter|CurveLiquidityProvider|ERC1155OrdersFeature|ERC165Feature|ERC721OrdersFeature|EthereumBridgeAdapter|FantomBridgeAdapter|FeeCollector|FeeCollectorController|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinERC1155Spender|FixinERC721Spender|FixinProtocolFees|FixinReentrancyGuard|FixinTokenSpender|FlashWallet|FullMigration|FundRecoveryFeature|IBatchFillNativeOrdersFeature|IBootstrapFeature|IBridgeAdapter|IERC1155OrdersFeature|IERC1155Token|IERC165Feature|IERC20Bridge|IERC20Transformer|IERC721OrdersFeature|IERC721Token|IFeature|IFeeRecipient|IFlashWallet|IFundRecoveryFeature|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IMooniswapPool|IMultiplexFeature|INativeOrdersEvents|INativeOrdersFeature|IOtcOrdersFeature|IOwnableFeature|IPancakeSwapFeature|IPropertyValidator|ISimpleFunctionRegistryFeature|IStaking|ITakerCallback|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IUniswapV2Pair|IUniswapV3Feature|IUniswapV3Pool|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC1155OrdersStorage|LibERC20Transformer|LibERC721OrdersStorage|LibFeeCollector|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibNFTOrder|LibNFTOrdersRichErrors|LibNativeOrder|LibNativeOrdersRichErrors|LibNativeOrdersStorage|LibOtcOrdersStorage|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinAaveV2|MixinBalancer|MixinBalancerV2Batch|MixinBancor|MixinBancorV3|MixinCompound|MixinCryptoCom|MixinCurve|MixinCurveV2|MixinDodo|MixinDodoV2|MixinGMX|MixinKyberDmm|MixinLido|MixinMStable|MixinMakerPSM|MixinMooniswap|MixinNerve|MixinPlatypus|MixinShell|MixinSolidly|MixinSynthetix|MixinUniswap|MixinUniswapV2|MixinUniswapV3|MixinZeroExBridge|MooniswapLiquidityProvider|MultiplexFeature|MultiplexLiquidityProvider|MultiplexOtc|MultiplexRfq|MultiplexTransformERC20|MultiplexUniswapV2|MultiplexUniswapV3|NFTOrders|NativeOrdersCancellation|NativeOrdersFeature|NativeOrdersInfo|NativeOrdersProtocolFees|NativeOrdersSettlement|OptimismBridgeAdapter|OtcOrdersFeature|OwnableFeature|PancakeSwapFeature|PayTakerTransformer|PermissionlessTransformerDeployer|PolygonBridgeAdapter|PositiveSlippageFeeTransformer|SimpleFunctionRegistryFeature|TestCurve|TestDelegateCaller|TestFeeCollectorController|TestFeeRecipient|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFixinProtocolFees|TestFixinTokenSpender|TestFullMigration|TestInitialMigration|TestLibNativeOrder|TestLibSignature|TestLiquidityProvider|TestMetaTransactionsNativeOrdersFeature|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC1155Token|TestMintableERC20Token|TestMintableERC721Token|TestMooniswap|TestNFTOrderPresigner|TestNativeOrdersFeature|TestNoEthRecipient|TestOrderSignerRegistryWithContractWallet|TestPermissionlessTransformerDeployerSuicidal|TestPermissionlessTransformerDeployerTransformer|TestPropertyValidator|TestRfqOriginRegistration|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestStaking|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestUniswapV2Factory|TestUniswapV2Pool|TestUniswapV3Factory|TestUniswapV3Feature|TestUniswapV3Pool|TestWeth|TestWethTransformerHost|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|UniswapV3Feature|WethTransformer|ZeroEx|ZeroExOptimized).json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -56,10 +50,10 @@
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.8.1",
|
||||
"@0x/contract-addresses": "^7.4.1",
|
||||
"@0x/contracts-erc20": "^3.3.53",
|
||||
"@0x/contract-addresses": "^8.0.1",
|
||||
"@0x/contracts-erc20": "^3.3.55",
|
||||
"@0x/contracts-gen": "^2.0.48",
|
||||
"@0x/contracts-test-utils": "^5.4.43",
|
||||
"@0x/contracts-test-utils": "^5.4.45",
|
||||
"@0x/dev-utils": "^5.0.0",
|
||||
"@0x/order-utils": "^10.4.28",
|
||||
"@0x/sol-compiler": "^4.8.2",
|
||||
@@ -79,14 +73,13 @@
|
||||
"npm-run-all": "^4.1.2",
|
||||
"prompts": "^2.4.0",
|
||||
"shx": "^0.2.2",
|
||||
"truffle": "^5.0.32",
|
||||
"typechain": "^8.0.0",
|
||||
"typedoc": "~0.16.11",
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^7.0.0",
|
||||
"@0x/protocol-utils": "^11.17.2",
|
||||
"@0x/protocol-utils": "^11.17.4",
|
||||
"@0x/subproviders": "^7.0.0",
|
||||
"@0x/types": "^3.3.6",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
|
@@ -10,7 +10,7 @@ import * as prompts from 'prompts';
|
||||
|
||||
import * as wrappers from '../src/wrappers';
|
||||
|
||||
const SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/mzhu25/zeroex-migrations';
|
||||
const SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/0xeng/zeroex-features-mainnet';
|
||||
|
||||
const ownableFeature = new wrappers.OwnableFeatureContract(constants.NULL_ADDRESS, new Web3ProviderEngine());
|
||||
const simpleFunctionRegistryFeature = new wrappers.SimpleFunctionRegistryFeatureContract(
|
||||
@@ -18,6 +18,7 @@ const simpleFunctionRegistryFeature = new wrappers.SimpleFunctionRegistryFeature
|
||||
new Web3ProviderEngine(),
|
||||
);
|
||||
const DO_NOT_ROLLBACK = [
|
||||
ownableFeature.getSelector('owner'),
|
||||
ownableFeature.getSelector('migrate'),
|
||||
ownableFeature.getSelector('transferOwnership'),
|
||||
simpleFunctionRegistryFeature.getSelector('rollback'),
|
||||
|
@@ -105,7 +105,6 @@ import * as LogMetadataTransformer from '../test/generated-artifacts/LogMetadata
|
||||
import * as MetaTransactionsFeature from '../test/generated-artifacts/MetaTransactionsFeature.json';
|
||||
import * as MixinAaveV2 from '../test/generated-artifacts/MixinAaveV2.json';
|
||||
import * as MixinBalancer from '../test/generated-artifacts/MixinBalancer.json';
|
||||
import * as MixinBalancerV2 from '../test/generated-artifacts/MixinBalancerV2.json';
|
||||
import * as MixinBalancerV2Batch from '../test/generated-artifacts/MixinBalancerV2Batch.json';
|
||||
import * as MixinBancor from '../test/generated-artifacts/MixinBancor.json';
|
||||
import * as MixinBancorV3 from '../test/generated-artifacts/MixinBancorV3.json';
|
||||
@@ -153,8 +152,6 @@ import * as PermissionlessTransformerDeployer from '../test/generated-artifacts/
|
||||
import * as PolygonBridgeAdapter from '../test/generated-artifacts/PolygonBridgeAdapter.json';
|
||||
import * as PositiveSlippageFeeTransformer from '../test/generated-artifacts/PositiveSlippageFeeTransformer.json';
|
||||
import * as SimpleFunctionRegistryFeature from '../test/generated-artifacts/SimpleFunctionRegistryFeature.json';
|
||||
import * as TestBridge from '../test/generated-artifacts/TestBridge.json';
|
||||
import * as TestCallTarget from '../test/generated-artifacts/TestCallTarget.json';
|
||||
import * as TestCurve from '../test/generated-artifacts/TestCurve.json';
|
||||
import * as TestDelegateCaller from '../test/generated-artifacts/TestDelegateCaller.json';
|
||||
import * as TestFeeCollectorController from '../test/generated-artifacts/TestFeeCollectorController.json';
|
||||
@@ -200,7 +197,6 @@ import * as TestUniswapV3Feature from '../test/generated-artifacts/TestUniswapV3
|
||||
import * as TestUniswapV3Pool from '../test/generated-artifacts/TestUniswapV3Pool.json';
|
||||
import * as TestWeth from '../test/generated-artifacts/TestWeth.json';
|
||||
import * as TestWethTransformerHost from '../test/generated-artifacts/TestWethTransformerHost.json';
|
||||
import * as TestZeroExFeature from '../test/generated-artifacts/TestZeroExFeature.json';
|
||||
import * as Transformer from '../test/generated-artifacts/Transformer.json';
|
||||
import * as TransformERC20Feature from '../test/generated-artifacts/TransformERC20Feature.json';
|
||||
import * as TransformerDeployer from '../test/generated-artifacts/TransformerDeployer.json';
|
||||
@@ -329,7 +325,6 @@ export const artifacts = {
|
||||
PolygonBridgeAdapter: PolygonBridgeAdapter as ContractArtifact,
|
||||
MixinAaveV2: MixinAaveV2 as ContractArtifact,
|
||||
MixinBalancer: MixinBalancer as ContractArtifact,
|
||||
MixinBalancerV2: MixinBalancerV2 as ContractArtifact,
|
||||
MixinBalancerV2Batch: MixinBalancerV2Batch as ContractArtifact,
|
||||
MixinBancor: MixinBancor as ContractArtifact,
|
||||
MixinBancorV3: MixinBancorV3 as ContractArtifact,
|
||||
@@ -366,8 +361,6 @@ export const artifacts = {
|
||||
IERC20Bridge: IERC20Bridge as ContractArtifact,
|
||||
IStaking: IStaking as ContractArtifact,
|
||||
ITestSimpleFunctionRegistryFeature: ITestSimpleFunctionRegistryFeature as ContractArtifact,
|
||||
TestBridge: TestBridge as ContractArtifact,
|
||||
TestCallTarget: TestCallTarget as ContractArtifact,
|
||||
TestDelegateCaller: TestDelegateCaller as ContractArtifact,
|
||||
TestFeeCollectorController: TestFeeCollectorController as ContractArtifact,
|
||||
TestFeeRecipient: TestFeeRecipient as ContractArtifact,
|
||||
@@ -402,7 +395,6 @@ export const artifacts = {
|
||||
TestTransformerHost: TestTransformerHost as ContractArtifact,
|
||||
TestUniswapV3Feature: TestUniswapV3Feature as ContractArtifact,
|
||||
TestWethTransformerHost: TestWethTransformerHost as ContractArtifact,
|
||||
TestZeroExFeature: TestZeroExFeature as ContractArtifact,
|
||||
TestCurve: TestCurve as ContractArtifact,
|
||||
TestLiquidityProvider: TestLiquidityProvider as ContractArtifact,
|
||||
TestMooniswap: TestMooniswap as ContractArtifact,
|
||||
|
@@ -1,211 +0,0 @@
|
||||
import {
|
||||
blockchainTests,
|
||||
constants,
|
||||
expect,
|
||||
getRandomInteger,
|
||||
randomAddress,
|
||||
verifyEventsFromLogs,
|
||||
} from '@0x/contracts-test-utils';
|
||||
import { hexUtils, OwnableRevertErrors, StringRevertError, ZeroExRevertErrors } from '@0x/utils';
|
||||
|
||||
import { artifacts } from './artifacts';
|
||||
import { FlashWalletContract, TestCallTargetContract, TestCallTargetEvents } from './wrappers';
|
||||
|
||||
blockchainTests.resets('FlashWallet', env => {
|
||||
let owner: string;
|
||||
let wallet: FlashWalletContract;
|
||||
let callTarget: TestCallTargetContract;
|
||||
|
||||
before(async () => {
|
||||
[owner] = await env.getAccountAddressesAsync();
|
||||
wallet = await FlashWalletContract.deployFrom0xArtifactAsync(
|
||||
artifacts.FlashWallet,
|
||||
env.provider,
|
||||
{
|
||||
...env.txDefaults,
|
||||
from: owner,
|
||||
},
|
||||
artifacts,
|
||||
);
|
||||
callTarget = await TestCallTargetContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TestCallTarget,
|
||||
env.provider,
|
||||
env.txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
});
|
||||
|
||||
const TARGET_RETURN_VALUE = hexUtils.rightPad('0x12345678');
|
||||
const REVERTING_DATA = '0x1337';
|
||||
|
||||
it('owned by deployer', () => {
|
||||
return expect(wallet.owner().callAsync()).to.eventually.eq(owner);
|
||||
});
|
||||
|
||||
describe('executeCall()', () => {
|
||||
it('non-owner cannot call executeCall()', async () => {
|
||||
const notOwner = randomAddress();
|
||||
const tx = wallet
|
||||
.executeCall(randomAddress(), hexUtils.random(), getRandomInteger(0, '100e18'))
|
||||
.callAsync({ from: notOwner });
|
||||
return expect(tx).to.revertWith(new OwnableRevertErrors.OnlyOwnerError(notOwner));
|
||||
});
|
||||
|
||||
it('owner can call executeCall()', async () => {
|
||||
const targetData = hexUtils.random(128);
|
||||
const receipt = await wallet
|
||||
.executeCall(callTarget.address, targetData, constants.ZERO_AMOUNT)
|
||||
.awaitTransactionSuccessAsync({ from: owner });
|
||||
verifyEventsFromLogs(
|
||||
receipt.logs,
|
||||
[
|
||||
{
|
||||
context: callTarget.address,
|
||||
sender: wallet.address,
|
||||
data: targetData,
|
||||
value: constants.ZERO_AMOUNT,
|
||||
},
|
||||
],
|
||||
TestCallTargetEvents.CallTargetCalled,
|
||||
);
|
||||
});
|
||||
|
||||
it('owner can call executeCall() with attached ETH', async () => {
|
||||
const targetData = hexUtils.random(128);
|
||||
const callValue = getRandomInteger(1, '1e18');
|
||||
const receipt = await wallet
|
||||
.executeCall(callTarget.address, targetData, callValue)
|
||||
.awaitTransactionSuccessAsync({ from: owner, value: callValue });
|
||||
verifyEventsFromLogs(
|
||||
receipt.logs,
|
||||
[
|
||||
{
|
||||
context: callTarget.address,
|
||||
sender: wallet.address,
|
||||
data: targetData,
|
||||
value: callValue,
|
||||
},
|
||||
],
|
||||
TestCallTargetEvents.CallTargetCalled,
|
||||
);
|
||||
});
|
||||
|
||||
it('owner can call executeCall() can transfer less ETH than attached', async () => {
|
||||
const targetData = hexUtils.random(128);
|
||||
const callValue = getRandomInteger(1, '1e18');
|
||||
const receipt = await wallet
|
||||
.executeCall(callTarget.address, targetData, callValue.minus(1))
|
||||
.awaitTransactionSuccessAsync({ from: owner, value: callValue });
|
||||
verifyEventsFromLogs(
|
||||
receipt.logs,
|
||||
[
|
||||
{
|
||||
context: callTarget.address,
|
||||
sender: wallet.address,
|
||||
data: targetData,
|
||||
value: callValue.minus(1),
|
||||
},
|
||||
],
|
||||
TestCallTargetEvents.CallTargetCalled,
|
||||
);
|
||||
});
|
||||
|
||||
it('wallet returns call result', async () => {
|
||||
const result = await wallet
|
||||
.executeCall(callTarget.address, hexUtils.random(128), constants.ZERO_AMOUNT)
|
||||
.callAsync({ from: owner });
|
||||
expect(result).to.eq(TARGET_RETURN_VALUE);
|
||||
});
|
||||
|
||||
it('wallet wraps call revert', async () => {
|
||||
const tx = wallet
|
||||
.executeCall(callTarget.address, REVERTING_DATA, constants.ZERO_AMOUNT)
|
||||
.callAsync({ from: owner });
|
||||
return expect(tx).to.revertWith(
|
||||
new ZeroExRevertErrors.Wallet.WalletExecuteCallFailedError(
|
||||
wallet.address,
|
||||
callTarget.address,
|
||||
REVERTING_DATA,
|
||||
constants.ZERO_AMOUNT,
|
||||
new StringRevertError('TestCallTarget/REVERT'),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
it('wallet can receive ETH', async () => {
|
||||
await env.web3Wrapper.sendTransactionAsync({
|
||||
to: wallet.address,
|
||||
from: owner,
|
||||
value: 1,
|
||||
});
|
||||
const bal = await env.web3Wrapper.getBalanceInWeiAsync(wallet.address);
|
||||
expect(bal).to.bignumber.eq(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('executeDelegateCall()', () => {
|
||||
it('non-owner cannot call executeDelegateCall()', async () => {
|
||||
const notOwner = randomAddress();
|
||||
const tx = wallet.executeDelegateCall(randomAddress(), hexUtils.random()).callAsync({ from: notOwner });
|
||||
return expect(tx).to.revertWith(new OwnableRevertErrors.OnlyOwnerError(notOwner));
|
||||
});
|
||||
|
||||
it('owner can call executeDelegateCall()', async () => {
|
||||
const targetData = hexUtils.random(128);
|
||||
const receipt = await wallet
|
||||
.executeDelegateCall(callTarget.address, targetData)
|
||||
.awaitTransactionSuccessAsync({ from: owner });
|
||||
verifyEventsFromLogs(
|
||||
receipt.logs,
|
||||
[
|
||||
{
|
||||
context: wallet.address,
|
||||
sender: owner,
|
||||
data: targetData,
|
||||
value: constants.ZERO_AMOUNT,
|
||||
},
|
||||
],
|
||||
TestCallTargetEvents.CallTargetCalled,
|
||||
);
|
||||
});
|
||||
|
||||
it('executeDelegateCall() is payable', async () => {
|
||||
const targetData = hexUtils.random(128);
|
||||
const callValue = getRandomInteger(1, '1e18');
|
||||
const receipt = await wallet
|
||||
.executeDelegateCall(callTarget.address, targetData)
|
||||
.awaitTransactionSuccessAsync({ from: owner, value: callValue });
|
||||
verifyEventsFromLogs(
|
||||
receipt.logs,
|
||||
[
|
||||
{
|
||||
context: wallet.address,
|
||||
sender: owner,
|
||||
data: targetData,
|
||||
value: callValue,
|
||||
},
|
||||
],
|
||||
TestCallTargetEvents.CallTargetCalled,
|
||||
);
|
||||
});
|
||||
|
||||
it('wallet returns call result', async () => {
|
||||
const result = await wallet
|
||||
.executeDelegateCall(callTarget.address, hexUtils.random(128))
|
||||
.callAsync({ from: owner });
|
||||
expect(result).to.eq(TARGET_RETURN_VALUE);
|
||||
});
|
||||
|
||||
it('wallet wraps call revert', async () => {
|
||||
const tx = wallet.executeDelegateCall(callTarget.address, REVERTING_DATA).callAsync({ from: owner });
|
||||
return expect(tx).to.revertWith(
|
||||
new ZeroExRevertErrors.Wallet.WalletExecuteDelegateCallFailedError(
|
||||
wallet.address,
|
||||
callTarget.address,
|
||||
REVERTING_DATA,
|
||||
new StringRevertError('TestCallTarget/REVERT'),
|
||||
),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
@@ -103,7 +103,6 @@ export * from '../test/generated-wrappers/log_metadata_transformer';
|
||||
export * from '../test/generated-wrappers/meta_transactions_feature';
|
||||
export * from '../test/generated-wrappers/mixin_aave_v2';
|
||||
export * from '../test/generated-wrappers/mixin_balancer';
|
||||
export * from '../test/generated-wrappers/mixin_balancer_v2';
|
||||
export * from '../test/generated-wrappers/mixin_balancer_v2_batch';
|
||||
export * from '../test/generated-wrappers/mixin_bancor';
|
||||
export * from '../test/generated-wrappers/mixin_bancor_v3';
|
||||
@@ -151,8 +150,6 @@ export * from '../test/generated-wrappers/permissionless_transformer_deployer';
|
||||
export * from '../test/generated-wrappers/polygon_bridge_adapter';
|
||||
export * from '../test/generated-wrappers/positive_slippage_fee_transformer';
|
||||
export * from '../test/generated-wrappers/simple_function_registry_feature';
|
||||
export * from '../test/generated-wrappers/test_bridge';
|
||||
export * from '../test/generated-wrappers/test_call_target';
|
||||
export * from '../test/generated-wrappers/test_curve';
|
||||
export * from '../test/generated-wrappers/test_delegate_caller';
|
||||
export * from '../test/generated-wrappers/test_fee_collector_controller';
|
||||
@@ -198,7 +195,6 @@ export * from '../test/generated-wrappers/test_uniswap_v3_feature';
|
||||
export * from '../test/generated-wrappers/test_uniswap_v3_pool';
|
||||
export * from '../test/generated-wrappers/test_weth';
|
||||
export * from '../test/generated-wrappers/test_weth_transformer_host';
|
||||
export * from '../test/generated-wrappers/test_zero_ex_feature';
|
||||
export * from '../test/generated-wrappers/transform_erc20_feature';
|
||||
export * from '../test/generated-wrappers/transformer';
|
||||
export * from '../test/generated-wrappers/transformer_deployer';
|
||||
|
@@ -1,96 +0,0 @@
|
||||
import { blockchainTests, constants, expect, verifyEventsFromLogs } from '@0x/contracts-test-utils';
|
||||
import { BigNumber, ZeroExRevertErrors } from '@0x/utils';
|
||||
|
||||
import { ZeroExContract } from '../src/wrappers';
|
||||
|
||||
import { artifacts } from './artifacts';
|
||||
import { initialMigrateAsync } from './utils/migration';
|
||||
import {
|
||||
IFeatureContract,
|
||||
IOwnableFeatureContract,
|
||||
ISimpleFunctionRegistryFeatureContract,
|
||||
TestZeroExFeatureContract,
|
||||
TestZeroExFeatureEvents,
|
||||
} from './wrappers';
|
||||
|
||||
blockchainTests.resets('ZeroEx contract', env => {
|
||||
let owner: string;
|
||||
let zeroEx: ZeroExContract;
|
||||
let ownable: IOwnableFeatureContract;
|
||||
let registry: ISimpleFunctionRegistryFeatureContract;
|
||||
let testFeature: TestZeroExFeatureContract;
|
||||
|
||||
before(async () => {
|
||||
[owner] = await env.getAccountAddressesAsync();
|
||||
zeroEx = await initialMigrateAsync(owner, env.provider, env.txDefaults);
|
||||
ownable = new IOwnableFeatureContract(zeroEx.address, env.provider, env.txDefaults);
|
||||
registry = new ISimpleFunctionRegistryFeatureContract(zeroEx.address, env.provider, env.txDefaults);
|
||||
testFeature = new TestZeroExFeatureContract(zeroEx.address, env.provider, env.txDefaults);
|
||||
// Register test features.
|
||||
const testFeatureImpl = await TestZeroExFeatureContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TestZeroExFeature,
|
||||
env.provider,
|
||||
env.txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
for (const fn of ['payableFn', 'notPayableFn', 'internalFn']) {
|
||||
await registry
|
||||
.extend(testFeature.getSelector(fn), testFeatureImpl.address)
|
||||
.awaitTransactionSuccessAsync({ from: owner });
|
||||
}
|
||||
});
|
||||
|
||||
it('can receive ether', async () => {
|
||||
const txHash = await env.web3Wrapper.sendTransactionAsync({
|
||||
from: owner,
|
||||
to: zeroEx.address,
|
||||
data: constants.NULL_BYTES,
|
||||
value: 1,
|
||||
});
|
||||
await env.web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
});
|
||||
|
||||
it('can attach ether to a call', async () => {
|
||||
const wei = Math.floor(Math.random() * 100 + 1);
|
||||
const receipt = await testFeature.payableFn().awaitTransactionSuccessAsync({ value: wei });
|
||||
verifyEventsFromLogs(receipt.logs, [{ value: new BigNumber(wei) }], TestZeroExFeatureEvents.PayableFnCalled);
|
||||
});
|
||||
|
||||
it('reverts when attaching ether to a non-payable function', async () => {
|
||||
const wei = Math.floor(Math.random() * 100 + 1);
|
||||
const tx = testFeature.notPayableFn().awaitTransactionSuccessAsync({ value: wei });
|
||||
// This will cause an empty revert.
|
||||
return expect(tx).to.be.rejectedWith('revert');
|
||||
});
|
||||
|
||||
it('reverts when calling an unimplmented function', async () => {
|
||||
const selector = testFeature.getSelector('unimplmentedFn');
|
||||
const tx = testFeature.unimplmentedFn().awaitTransactionSuccessAsync();
|
||||
return expect(tx).to.revertWith(new ZeroExRevertErrors.Proxy.NotImplementedError(selector));
|
||||
});
|
||||
|
||||
it('reverts when calling an internal function', async () => {
|
||||
const tx = testFeature.internalFn().awaitTransactionSuccessAsync({ from: owner });
|
||||
return expect(tx).to.revertWith(new ZeroExRevertErrors.Common.OnlyCallableBySelfError(owner));
|
||||
});
|
||||
|
||||
describe('getFunctionImplementation()', () => {
|
||||
it('returns the correct implementations of the initial features', async () => {
|
||||
const ownableSelectors = [ownable.getSelector('transferOwnership')];
|
||||
const registrySelectors = [
|
||||
registry.getSelector('rollback'),
|
||||
registry.getSelector('extend'),
|
||||
// registry.getSelector('extendSelf'),
|
||||
];
|
||||
const selectors = [...ownableSelectors, ...registrySelectors];
|
||||
const impls = await Promise.all(selectors.map(s => zeroEx.getFunctionImplementation(s).callAsync()));
|
||||
for (let i = 0; i < impls.length; ++i) {
|
||||
const selector = selectors[i];
|
||||
const impl = impls[i];
|
||||
const feat = new IFeatureContract(impl, env.provider, env.txDefaults);
|
||||
const featName = ownableSelectors.includes(selector) ? 'Ownable' : 'SimpleFunctionRegistry';
|
||||
expect(await feat.FEATURE_NAME().callAsync()).to.eq(featName);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
52
contracts/zero-ex/tests/BaseTest.sol
Normal file
52
contracts/zero-ex/tests/BaseTest.sol
Normal file
@@ -0,0 +1,52 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
/*
|
||||
|
||||
Copyright 2023 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 "forge-std/Test.sol";
|
||||
import "../contracts/src/ZeroEx.sol";
|
||||
import "../contracts/src/migrations/InitialMigration.sol";
|
||||
|
||||
contract BaseTest is Test {
|
||||
address payable internal account1 = payable(vm.addr(1));
|
||||
address payable internal account2 = payable(vm.addr(2));
|
||||
address payable internal account3 = payable(vm.addr(3));
|
||||
|
||||
constructor() public {
|
||||
vm.deal(account1, 1e20);
|
||||
vm.deal(account2, 1e20);
|
||||
vm.deal(account3, 1e20);
|
||||
}
|
||||
|
||||
function getZeroExTestProxy(address payable owner) public returns (ZeroEx zeroEx) {
|
||||
InitialMigration migrator = new InitialMigration(owner);
|
||||
zeroEx = new ZeroEx(address(migrator));
|
||||
SimpleFunctionRegistryFeature registry = new SimpleFunctionRegistryFeature();
|
||||
OwnableFeature ownable = new OwnableFeature();
|
||||
|
||||
vm.startPrank(owner);
|
||||
migrator.initializeZeroEx(
|
||||
owner,
|
||||
zeroEx,
|
||||
InitialMigration.BootstrapFeatures({registry: registry, ownable: ownable})
|
||||
);
|
||||
vm.stopPrank();
|
||||
}
|
||||
}
|
147
contracts/zero-ex/tests/FlashWalletTest.t.sol
Normal file
147
contracts/zero-ex/tests/FlashWalletTest.t.sol
Normal file
@@ -0,0 +1,147 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
/*
|
||||
|
||||
Copyright 2023 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 "./BaseTest.sol";
|
||||
import "../contracts/src/external/FlashWallet.sol";
|
||||
import "./mocks/TestCallTarget.sol";
|
||||
|
||||
contract FlashWalletTest is BaseTest {
|
||||
address public owner = account1;
|
||||
FlashWallet public wallet;
|
||||
TestCallTarget public callTarget;
|
||||
|
||||
bytes public constant MAGIC_BYTES = hex"1234567800000000000000000000000000000000000000000000000000000000";
|
||||
bytes public constant REVERTING_DATA = hex"1337";
|
||||
|
||||
event CallTargetCalled(address sender, bytes data, uint256 value);
|
||||
|
||||
function setUp() public {
|
||||
vm.startPrank(owner);
|
||||
|
||||
wallet = new FlashWallet();
|
||||
callTarget = new TestCallTarget();
|
||||
|
||||
vm.stopPrank();
|
||||
}
|
||||
|
||||
function test_OwnedByDeployer() public {
|
||||
assertEq(wallet.owner(), account1);
|
||||
}
|
||||
|
||||
function test_executeCall_nonOwnerCannotExecute() public {
|
||||
vm.expectRevert(LibOwnableRichErrorsV06.OnlyOwnerError(account2, owner));
|
||||
vm.startPrank(account2);
|
||||
wallet.executeCall(address(callTarget), "0x1", 123);
|
||||
}
|
||||
|
||||
function test_executeCall_ownerCanCallWithZeroValue() public {
|
||||
vm.expectEmit(true, true, true, true);
|
||||
emit CallTargetCalled(address(wallet), "0x1", 0);
|
||||
vm.startPrank(owner);
|
||||
wallet.executeCall(address(callTarget), "0x1", 0);
|
||||
}
|
||||
|
||||
function test_executeCall_ownerCanCallWithNonZeroValue() public {
|
||||
vm.expectEmit(true, true, true, true);
|
||||
emit CallTargetCalled(address(wallet), "0x1", 1);
|
||||
vm.startPrank(owner);
|
||||
wallet.executeCall{value: 1}(address(callTarget), "0x1", 1);
|
||||
}
|
||||
|
||||
function test_executeCall_ownerCanTransferLessETHThanAttached() public {
|
||||
vm.expectEmit(true, true, true, true);
|
||||
emit CallTargetCalled(address(wallet), "0x1", 1);
|
||||
vm.startPrank(owner);
|
||||
// Send value 2 but execute call with 1
|
||||
wallet.executeCall{value: 2}(address(callTarget), "0x1", 1);
|
||||
}
|
||||
|
||||
function test_executeCall_walletReturnsCallResult() public {
|
||||
vm.startPrank(owner);
|
||||
bytes memory result = wallet.executeCall(address(callTarget), "0x1", 0);
|
||||
assertEq0(result, MAGIC_BYTES);
|
||||
}
|
||||
|
||||
function test_executeCall_walletWrapsCallRevert() public {
|
||||
(, bytes memory resultData) = address(callTarget).call(REVERTING_DATA);
|
||||
bytes memory error = LibWalletRichErrors.WalletExecuteCallFailedError(
|
||||
address(wallet),
|
||||
address(callTarget),
|
||||
REVERTING_DATA,
|
||||
0,
|
||||
resultData
|
||||
);
|
||||
|
||||
vm.expectRevert(error);
|
||||
|
||||
vm.startPrank(owner);
|
||||
wallet.executeCall(address(callTarget), REVERTING_DATA, 0);
|
||||
}
|
||||
|
||||
function test_executeCall_walletCanReceiveETH() public {
|
||||
vm.startPrank(owner);
|
||||
(bool sent, ) = address(wallet).call{value: 1}("");
|
||||
assertTrue(sent, "Failed to send ETH to wallet");
|
||||
assertEq(address(wallet).balance, 1);
|
||||
}
|
||||
|
||||
function test_executeDelegateCall_nonOwnerCannotExecute() public {
|
||||
vm.expectRevert(LibOwnableRichErrorsV06.OnlyOwnerError(account2, owner));
|
||||
vm.startPrank(account2);
|
||||
wallet.executeDelegateCall(address(callTarget), "0x1");
|
||||
}
|
||||
|
||||
function test_executeDelegateCall_ownerCanExecute() public {
|
||||
vm.expectEmit(true, true, true, true);
|
||||
emit CallTargetCalled(owner, "0x1", 0);
|
||||
vm.startPrank(owner);
|
||||
wallet.executeDelegateCall(address(callTarget), "0x1");
|
||||
}
|
||||
|
||||
function test_executeDelegateCall_ownerCanExecuteWithValue() public {
|
||||
vm.expectEmit(true, true, true, true);
|
||||
emit CallTargetCalled(owner, "0x1", 1);
|
||||
vm.startPrank(owner);
|
||||
wallet.executeDelegateCall{value: 1}(address(callTarget), "0x1");
|
||||
}
|
||||
|
||||
function test_executeDelegateCall_walletReturnsCallResult() public {
|
||||
vm.startPrank(owner);
|
||||
bytes memory result = wallet.executeDelegateCall(address(callTarget), "0x1");
|
||||
assertEq0(result, MAGIC_BYTES);
|
||||
}
|
||||
|
||||
function test_executeDelegateCall_walletWrapsCallRevert() public {
|
||||
(, bytes memory resultData) = address(callTarget).call(REVERTING_DATA);
|
||||
bytes memory error = LibWalletRichErrors.WalletExecuteDelegateCallFailedError(
|
||||
address(wallet),
|
||||
address(callTarget),
|
||||
REVERTING_DATA,
|
||||
resultData
|
||||
);
|
||||
|
||||
vm.expectRevert(error);
|
||||
|
||||
vm.startPrank(owner);
|
||||
wallet.executeDelegateCall(address(callTarget), REVERTING_DATA);
|
||||
}
|
||||
}
|
93
contracts/zero-ex/tests/ZeroExTest.t.sol
Normal file
93
contracts/zero-ex/tests/ZeroExTest.t.sol
Normal file
@@ -0,0 +1,93 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
/*
|
||||
|
||||
Copyright 2023 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 "./BaseTest.sol";
|
||||
import "../contracts/src/ZeroEx.sol";
|
||||
import "./mocks/TestZeroExFeature.sol";
|
||||
|
||||
contract ZeroExTest is BaseTest {
|
||||
address payable public owner = account1;
|
||||
ZeroEx public zeroEx;
|
||||
IOwnableFeature public ownable;
|
||||
ISimpleFunctionRegistryFeature public registry;
|
||||
TestZeroExFeature public testFeature;
|
||||
|
||||
event PayableFnCalled(uint256 value);
|
||||
|
||||
function setUp() public {
|
||||
zeroEx = getZeroExTestProxy(owner);
|
||||
ownable = IOwnableFeature(address(zeroEx));
|
||||
registry = ISimpleFunctionRegistryFeature(address(zeroEx));
|
||||
TestZeroExFeature testFeatureImplementation = new TestZeroExFeature();
|
||||
testFeature = TestZeroExFeature(address(zeroEx));
|
||||
|
||||
// Register the test feature function on the zero ex proxy
|
||||
vm.startPrank(owner);
|
||||
registry.extend(testFeature.payableFn.selector, address(testFeatureImplementation));
|
||||
registry.extend(testFeature.notPayableFn.selector, address(testFeatureImplementation));
|
||||
registry.extend(testFeature.internalFn.selector, address(testFeatureImplementation));
|
||||
vm.stopPrank();
|
||||
}
|
||||
|
||||
function test_canReceiveETH() public {
|
||||
address(zeroEx).call{value: 1}("");
|
||||
assertEq(address(zeroEx).balance, 1);
|
||||
}
|
||||
|
||||
function test_canAttachETHtoACall() public {
|
||||
vm.expectEmit(false, false, false, true);
|
||||
emit PayableFnCalled(123);
|
||||
testFeature.payableFn{value: 123}();
|
||||
}
|
||||
|
||||
function test_revertsWhenAttachingETHToANonPayableFunction() public {
|
||||
vm.expectRevert();
|
||||
address(testFeature).call{value: 123}("notPayableFn()");
|
||||
}
|
||||
|
||||
function test_revertWhenCallingAnUnimplementedFunction() public {
|
||||
bytes memory error = LibProxyRichErrors.NotImplementedError(testFeature.unimplementedFn.selector);
|
||||
vm.expectRevert(error);
|
||||
testFeature.unimplementedFn();
|
||||
}
|
||||
|
||||
function test_revertsWhenCallingInternalFunction() public {
|
||||
bytes memory error = LibCommonRichErrors.OnlyCallableBySelfError(owner);
|
||||
vm.expectRevert(error);
|
||||
vm.startPrank(owner);
|
||||
testFeature.internalFn();
|
||||
}
|
||||
|
||||
function test_getFunctionImplementation_returnsTheCorrectFeaturesImplementations() public {
|
||||
bytes4 transferOwnershipSelector = ownable.transferOwnership.selector;
|
||||
address transferOwnershipImplementation = zeroEx.getFunctionImplementation(transferOwnershipSelector);
|
||||
assertEq(IFeature(transferOwnershipImplementation).FEATURE_NAME(), "Ownable");
|
||||
|
||||
bytes4 rollbackSelector = registry.rollback.selector;
|
||||
address rollbackImplementation = zeroEx.getFunctionImplementation(rollbackSelector);
|
||||
assertEq(IFeature(rollbackImplementation).FEATURE_NAME(), "SimpleFunctionRegistry");
|
||||
|
||||
bytes4 extendSelector = registry.extend.selector;
|
||||
address extendImplementation = zeroEx.getFunctionImplementation(extendSelector);
|
||||
assertEq(IFeature(extendImplementation).FEATURE_NAME(), "SimpleFunctionRegistry");
|
||||
}
|
||||
}
|
@@ -21,16 +21,16 @@ pragma solidity ^0.6.5;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract TestCallTarget {
|
||||
event CallTargetCalled(address context, address sender, bytes data, uint256 value);
|
||||
event CallTargetCalled(address sender, bytes data, uint256 value);
|
||||
|
||||
bytes4 private constant MAGIC_BYTES = 0x12345678;
|
||||
bytes private constant REVERTING_DATA = hex"1337";
|
||||
bytes4 public constant MAGIC_BYTES = 0x12345678;
|
||||
bytes public constant REVERTING_DATA = hex"1337";
|
||||
|
||||
fallback() external payable {
|
||||
if (keccak256(msg.data) == keccak256(REVERTING_DATA)) {
|
||||
revert("TestCallTarget/REVERT");
|
||||
}
|
||||
emit CallTargetCalled(address(this), msg.sender, msg.data, msg.value);
|
||||
emit CallTargetCalled(msg.sender, msg.data, msg.value);
|
||||
bytes4 rval = MAGIC_BYTES;
|
||||
assembly {
|
||||
mstore(0, rval)
|
@@ -20,8 +20,8 @@
|
||||
pragma solidity ^0.6.5;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../src/fixins/FixinCommon.sol";
|
||||
import "../src/ZeroEx.sol";
|
||||
import "../../contracts/src/fixins/FixinCommon.sol";
|
||||
import "../../contracts/src/ZeroEx.sol";
|
||||
|
||||
contract TestZeroExFeature is FixinCommon {
|
||||
event PayableFnCalled(uint256 value);
|
||||
@@ -35,7 +35,7 @@ contract TestZeroExFeature is FixinCommon {
|
||||
emit NotPayableFnCalled();
|
||||
}
|
||||
|
||||
function unimplmentedFn() external {}
|
||||
function unimplementedFn() external {}
|
||||
|
||||
function internalFn() external onlySelf {}
|
||||
}
|
@@ -1,96 +0,0 @@
|
||||
/**
|
||||
* Use this file to configure your truffle project. It's seeded with some
|
||||
* common settings for different networks and features like migrations,
|
||||
* compilation and testing. Uncomment the ones you need or modify
|
||||
* them to suit your project as necessary.
|
||||
*
|
||||
* More information about configuration can be found at:
|
||||
*
|
||||
* truffleframework.com/docs/advanced/configuration
|
||||
*
|
||||
* To deploy via Infura you'll need a wallet provider (like truffle-hdwallet-provider)
|
||||
* to sign your transactions before they're sent to a remote public node. Infura accounts
|
||||
* are available for free at: infura.io/register.
|
||||
*
|
||||
* You'll also need a mnemonic - the twelve word phrase the wallet uses to generate
|
||||
* public/private key pairs. If you're publishing your code to GitHub make sure you load this
|
||||
* phrase from a file you've .gitignored so it doesn't accidentally become public.
|
||||
*
|
||||
*/
|
||||
|
||||
// const HDWalletProvider = require('truffle-hdwallet-provider');
|
||||
// const infuraKey = "fj4jll3k.....";
|
||||
//
|
||||
// const fs = require('fs');
|
||||
// const mnemonic = fs.readFileSync(".secret").toString().trim();
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* Networks define how you connect to your ethereum client and let you set the
|
||||
* defaults web3 uses to send transactions. If you don't specify one truffle
|
||||
* will spin up a development blockchain for you on port 9545 when you
|
||||
* run `develop` or `test`. You can ask a truffle command to use a specific
|
||||
* network from the command line, e.g
|
||||
*
|
||||
* $ truffle test --network <network-name>
|
||||
*/
|
||||
|
||||
networks: {
|
||||
// Useful for testing. The `development` name is special - truffle uses it by default
|
||||
// if it's defined here and no other network is specified at the command line.
|
||||
// You should run a client (like ganache-cli, geth or parity) in a separate terminal
|
||||
// tab if you use this network and you must also set the `host`, `port` and `network_id`
|
||||
// options below to some value.
|
||||
//
|
||||
// development: {
|
||||
// host: "127.0.0.1", // Localhost (default: none)
|
||||
// port: 8545, // Standard Ethereum port (default: none)
|
||||
// network_id: "*", // Any network (default: none)
|
||||
// },
|
||||
// Another network with more advanced options...
|
||||
// advanced: {
|
||||
// port: 8777, // Custom port
|
||||
// network_id: 1342, // Custom network
|
||||
// gas: 8500000, // Gas sent with each transaction (default: ~6700000)
|
||||
// gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei)
|
||||
// from: <address>, // Account to send txs from (default: accounts[0])
|
||||
// websockets: true // Enable EventEmitter interface for web3 (default: false)
|
||||
// },
|
||||
// Useful for deploying to a public network.
|
||||
// NB: It's important to wrap the provider as a function.
|
||||
// ropsten: {
|
||||
// provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`),
|
||||
// network_id: 3, // Ropsten's id
|
||||
// gas: 5500000, // Ropsten has a lower block limit than mainnet
|
||||
// confirmations: 2, // # of confs to wait between deployments. (default: 0)
|
||||
// timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
|
||||
// skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
|
||||
// },
|
||||
// Useful for private networks
|
||||
// private: {
|
||||
// provider: () => new HDWalletProvider(mnemonic, `https://network.io`),
|
||||
// network_id: 2111, // This network is yours, in the cloud.
|
||||
// production: true // Treats this network as if it was a public net. (default: false)
|
||||
// }
|
||||
},
|
||||
|
||||
// Set default mocha options here, use special reporters etc.
|
||||
mocha: {
|
||||
// timeout: 100000
|
||||
},
|
||||
|
||||
// Configure your compilers
|
||||
compilers: {
|
||||
solc: {
|
||||
version: '0.6.5',
|
||||
settings: {
|
||||
evmVersion: 'istanbul',
|
||||
optimizer: {
|
||||
enabled: true,
|
||||
runs: 1000000,
|
||||
details: { yul: true, deduplicate: true, cse: true, constantOptimizer: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
@@ -142,7 +142,6 @@
|
||||
"test/generated-artifacts/MetaTransactionsFeature.json",
|
||||
"test/generated-artifacts/MixinAaveV2.json",
|
||||
"test/generated-artifacts/MixinBalancer.json",
|
||||
"test/generated-artifacts/MixinBalancerV2.json",
|
||||
"test/generated-artifacts/MixinBalancerV2Batch.json",
|
||||
"test/generated-artifacts/MixinBancor.json",
|
||||
"test/generated-artifacts/MixinBancorV3.json",
|
||||
@@ -190,8 +189,6 @@
|
||||
"test/generated-artifacts/PolygonBridgeAdapter.json",
|
||||
"test/generated-artifacts/PositiveSlippageFeeTransformer.json",
|
||||
"test/generated-artifacts/SimpleFunctionRegistryFeature.json",
|
||||
"test/generated-artifacts/TestBridge.json",
|
||||
"test/generated-artifacts/TestCallTarget.json",
|
||||
"test/generated-artifacts/TestCurve.json",
|
||||
"test/generated-artifacts/TestDelegateCaller.json",
|
||||
"test/generated-artifacts/TestFeeCollectorController.json",
|
||||
@@ -237,7 +234,6 @@
|
||||
"test/generated-artifacts/TestUniswapV3Pool.json",
|
||||
"test/generated-artifacts/TestWeth.json",
|
||||
"test/generated-artifacts/TestWethTransformerHost.json",
|
||||
"test/generated-artifacts/TestZeroExFeature.json",
|
||||
"test/generated-artifacts/TransformERC20Feature.json",
|
||||
"test/generated-artifacts/Transformer.json",
|
||||
"test/generated-artifacts/TransformerDeployer.json",
|
||||
|
@@ -19,14 +19,14 @@ The following contracts are in scope of the bug bounty. Please note that any bug
|
||||
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| **Release** | **Contracts** | **Commit Hash** |
|
||||
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Exchange V4 | * Documentation at `https://protocol.0x.org/en/latest/ <https://protocol.0x.org/en/latest/>`__ | `2cbeb9c <https://github.com/0xProject/protocol/tree/audit/nft-orders-address-findings/contracts/zero-ex/contracts/src>`__ |
|
||||
| | * `ZeroEx.sol <https://github.com/0xProject/protocol/tree/audit/nft-orders-address-findings/contracts/zero-ex/contracts/src/ZeroEx.sol>`__ | |
|
||||
| | * `ZeroExOptimized.sol <https://github.com/0xProject/protocol/tree/audit/nft-orders-address-findings/contracts/zero-ex/contracts/src/ZeroExOptimized.sol>`__ | |
|
||||
| | * `external/*.sol <https://github.com/0xProject/protocol/tree/audit/nft-orders-address-findings/contracts/zero-ex/contracts/src/external>`__ | |
|
||||
| | * `features/**.sol <https://github.com/0xProject/protocol/tree/audit/nft-orders-address-findings/contracts/zero-ex/contracts/src/features>`__ | |
|
||||
| | * `fixins/*.sol <https://github.com/0xProject/protocol/tree/audit/nft-orders-address-findings/contracts/zero-ex/contracts/src/fixins>`__ | |
|
||||
| | * `migrations/*.sol <https://github.com/0xProject/protocol/tree/audit/nft-orders-address-findings/contracts/zero-ex/contracts/src/migrations>`__ | |
|
||||
| | * `storage/*.sol <https://github.com/0xProject/protocol/tree/audit/nft-orders-address-findings/contracts/zero-ex/contracts/src/storage>`__ | |
|
||||
| Exchange V4 | * Documentation at `https://protocol.0x.org/en/latest/ <https://protocol.0x.org/en/latest/>`__ | `c1177416f5 <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts>`__ |
|
||||
| | * `ZeroEx.sol <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src/ZeroEx.sol>`__ | |
|
||||
| | * `ZeroExOptimized.sol <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src/ZeroExOptimized.sol>`__ | |
|
||||
| | * `external/*.sol <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src/external>`__ | |
|
||||
| | * `features/**.sol <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src/features>`__ | |
|
||||
| | * `fixins/*.sol <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src/fixins>`__ | |
|
||||
| | * `migrations/*.sol <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src/migrations>`__ | |
|
||||
| | * `storage/*.sol <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src/storage>`__ | |
|
||||
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Exchange V3 | * `ERC20BridgeProxy.sol <https://github.com/0xProject/0x-monorepo/blob/fb8360edfd4f42f2d2b127b95c156eb1b0daa02b/contracts/asset-proxy/contracts/src/ERC20BridgeProxy.sol>`_ (`spec <https://github.com/0xProject/0x-protocol-specification/blob/master/asset-proxy/erc20-bridge-proxy.md>`__) | `fb8360edfd <https://github.com/0xProject/0x-monorepo/tree/fb8360edfd4f42f2d2b127b95c156eb1b0daa02b/contracts>`__ |
|
||||
| | * `Exchange.sol <https://github.com/0xProject/0x-monorepo/blob/fb8360edfd4f42f2d2b127b95c156eb1b0daa02b/contracts/exchange/contracts/src/Exchange.sol>`__ (`spec <https://github.com/0xProject/0x-protocol-specification/blob/master/v3/v3-specification.md>`__) | |
|
||||
@@ -46,7 +46,7 @@ The following contracts are in scope of the bug bounty. Please note that any bug
|
||||
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| ERC20BridgeProxy | * `ERC20BridgeProxy.sol <https://github.com/0xProject/0x-monorepo/blob/281658ba349a2c5088b40b503998bea5020284a6/contracts/asset-proxy/contracts/src/ERC20BridgeProxy.sol>`__ | `281658ba34 <https://github.com/0xProject/0x-monorepo/tree/281658ba349a2c5088b40b503998bea5020284a6/contracts>`_ |
|
||||
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| ExchangeProxy | * `contracts/src <https://github.com/0xProject/protocol/tree/audit/nft-orders-address-findings/contracts/zero-ex/contracts/src>`__ | `2cbeb9c <https://github.com/0xProject/protocol/tree/audit/nft-orders-address-findings/contracts/zero-ex/contracts/src>`_ |
|
||||
| ExchangeProxy | * `contracts/src <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src>`__ | `c1177416f5 <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src>`_ |
|
||||
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
Bounties
|
||||
|
@@ -18,7 +18,7 @@ Below is a catalog of Features.
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| 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>`__ |
|
||||
| NativeOrdersFeature | Functions for native 0x orders (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>`__ |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
@@ -6,7 +6,7 @@ Governor
|
||||
|
||||
This page is tailored for Exchange V4. For information on governance over past exhcange versions, see `this specification <https://github.com/0xProject/0x-protocol-specification/blob/master/v3/zero-ex-governor.md>`_.
|
||||
|
||||
The ``ZeroExGovernor`` is a time-locked multi-signature wallet that has permission to perform administrative functions within the protocol. Functions are timelocked (see below). Many functions that can be used to mitigate damage in case of emergencies (for example, if a vulnerability is discovered that puts user funds at risk) do not have a timelock.
|
||||
The ``ZeroExGovernor`` is a time-locked multi-signature wallet that has permission to perform administrative functions within the protocol. Functions are timelocked (see below). Many functions that can be used to mitigate damage in case of emergencies (for example, if a vulnerability is discovered that puts user funds at risk) do not have a timelock.
|
||||
|
||||
The ``ZeroExGovernor`` is able to perform the following functions within the protocol:
|
||||
|
||||
@@ -52,7 +52,7 @@ The ``ZeroExGovernor`` can also manage authorizations all permissioned contracts
|
||||
Administering Systems
|
||||
=======================
|
||||
|
||||
The governor owns all permissioned, trusted contracts under the 0x Protocol. Any ``onlyOwner`` function can be executed by the governor. The governor requires 2/3 signatures and is timelocked.
|
||||
The governor owns all permissioned, trusted contracts under the 0x Protocol. Any ``onlyOwner`` function can be executed by the governor. The governor requires 2/3 signatures and is timelocked.
|
||||
|
||||
|
||||
Timelocks
|
||||
@@ -62,16 +62,16 @@ Function timelocks are represented in days, where one day is equivalent to 86,40
|
||||
.. csv-table::
|
||||
:header: "Contract", "Function", "Selector", "Timelock"
|
||||
|
||||
AllowanceTarget, ``addAuthorizedAddress``, ``42f1181e``, 1 day
|
||||
AllowanceTarget, ``addAuthorizedAddress``, ``42f1181e``, 2 days
|
||||
AllowanceTarget, ``removeAuthorizedAddress``, ``70712939``, 0 days
|
||||
AllowanceTarget, ``removeAuthorizedAddressAtIndex``, ``9ad26744``, 0 days
|
||||
Governor, ``registerFunctionCall``, ``751ad560``, 1 day
|
||||
ExchangeProxy, ``extend``, ``6eb224cb``, 1 day
|
||||
ExchangeProxy, ``migrate``, ``261fe679``, 1 day
|
||||
Governor, ``registerFunctionCall``, ``751ad560``, 2 days
|
||||
ExchangeProxy, ``extend``, ``6eb224cb``, 2 days
|
||||
ExchangeProxy, ``migrate``, ``261fe679``, 2 days
|
||||
ExchangeProxy, ``rollback``, ``9db64a40``, 0 days
|
||||
ExchangeProxy, ``setQuoteSigner``, ``<deprecation in progress>``, 1 day
|
||||
ExchangeProxy, ``setTransformerDeployer``, ``87c96419``, 1 day
|
||||
ExchangeProxy, ``transferOwnership``, ``f2fde38b``, 1 day
|
||||
ExchangeProxy, ``setQuoteSigner``, ``<deprecation in progress>``, 2 days
|
||||
ExchangeProxy, ``setTransformerDeployer``, ``87c96419``, 2 days
|
||||
ExchangeProxy, ``transferOwnership``, ``f2fde38b``, 2 days
|
||||
StakingProxy, ``addExchangeAddress``, ``8a2e271a``, 14 days
|
||||
StakingProxy, ``removeExchangeAddress``, ``01e28d84``, 14 days
|
||||
StakingProxy, ``attachStakingContract``, ``66615d56``, 14 days
|
||||
@@ -87,4 +87,4 @@ Function timelocks are represented in days, where one day is equivalent to 86,40
|
||||
ZrxVault, ``addAuthorizedAddress``, ``42f1181e``, 14 days
|
||||
ZrxVault, ``removeAuthorizedAddress``, ``70712939``, 14 days
|
||||
ZrxVault, ``removeAuthorizedAddressAtIndex``, ``9ad26744``, 14 days
|
||||
ZrxVault, ``transferOwnership``, ``f2fde38b``, 14 days
|
||||
ZrxVault, ``transferOwnership``, ``f2fde38b``, 14 days
|
||||
|
@@ -54,7 +54,7 @@ Call ``rollback()`` to revert a function implementation to a prior version in it
|
||||
|
||||
Ownership
|
||||
=========
|
||||
Another Feature, ``InitialMigration``, bootstraps into the proxy is the Ownable feature. This exposes ownership management functions: ``transferOwnership()`` and ``getOwner()``. This feature also enables ubiquitous modifiers such as onlyOwner, so it is an implicit dependency of nearly every other feature.
|
||||
Another Feature, ``InitialMigration``, bootstraps into the proxy is the Ownable feature. This exposes ownership management functions: ``transferOwnership()`` and ``owner()``. This feature also enables ubiquitous modifiers such as onlyOwner, so it is an implicit dependency of nearly every other feature.
|
||||
|
||||
.. code-block:: solidity
|
||||
|
||||
@@ -63,8 +63,9 @@ Another Feature, ``InitialMigration``, bootstraps into the proxy is the Ownable
|
||||
external
|
||||
onlyOwner;
|
||||
|
||||
// Get the owner of this contract.
|
||||
function getOwner()
|
||||
/// @dev Get the owner of this contract.
|
||||
/// @return owner_ The owner of this contract.
|
||||
function owner()
|
||||
external
|
||||
view
|
||||
returns (address owner_);
|
||||
@@ -189,7 +190,7 @@ These involve meaningful behavioral changes, such as new settlement logic, chang
|
||||
|
||||
**Features used by Features**
|
||||
|
||||
Not all features are designed to be exclusively consumed by the public. We can have internal features by applying an onlySelf modifier to the function. We need to be mindful of another class of user: the contract itself. Avoiding missteps on this will require a combination of diligence and good regression test suites.
|
||||
Not all features are designed to be exclusively consumed by the public. We can have internal features by applying an onlySelf modifier to the function. We need to be mindful of another class of user: the contract itself. Avoiding missteps on this will require a combination of diligence and good regression test suites.
|
||||
|
||||
Known Risks
|
||||
===========
|
||||
@@ -213,7 +214,7 @@ Every time we develop a new feature, an entry is appended to the ``LibStorage.St
|
||||
function getStorageSlot(StorageId id) internal pure returns (uint256) {
|
||||
return (uint256(id) + 1) << 128;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Given Solidity’s `storage layout rules <https://solidity.readthedocs.io/en/v0.6.6/miscellaneous.html)>`_, subsequent storage buckets should always be 2^128 slots apart, which means buckets can have 2^128 flattened inline fields before overlapping. While it’s not impossible for buckets to overlap with this pattern, it should be extremely unlikely if we follow it closely. Maps and arrays are not stored sequentially but should also be affected by their base slot value to make collisions unlikely.
|
||||
|
||||
@@ -254,4 +255,4 @@ Functions can be re-entered by default; those secured by the ``nonReentrant`` mo
|
||||
|
||||
**Colliding Function Selectors**
|
||||
|
||||
We manually ensure that function selectors do not collide during PR's. See the `Feature Checklist <./features.html#best-practices>`_ for a complete list of our best practices on Feature Development.
|
||||
We manually ensure that function selectors do not collide during PR's. See the `Feature Checklist <./features.html#best-practices>`_ for a complete list of our best practices on Feature Development.
|
||||
|
21
package.json
21
package.json
@@ -14,10 +14,9 @@
|
||||
"ganache": "ganache-cli -p 8545 --gasLimit 10000000 --networkId 50 -m \"${npm_package_config_mnemonic}\"",
|
||||
"prettier": "prettier --write '**/*.{ts,tsx,json,sol}' --config .prettierrc",
|
||||
"prettier:ci": "prettier --list-different '**/*.{ts,tsx,json,sol}' --config .prettierrc",
|
||||
"report_coverage": "lcov-result-merger './packages/*/coverage/lcov.info' | coveralls",
|
||||
"test:installation": "node ./node_modules/@0x/monorepo-scripts/lib/test_installation.js",
|
||||
"test:installation:local": "IS_LOCAL_PUBLISH=true node ./node_modules/@0x/monorepo-scripts/lib/test_installation.js",
|
||||
"test:publish:circleci": "yarn npm-cli-login -u test -p test -e test@example.com -r http://localhost:4873 && IS_LOCAL_PUBLISH=true run-s script:publish test:installation:local",
|
||||
"test:publish:ci": "yarn npm-cli-login -u test -p test -e test@example.com -r http://localhost:4873 && IS_LOCAL_PUBLISH=true run-s script:publish test:installation:local",
|
||||
"run:publish": "run-s install:all script:prepublish_checks rebuild script:publish",
|
||||
"run:publish:local": "IS_LOCAL_PUBLISH=true yarn run:publish",
|
||||
"run:publish:gha": "run-s build script:publish:gha",
|
||||
@@ -34,7 +33,7 @@
|
||||
"watch:ts": "tsc -b -w",
|
||||
"clean": "wsrun --fast-exit -r --parallel --exclude-missing -p $PKG -c clean",
|
||||
"contracts:watch": "wsrun --parallel --exclude-missing -p $PKG -c watch",
|
||||
"lint:contracts": "npx solhint contracts/**/*.sol",
|
||||
"lint:contracts": "yarn solhint 'contracts/**/*.sol'",
|
||||
"remove_node_modules": "lerna clean --yes; rm -rf node_modules",
|
||||
"rebuild": "run-s clean build",
|
||||
"test": "wsrun --fast-exit --serial --exclude-missing -p $(echo $(echo ${npm_package_config_contractsPackages} ${npm_package_config_nonContractPackages} | tr ' ' '\n' | sort | uniq) ${npm_package_config_ignoreTestsForPackages} | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ') -c test",
|
||||
@@ -45,14 +44,23 @@
|
||||
"generate_doc": "node ./node_modules/@0x/monorepo-scripts/lib/doc_generate.js --config ./doc-gen-config.json",
|
||||
"upload_md_docs": "aws s3 rm --recursive s3://docs-markdown; wsrun --exclude-missing -c s3:sync_md_docs",
|
||||
"diff_md_docs:ci": "wsrun --exclude-missing -c diff_docs",
|
||||
"test:generate_docs:circleci": "for i in ${npm_package_config_packagesWithDocPages}; do yarn generate_doc --package $i || break -1; done;",
|
||||
"test:generate_docs:ci": "for i in ${npm_package_config_packagesWithDocPages}; do yarn generate_doc --package $i || break -1; done;",
|
||||
"bundlewatch": "bundlewatch",
|
||||
"lint:ts": "wsrun --fast-exit --parallel --exclude-missing -p $PKG -c lint",
|
||||
"lint": "yarn lint:ts && yarn lint:contracts",
|
||||
"upgrade_tools": "node node_modules/@0x/monorepo-scripts/lib/upgrade_deps.js -p '@0x/abi-gen|@0x/assert|@0x/base-contract|@0x/contracts-gen|@0x/dev-utils|@0x/json-schemas|@0x/monorepo-scripts|@0x/sol-compiler|@0x/sol-coverage|@0x/sol-doc|@0x/sol-profiler|@0x/sol-resolver|@0x/sol-trace|@0x/sol-tracing-utils|@0x/subproviders|@0x/types|@0x/typescript-typings|@0x/utils|@0x/verdaccio|@0x/web3-wrapper|ethereum-types'",
|
||||
"upgrade_tools": "node node_modules/@0x/monorepo-scripts/lib/upgrade_deps.js -p '@0x/abi-gen|@0x/assert|@0x/base-contract|@0x/contracts-gen|@0x/dev-utils|@0x/json-schemas|@0x/monorepo-scripts|@0x/sol-compiler|@0x/sol-doc|@0x/sol-profiler|@0x/sol-resolver|@0x/sol-trace|@0x/sol-tracing-utils|@0x/subproviders|@0x/types|@0x/typescript-typings|@0x/utils|@0x/verdaccio|@0x/web3-wrapper|ethereum-types'",
|
||||
"upgrade_deps": "node node_modules/@0x/monorepo-scripts/lib/upgrade_deps.js",
|
||||
"verdaccio": "docker run --rm -i -p 4873:4873 0xorg/verdaccio"
|
||||
},
|
||||
"lint-staged": {
|
||||
"**/*.{ts,tsx,json}": [
|
||||
"prettier --write"
|
||||
],
|
||||
"**/*.sol": [
|
||||
"prettier --write",
|
||||
"solhint --fix"
|
||||
]
|
||||
},
|
||||
"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",
|
||||
@@ -70,8 +78,9 @@
|
||||
"check-md": "^1.0.2",
|
||||
"coveralls": "^3.0.0",
|
||||
"ganache-cli": "6.12.2",
|
||||
"lcov-result-merger": "^3.0.0",
|
||||
"husky": "^8.0.3",
|
||||
"lerna": "^3.0.0-beta.25",
|
||||
"lint-staged": "^13.1.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"prettier": "2.7.1",
|
||||
"prettier-plugin-solidity": "^1.0.0",
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,4 @@
|
||||
|
||||
<!--
|
||||
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
Edit the package's CHANGELOG.json file only.
|
||||
@@ -5,237 +6,188 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v8.0.1 - _January 23, 2023_
|
||||
|
||||
* Dependencies updated
|
||||
## v8.0.0 - _December 12, 2022_
|
||||
|
||||
* Remove Kovan and Arbitrum Rinkeby as they are no longer supported. (#630)
|
||||
## v7.4.1 - _November 23, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v7.4.0 - _November 15, 2022_
|
||||
|
||||
* Upgrade Polygon FillQuoteTransformer to support Solidly (and its forks). (#616)
|
||||
|
||||
## v7.3.0 - _November 5, 2022_
|
||||
|
||||
* Upgrade `AffiliateFeeTransformer`, `PayTakerTransformer`, and `PositiveSlippageFeeTransformer` to support smart contract wallets (#615)
|
||||
|
||||
## v7.2.0 - _November 2, 2022_
|
||||
|
||||
* Add RFQTV2 to Mumbai (#611)
|
||||
|
||||
## v7.1.0 - _October 24, 2022_
|
||||
|
||||
* Add `BalancerV2Batch` support in `FantomBridgeAdapter` (#607)
|
||||
|
||||
## v7.0.0 - _October 21, 2022_
|
||||
|
||||
* Updated Ethereum FQT to enable RFQT V2 (#604)
|
||||
* updated changelog (#605)
|
||||
|
||||
## v6.25.0 - _October 11, 2022_
|
||||
|
||||
* Remove Ropsten and Rinkeby addresses (#597)
|
||||
|
||||
## v6.24.0 - _October 5, 2022_
|
||||
|
||||
* Add missing zeroExGovernor for Arbitrum (#583)
|
||||
|
||||
## v6.23.4 - _September 21, 2022_
|
||||
|
||||
* New FQT for Arbitrum with Nerve (#581)
|
||||
|
||||
## v6.23.3 - _September 12, 2022_
|
||||
|
||||
* New FQT for Optimism with BalV2 (#577)
|
||||
* Add balV2/batch to opt bridge adapter code (#578)
|
||||
|
||||
## v6.23.2 - _September 7, 2022_
|
||||
|
||||
* New FQT for arbitrum again (#574)
|
||||
|
||||
## v6.23.1 - _September 2, 2022_
|
||||
|
||||
* New FQT for arbitrum (#572)
|
||||
|
||||
## v6.23.0 - _September 1, 2022_
|
||||
|
||||
* Remove contract addresses that are no longer needed (#564)
|
||||
* Change WETH address in contract-addresses (#571)
|
||||
|
||||
## 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
|
||||
|
||||
## v6.19.1 - _August 9, 2022_
|
||||
|
||||
* Fix lowercase addresses (#543)
|
||||
|
||||
## v6.19.0 - _August 6, 2022_
|
||||
|
||||
* Goerli and Mumbai updated verified contracts addresses (#537)
|
||||
|
||||
## v6.17.0 - _July 27, 2022_
|
||||
|
||||
* Goerli and Mumbai
|
||||
* Redeploy FQT on Mainnet and Optimism (#530)
|
||||
|
||||
## v6.16.0 - _June 14, 2022_
|
||||
|
||||
* Redeploy FQT on Mainnet and Optimism
|
||||
|
||||
## v6.15.0 - _June 3, 2022_
|
||||
|
||||
* Redeploy FQT on Mainnet
|
||||
|
||||
## v6.14.0 - _May 19, 2022_
|
||||
|
||||
* Redeploy FQT on Avalanche and BSC
|
||||
|
||||
## v6.13.0 - _April 22, 2022_
|
||||
|
||||
* Redeploy FQT on mainnet and polygon (#462)
|
||||
|
||||
## v6.12.1 - _March 31, 2022_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.12.0 - _March 2, 2022_
|
||||
|
||||
* Update fantom fillQuoteTransformer addresses (#398)
|
||||
|
||||
## v6.11.0 - _December 24, 2021_
|
||||
|
||||
* Add Optimism addresses (#385)
|
||||
|
||||
## v6.10.0 - _December 1, 2021_
|
||||
|
||||
* Add Aave supported FQT addresses for Polygon, Avalanche (#321)
|
||||
|
||||
## v6.9.0 - _November 16, 2021_
|
||||
|
||||
* Add Celo addresses (#368)
|
||||
|
||||
## v6.8.1 - _November 3, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.8.0 - _October 19, 2021_
|
||||
|
||||
* Fantom deployment (#347)
|
||||
|
||||
## v6.7.0 - _September 1, 2021_
|
||||
|
||||
* Avalanche deployment (#312)
|
||||
|
||||
## v6.6.1 - _August 19, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.6.0 - _August 11, 2021_
|
||||
|
||||
* Add zrxTreasury address (#301)
|
||||
|
||||
## v6.5.0 - _August 6, 2021_
|
||||
|
||||
* Deployed `Clipper` (#299)
|
||||
|
||||
## v6.4.0 - _June 22, 2021_
|
||||
|
||||
* Deployed Lido FQT
|
||||
|
||||
## v6.3.1 - _June 11, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.3.0 - _May 25, 2021_
|
||||
|
||||
* Deployed contracts on `Polygon` (#240)
|
||||
|
||||
## v6.2.0 - _May 21, 2021_
|
||||
|
||||
* Deployed FQT on mainnet and ropsten for `KyberDMM` (#247)
|
||||
|
||||
## v6.1.0 - _May 5, 2021_
|
||||
|
||||
* Deployed FQT on mainnet and ropsten for `Balancer_V2` (#225)
|
||||
* Deployed FQT on mainnet and ropsten for `Uniswap_V3` (#227)
|
||||
|
||||
## v6.0.0 - _April 1, 2021_
|
||||
|
||||
* Add BSC chain addresses (#164)
|
||||
* Remove exchangeProxyAllowanceTarget (#164)
|
||||
* Redeployed FQT on BSC (#181)
|
||||
* Redeployed FQT on mainnet and ropsten (#150)
|
||||
|
||||
## v5.11.0 - _February 24, 2021_
|
||||
|
||||
* Deploy new FQT (#155)
|
||||
* Deploy new `PositiveSlippageFeeTransformer` (#101)
|
||||
|
||||
## v5.10.0 - _February 10, 2021_
|
||||
|
||||
* Deploy new FQT (#129)
|
||||
|
||||
## v5.9.0 - _January 13, 2021_
|
||||
|
||||
* Redeploy LiquidityProviderSandbox (#107)
|
||||
* Update ganache snapshot addresses (#109)
|
||||
|
||||
## v5.8.0 - _December 23, 2020_
|
||||
|
||||
* redeploy FQT (#99)
|
||||
|
||||
## v5.7.0 - _December 17, 2020_
|
||||
|
||||
* Redeploy FQT (#91)
|
||||
|
||||
## v5.6.0 - _December 7, 2020_
|
||||
|
||||
* Update mainnet and ropsten transformer addresses for hot-pants release (#70)
|
||||
|
||||
## v5.5.0 - _December 3, 2020_
|
||||
|
||||
* Update ganache snapshot addresses (#59)
|
||||
|
||||
## v5.4.0 - _November 19, 2020_
|
||||
|
||||
* Update ganache snapshot addresses (#27)
|
||||
|
||||
## v5.3.0 - _November 13, 2020_
|
||||
|
||||
* Add `exchangeProxyLiquidityProviderSandbox` addresses (#16)
|
||||
|
||||
## v5.2.0 - _November 3, 2020_
|
||||
|
||||
* Redeploy FQT with CORRECT deployer (#29)
|
||||
|
||||
## v5.1.0 - _November 3, 2020_
|
||||
|
||||
* Deploy new FQT (#28)
|
||||
|
||||
## v5.0.1 - _October 28, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v5.0.0 - _October 27, 2020_
|
||||
|
||||
* update erc20BridgeSampler address for Kovan (#14)
|
||||
* Moved Bridge addresses into Asset-swapper (#4)
|
||||
|
||||
## v4.12.0 - _October 21, 2020_
|
||||
|
||||
* Update `CurveBridge` address on all networks (#2633)
|
||||
@@ -253,7 +205,6 @@ CHANGELOG
|
||||
* Deploy `ShellBridge` on Mainnet (#2722)
|
||||
* Deploy `DodoBridge` on Mainnet (#2701)
|
||||
* Deploy `CreamBridge` on Mainnet (#2715)
|
||||
|
||||
## v4.11.0 - _July 15, 2020_
|
||||
|
||||
* Update ganache snapshot Exchange Proxy addresses (#2612)
|
||||
@@ -263,7 +214,6 @@ CHANGELOG
|
||||
* Redeploy DFB on kovan (#2628)
|
||||
* Update ganache snapshot Exchange Proxy addresses for MetaTransactions (#2610)
|
||||
* Add BalancerBridge addresses (#2613)
|
||||
|
||||
## v4.10.0 - _June 24, 2020_
|
||||
|
||||
* Updated Kovan's ERC20BridgeSampler address (#2519)
|
||||
@@ -283,25 +233,20 @@ CHANGELOG
|
||||
* Redeploy ERC20BridgeSampler on Mainnet and Kovan using UniswapV2 (#2599)
|
||||
* Add UniswapV2Bridge address on Mainnet (new field) (#2599)
|
||||
* Add Exchange Proxy addresses (#2591)
|
||||
|
||||
## v4.9.0 - _March 3, 2020_
|
||||
|
||||
* Redeploy `ERC20BridgeSampler` (#2503)
|
||||
|
||||
## v4.8.0 - _February 27, 2020_
|
||||
|
||||
* Added Broker, GodsUnchainedValidator, ChainlinkStopLimit to index.ts (#2498)
|
||||
|
||||
## v4.7.0 - _February 25, 2020_
|
||||
|
||||
* Update `DevUtils` addresses. (#2493)
|
||||
|
||||
## v4.6.0 - _February 15, 2020_
|
||||
|
||||
* Added `ChainlinkStopLimit` addresses (mainnet, ropsten, rinkeby) (#2473)
|
||||
* Added `CurveBridge` address (mainnet) (#2483)
|
||||
* Update `ERC20BridgeSampler` address (mainnet, kovan) (#2483)
|
||||
|
||||
## v4.5.0 - _February 8, 2020_
|
||||
|
||||
* Update `ERC20BridgeSampler` and `Eth2Dai` on mainnet and kovan. (#2474)
|
||||
@@ -310,19 +255,16 @@ CHANGELOG
|
||||
* Added Broker and GodsUnchainedValidator addresses (#2469)
|
||||
* Updated Forwarder addresses (#2469)
|
||||
* Update `ERC20BridgeSampler` address on mainnet and kovan. (#2477)
|
||||
|
||||
## v4.4.0 - _February 4, 2020_
|
||||
|
||||
* Update `ERC20BridgeSampler` on mainnet and kovan. (#2459)
|
||||
* Remove `libTransactionDecoder` (#2456)
|
||||
* Update snapshot addresses (#2466)
|
||||
|
||||
## v4.3.0 - _January 22, 2020_
|
||||
|
||||
* Update `DevUtils` mainnet, Ropsten, Rinkeby, Kovan addresses with PR#2440 changes (#2446)
|
||||
* Update `DevUtils` mainnet, Ropsten, Rinkeby, Kovan addresses (#2436)
|
||||
* Update `ERC20BridgeSampler` address on kovan and mainnet. (#2427)
|
||||
|
||||
## v4.2.0 - _January 6, 2020_
|
||||
|
||||
* Added new `DevUtils` addresses (#2402)
|
||||
@@ -332,11 +274,9 @@ CHANGELOG
|
||||
* Update `KyberBridge` mainnet address. (#2390)
|
||||
* Update `Forwarder` mainnet address. (#2390)
|
||||
* Added ChaiBridge Contract to contract-addresses (#2390)
|
||||
|
||||
## v4.1.0 - _December 17, 2019_
|
||||
|
||||
* Addition of ERC20BridgeSampler + Kyber Erc20Bridge Contract in contract-addresses (#2353)
|
||||
|
||||
## v4.0.0 - _December 2, 2019_
|
||||
|
||||
* `1337` addresses updated with Forwarder deployed after Exchange is configured (#2368)
|
||||
@@ -351,108 +291,84 @@ CHANGELOG
|
||||
* Removed `getNetworkIdByExchangeAddressOrThrow`. It's not needed with V3 tooling. (#2170)
|
||||
* Add `zrxVault`, `readOnlyProxy`, `staking`, and `stakingProxy` schema with addresses for each tesnet (#2224)
|
||||
* Update `assetProxyOwner` address for each testnet (#2224)
|
||||
|
||||
## v3.3.0-beta.5 - _December 2, 2019_
|
||||
|
||||
* `1337` addresses updated with Forwarder deployed after Exchange is configured (#2368)
|
||||
* Update Forwarder addresses on all newtorks (#2374)
|
||||
|
||||
## v3.3.0-beta.4 - _November 20, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.3.0-beta.3 - _November 17, 2019_
|
||||
|
||||
* Update all v3 mainnet addresses (#2322)
|
||||
* Update ZeroExGovernor address on all testnets (#2322)
|
||||
|
||||
## v3.3.0-beta.2 - _November 7, 2019_
|
||||
|
||||
* Updated devUtils contract addresses on testnets
|
||||
|
||||
## v3.3.0-beta.1 - _November 6, 2019_
|
||||
|
||||
* Remove `readOnlyProxy` from addresses interface (#2295)
|
||||
* Add `zeroExGovernor` and `erc20BridgeProxy` to addresses interface (#2296)
|
||||
* Update `exchange`, `staking`, `stakingProxy`, `zeroExGovernor`, `assetProxyOwner`, and `erc20BridgeProxy` addresses for each tesnet (#2296)
|
||||
* Contract addresses are no longer indexed by network ID. Now they're indexed by chain ID. (#2313)
|
||||
|
||||
## v3.3.0-beta.0 - _October 3, 2019_
|
||||
|
||||
* Removed `getNetworkIdByExchangeAddressOrThrow`. It's not needed with V3 tooling. (#2170)
|
||||
* Add `zrxVault`, `readOnlyProxy`, `staking`, and `stakingProxy` schema with addresses for each tesnet (#2224)
|
||||
* Update `assetProxyOwner` address for each testnet (#2224)
|
||||
|
||||
## v3.2.0 - _September 17, 2019_
|
||||
|
||||
* Added `getNetworkIdByExchangeAddressOrThrow` (#2096)
|
||||
|
||||
## v3.1.0 - _August 22, 2019_
|
||||
|
||||
* Added DevUtils (#2060)
|
||||
|
||||
## v3.0.3 - _August 8, 2019_
|
||||
|
||||
* Added StaticCallAssetProxy and ERC1155AssetProxy (#2021)
|
||||
|
||||
## v3.0.2 - _July 15, 2019_
|
||||
|
||||
* Update OrderValidator testnet addresses
|
||||
|
||||
## v3.0.1 - _July 13, 2019_
|
||||
|
||||
* Update remaining Mainnet V2.1 contract addresses
|
||||
|
||||
## v3.0.0 - _July 13, 2019_
|
||||
|
||||
* Redeployed Mainnet Exchange and Asset Proxies
|
||||
|
||||
## v2.3.3 - _May 14, 2019_
|
||||
|
||||
* Redeploy Coordinator contract (#1812)
|
||||
|
||||
## v2.3.1 - _April 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.3.0 - _March 21, 2019_
|
||||
|
||||
* Add addresses for coordinator extension contract and coordinator registry (#1689)
|
||||
* Added Dutch Auction mainnet address (#1715)
|
||||
|
||||
## v2.2.2 - _February 25, 2019_
|
||||
|
||||
* Fixed Ganache addresses for OrderValidator & Forwarder
|
||||
|
||||
## v2.2.1 - _February 5, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.2.0 - _January 15, 2019_
|
||||
|
||||
* Added migration for `MultiAssetProxy` contract (#1503)
|
||||
|
||||
## v2.1.0 - _January 9, 2019_
|
||||
|
||||
* Added testnet entries for Dutch Auction contract (kovan,rinkeby,ropsten) (#1465)
|
||||
|
||||
## v2.0.0 - _November 28, 2018_
|
||||
|
||||
* Redeployed Rinkeby with testnet Exchange artifact (#1318)
|
||||
* Added Ganache snapshot addresses for network 50 (#1318)
|
||||
|
||||
## v1.2.0 - _November 21, 2018_
|
||||
|
||||
* Rinkeby Deployment
|
||||
|
||||
## v1.1.0 - _November 9, 2018_
|
||||
|
||||
* Update Forwarder addresses (#1192)
|
||||
|
||||
## v1.0.1 - _October 18, 2018_
|
||||
|
||||
* Initial release (#1105)
|
||||
|
||||
## v1.0.0 - _Invalid date_
|
||||
|
||||
* Unpublished Package
|
||||
* Unpublished Package
|
@@ -25,7 +25,7 @@ var getContractAddressesForChainOrThrow = require('@0x/contract-addresses').getC
|
||||
|
||||
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
|
||||
|
||||
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
|
||||
Please read our [contribution guidelines](../../.github/CONTRIBUTING.md) before getting started.
|
||||
|
||||
### Install dependencies
|
||||
|
||||
|
@@ -45,29 +45,6 @@
|
||||
"positiveSlippageFeeTransformer": "0x17f5b11d1b0ef2454dcffa51bfa356bb52a86822"
|
||||
}
|
||||
},
|
||||
"42": {
|
||||
"zrxToken": "0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa",
|
||||
"etherToken": "0xd0a1e359811322d97991e03f863a0c30c2cf029c",
|
||||
"zeroExGovernor": "0x6ff734d96104965c9c1b0108f83abc46e6e501df",
|
||||
"zrxVault": "0x781ee6683595f823208be6540a279f940e6af196",
|
||||
"staking": "0x73ea24041e03a012c51a45c307e0ba376af0238c",
|
||||
"stakingProxy": "0xe94cb304b3f515be7c95fedcfa249a84995fd748",
|
||||
"erc20BridgeProxy": "0x3577552c1fb7a44ad76beeb7ab53251668a21f8d",
|
||||
"erc20BridgeSampler": "0x298a99d3a2b891df04019425542897ac1a867d9d",
|
||||
"exchangeProxyGovernor": "0x618f9c67ce7bf1a50afa1e7e0238422601b0ff6e",
|
||||
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
|
||||
"exchangeProxyTransformerDeployer": "0x1b62de2dbb5e7aa519e9c442721ecef75702807f",
|
||||
"exchangeProxyFlashWallet": "0x22f9dcf4647084d6c31b2765f6910cd85c178c18",
|
||||
"exchangeProxyLiquidityProviderSandbox": "0x4022e3982f326455f0905de3dbc4449999baf2dc",
|
||||
"zrxTreasury": "0x0000000000000000000000000000000000000000",
|
||||
"transformers": {
|
||||
"wethTransformer": "0x9ce35b5ee9e710535e3988e3f8731d9ca9dba17d",
|
||||
"payTakerTransformer": "0x5a53e7b02a83aa9f60ccf4e424f0442c255bc977",
|
||||
"affiliateFeeTransformer": "0x870893920a96a28d4b63c0a7d06a521e3bd074b3",
|
||||
"fillQuoteTransformer": "0x8d2d732e5fe6d4d6d5e715200b84dfa69fb05478",
|
||||
"positiveSlippageFeeTransformer": "0x0000000000000000000000000000000000000000"
|
||||
}
|
||||
},
|
||||
"56": {
|
||||
"zrxToken": "0x0000000000000000000000000000000000000000",
|
||||
"etherToken": "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
|
||||
@@ -252,29 +229,6 @@
|
||||
"positiveSlippageFeeTransformer": "0x9a4947d3fb77a7afc2c9cd6714bbae96dddde059"
|
||||
}
|
||||
},
|
||||
"421611": {
|
||||
"zrxToken": "0x0000000000000000000000000000000000000000",
|
||||
"etherToken": "0x4200000000000000000000000000000000000006",
|
||||
"zeroExGovernor": "0x0000000000000000000000000000000000000000",
|
||||
"zrxVault": "0x0000000000000000000000000000000000000000",
|
||||
"staking": "0x0000000000000000000000000000000000000000",
|
||||
"stakingProxy": "0x0000000000000000000000000000000000000000",
|
||||
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
|
||||
"erc20BridgeSampler": "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": {
|
||||
"zrxToken": "0x0000000000000000000000000000000000000000",
|
||||
"etherToken": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-addresses",
|
||||
"version": "7.4.1",
|
||||
"version": "8.0.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -13,7 +13,7 @@
|
||||
"build": "yarn tsc -b",
|
||||
"build:ci": "yarn build",
|
||||
"test": "mocha --require source-map-support/register 'lib/test/**/*_test.js' --timeout 10000 --bail --exit",
|
||||
"test:circleci": "yarn test",
|
||||
"test:ci": "yarn test",
|
||||
"clean": "shx rm -rf lib",
|
||||
"publish:private": "yarn build && gitpkg publish"
|
||||
},
|
||||
|
@@ -27,7 +27,6 @@ export interface ContractAddresses {
|
||||
export enum ChainId {
|
||||
Mainnet = 1,
|
||||
Goerli = 5,
|
||||
Kovan = 42,
|
||||
Ganache = 1337,
|
||||
BSC = 56,
|
||||
Polygon = 137,
|
||||
@@ -37,7 +36,6 @@ export enum ChainId {
|
||||
Celo = 42220,
|
||||
Optimism = 10,
|
||||
Arbitrum = 42161,
|
||||
ArbitrumRinkeby = 421611,
|
||||
}
|
||||
|
||||
/**
|
||||
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user