Compare commits

..

44 Commits

Author SHA1 Message Date
wonge97
b319a4dceb [protocol] Add file for OP RPGF Round 4 Funding (#780) 2024-05-24 15:53:41 -04:00
github-actions[bot]
e66307ba31 Publish: CHANGELOG and Package Version Updates into development (#763)
* Updated CHANGELOGS & MD docs

* Publish

 - @0x/contracts-erc20@4.0.14
 - @0x/contracts-test-utils@5.4.60
 - @0x/contracts-treasury@1.4.54
 - @0x/contracts-utils@4.8.52
 - @0x/contracts-zero-ex@0.49.0
 - @0x/contract-addresses@8.13.0
 - @0x/contract-wrappers@13.23.8
 - @0x/protocol-utils@11.24.2

---------

Co-authored-by: Github Actions <github-actions@github.com>
2023-11-15 16:38:36 -08:00
Kyu
652d422622 Add Sepoia addresses (#761) 2023-11-15 15:24:11 -08:00
Kyu
5207565af8 Temporarily disable erc20 and governance in ci (#762) 2023-11-15 14:30:44 -08:00
wonge97
d982d75e2e Update docs with missing chains that 0x protocol is deployed on (#760)
* Update docs with missing chains that 0x protocol is deployed on
2023-11-13 12:58:46 -06:00
David Walsh
c5650da703 [contract-addresses] Add ChainId type predicate (#756) 2023-11-02 16:30:05 -06:00
github-actions[bot]
b19e29e03d Publish: CHANGELOG and Package Version Updates into development (#748)
* Updated CHANGELOGS & MD docs

* Publish

 - @0x/contracts-erc20@4.0.13
 - @0x/contracts-test-utils@5.4.59
 - @0x/contracts-treasury@1.4.53
 - @0x/contracts-utils@4.8.51
 - @0x/contracts-zero-ex@0.48.0
 - @0x/contract-addresses@8.12.0
 - @0x/contract-wrappers@13.23.7
 - @0x/protocol-utils@11.24.1

---------

Co-authored-by: Github Actions <github-actions@github.com>
2023-08-29 15:10:18 -07:00
Kyu
e5cbfd87bc Add Velodrome V2 support on Base (#747) 2023-08-29 14:43:23 -07:00
Savarn Dontamsetti (Sav)
5a49be1322 Create PRs to reflect publish changes (#743)
* Create PRs to reflect publish changes

* Using gh instead of third party action

* Adding github token
2023-08-24 16:35:11 -04:00
Github Actions
ec336b92aa Publish
- @0x/contracts-erc20@4.0.12
 - @0x/contracts-test-utils@5.4.58
 - @0x/contracts-treasury@1.4.52
 - @0x/contracts-utils@4.8.50
 - @0x/contracts-zero-ex@0.47.0
 - @0x/contract-addresses@8.11.0
 - @0x/contract-wrappers@13.23.6
 - @0x/protocol-utils@11.24.0
2023-08-18 14:24:32 +00:00
Github Actions
62a530d7ec Updated CHANGELOGS & MD docs 2023-08-18 14:24:27 +00:00
Savarn Dontamsetti (Sav)
09d6fbce81 Rename Maverick to MaverickV1 and add tests (#742)
* Renaming Maverick and adding tests

* Update Base chain ID
2023-08-17 17:11:05 -04:00
Savarn Dontamsetti (Sav)
7f324dd75d feat/Add Maverick V1 Support (#741)
* Add Maverick V1 Support for Ethereum, BSC, and Base
2023-08-17 12:59:38 -04:00
Github Actions
e1f9e107e9 Publish
- @0x/contracts-erc20@4.0.11
 - @0x/contracts-test-utils@5.4.57
 - @0x/contracts-treasury@1.4.51
 - @0x/contracts-utils@4.8.49
 - @0x/contracts-zero-ex@0.46.0
 - @0x/contract-addresses@8.10.0
 - @0x/contract-wrappers@13.23.5
 - @0x/protocol-utils@11.23.0
2023-08-09 21:43:27 +00:00
Github Actions
3c98225720 Updated CHANGELOGS & MD docs 2023-08-09 21:43:23 +00:00
Savarn Dontamsetti (Sav)
19e0c3364a Add Velodrome V2 compatibility test to Optimism Bridge Adapter Test (#740)
* Add Velodrome V2 compatibility test to Optimism Bridge Adapter Test

* Replace Avalanche Bridge Adapter with Optimism Bridge Adapter
2023-08-09 10:37:13 -04:00
Savarn Dontamsetti (Sav)
43e3dce965 Adding support for Velodrome V2 on Optimism (#739)
* Adding support for Velodrome V2 for Optimism
2023-08-08 16:20:03 -04:00
Github Actions
33ece5aa99 Publish
- @0x/contracts-erc20@4.0.10
 - @0x/contracts-test-utils@5.4.56
 - @0x/contracts-treasury@1.4.50
 - @0x/contracts-utils@4.8.48
 - @0x/contracts-zero-ex@0.45.1
 - @0x/contract-addresses@8.9.0
 - @0x/contract-wrappers@13.23.4
 - @0x/protocol-utils@11.22.4
2023-07-21 21:28:47 +00:00
Github Actions
262d2a8089 Updated CHANGELOGS & MD docs 2023-07-21 21:28:43 +00:00
Kyu
51fa55badd Update Base FillQuoteTransformer address (#738) 2023-07-21 13:58:04 -07:00
Github Actions
8c9917bf03 Publish
- @0x/contracts-erc20@4.0.9
 - @0x/contracts-test-utils@5.4.55
 - @0x/contracts-treasury@1.4.49
 - @0x/contracts-utils@4.8.47
 - @0x/contracts-zero-ex@0.45.0
 - @0x/contract-addresses@8.8.0
 - @0x/contract-wrappers@13.23.3
 - @0x/protocol-utils@11.22.3
2023-07-19 18:30:39 +00:00
Github Actions
b9e80db170 Updated CHANGELOGS & MD docs 2023-07-19 18:30:35 +00:00
Kyu
01e2690b2b Check UniswapV3 support on Avalanche and BSC BridgeAdapters (#737) 2023-07-19 11:05:51 -07:00
Kyu
4835a1b1e7 Add UniswapV3 to Avalanche and BSC bridge adapters (#735)
* Add UniswapV3 to Avalanche and BSC

 * Support v2 router in MixinUniswapV3

* Update Avalanche and BSC FillQuoteTransformer addresses
2023-07-19 09:52:40 -04:00
Savarn Dontamsetti (Sav)
21c8477062 Fixing invalid CHANGELOG.json for contract-addresses (#736) 2023-07-18 18:25:10 -04:00
duncancmt
defdff460a Base mainnet (#734)
* Add BaseGoerliBridgeAdapter

* Ignore Emacs files

* Remove Balancer V1; add Solidly to BaseBridgeAdapter

* Update addresses for both Base Mainnet and Goerli

* Remove Base Goerli testnet

* Prettier, CHANGELOG, and lowercasing addresses

---------

Co-authored-by: Savarn Dontamsetti <sav.dontamsetti@gmail.com>
2023-07-18 17:21:43 -04:00
wonge97
fd68edb239 Fix code block rendering (#729) 2023-06-20 11:22:54 -05:00
Kyu
e5e1393f0e Offboard Shell and MStable (#726)
* Offboard Shell and MStable

* Update README
2023-06-06 11:49:44 +09:00
Andy
20961ef42e Fix usage of expectEmit in MetaTransactionsFeatureV2 tests (#727)
* fix MetaTransactionsFeatureV2 tests

* pretty
2023-06-04 19:32:43 -04:00
Kyu
34febd728a Remove Bancor v1 support from EthereumBridgeAdapter (#724) 2023-05-16 09:38:26 -07:00
Github Actions
c2aed76f2f Publish
- @0x/contracts-erc20@4.0.8
 - @0x/contracts-test-utils@5.4.54
 - @0x/contracts-treasury@1.4.48
 - @0x/contracts-utils@4.8.46
 - @0x/contracts-zero-ex@0.44.0
 - @0x/contract-addresses@8.7.0
 - @0x/contract-wrappers@13.23.2
 - @0x/protocol-utils@11.22.2
2023-05-10 20:03:48 +00:00
Github Actions
198d986fdc Updated CHANGELOGS & MD docs 2023-05-10 20:03:45 +00:00
Savarn Dontamsetti (Sav)
e2e1d1074c feat: Add TraderJoeV2 MixIn to Arbitrum BridgeAdapter (#723)
* Add TraderJoeV2 MixIn to ArbitrumBridgeAdapter
2023-05-10 15:40:36 -04:00
wonge97
6a15dc3f13 update link (#721) 2023-05-08 17:25:34 -05:00
Github Actions
fefa3c13f6 Publish
- @0x/contracts-erc20@4.0.7
 - @0x/governance@1.0.5
 - @0x/contracts-test-utils@5.4.53
 - @0x/contracts-treasury@1.4.47
 - @0x/contracts-utils@4.8.45
 - @0x/contracts-zero-ex@0.43.0
 - @0x/contract-addresses@8.6.0
 - @0x/contract-wrappers@13.23.1
 - @0x/protocol-utils@11.22.1
2023-05-01 21:25:50 +00:00
Github Actions
f1d096a8af Updated CHANGELOGS & MD docs 2023-05-01 21:25:47 +00:00
Savarn Dontamsetti (Sav)
394ccbdc24 feat: Update Trader Joe V2 MixIn to support V2.1 router (#717)
* Add Trader Joe V2.1 Router MixIn

* Update changelog and FQT address

* lowercasing Avalanche FQT
2023-05-01 15:33:35 -04:00
Savarn Dontamsetti (Sav)
5a47f04ffc fix: remove vm.stopPrank if vm.startPrank not present (#719)
* remove vm.stopPrank if vm.startPrank not present

* remove unnecessary vm.stopPrank from governance tests
2023-05-01 14:13:56 -04:00
wonge97
3c414c12e6 fix malformed table (#718)
table was missing one space :(
2023-04-27 13:19:52 -05:00
wonge97
d268a1136c update bounty page (#716) 2023-04-27 11:51:55 -05:00
Github Actions
f8dd7168ee Publish
- @0x/contracts-treasury@1.4.46
 - @0x/contracts-zero-ex@0.42.1
 - @0x/contract-artifacts@3.19.0
 - @0x/contract-wrappers@13.23.0
 - @0x/protocol-utils@11.22.0
2023-04-24 11:12:31 +00:00
Github Actions
527ccf2ae5 Updated CHANGELOGS & MD docs 2023-04-24 11:12:28 +00:00
Andy
a7acf2951d MetaTransaction V2 Utility Packages (#714)
* add utility class for MetaTransactionsV2, update artifacts, update wrappers

* fix exports

* update artifacts, update wrappers

* update changelogs
2023-04-24 06:03:23 -04:00
wonge97
e57fc60a76 add new audits to documentation. fix broken link (#715) 2023-04-20 18:30:29 -05:00
85 changed files with 3602 additions and 688 deletions

View File

@@ -83,28 +83,30 @@ jobs:
-p @0x/order-utils \
-m --serial -c test:ci
# NOTE: disabled as ZRXToken.sol did not compile with the latest forge.
# TODO: re-enable once the issue is resolved.
- name: Run Forge build for erc20
working-directory: contracts/erc20
run: |
forge --version
forge build --sizes
forge build --sizes --skip ZRXToken
- name: Run Forge tests for erc20
working-directory: contracts/erc20
run: |
forge test -vvv --gas-report
# - name: Run Forge tests for erc20
# working-directory: contracts/erc20
# run: |
# forge test -vvv --gas-report
- name: Run Forge coverage for erc20
working-directory: contracts/erc20
run: |
forge coverage --report summary --report lcov
# - name: Run Forge coverage for erc20
# working-directory: contracts/erc20
# run: |
# forge coverage --report summary --report lcov
- name: Upload the coverage report to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
base-path: ./contracts/erc20/
path-to-lcov: ./contracts/erc20/lcov.info
# - name: Upload the coverage report to Coveralls
# uses: coverallsapp/github-action@master
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# base-path: ./contracts/erc20/
# path-to-lcov: ./contracts/erc20/lcov.info
- name: Run Forge build for zero-ex
working-directory: contracts/zero-ex
@@ -142,19 +144,20 @@ jobs:
forge --version
forge build --sizes
- name: Run Forge tests on governance contracts
working-directory: ./contracts/governance
run: |
forge test -vvv --gas-report
# TODO: re-enable once the issue is resolved.
# - name: Run Forge tests on governance contracts
# working-directory: ./contracts/governance
# run: |
# forge test -vvv --gas-report
- name: Run Forge coverage on governance contracts
working-directory: ./contracts/governance
run: |
forge coverage --report lcov
# - name: Run Forge coverage on governance contracts
# working-directory: ./contracts/governance
# 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/governance/
path-to-lcov: ./contracts/governance/lcov.info
# - name: Upload the coverage report to Coveralls
# uses: coverallsapp/github-action@master
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# base-path: ./contracts/governance/
# path-to-lcov: ./contracts/governance/lcov.info

View File

@@ -1,19 +1,21 @@
name: publish
on:
workflow_dispatch:
inputs:
ci_status:
description: 'required CI status'
default: 'success'
required: true
prerelease:
description: 'prerelease name'
required: false
workflow_dispatch:
inputs:
ci_status:
description: 'required CI status'
default: 'success'
required: true
prerelease:
description: 'prerelease name'
required: false
jobs:
publish:
runs-on: ubuntu-latest
env:
PublishBranch: publish/${{github.ref_name }}-${{ github.run_id }}-${{ github.run_number }}
steps:
- name: 'check successful status'
run: |
@@ -28,16 +30,20 @@ jobs:
version: nightly
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
fetch-depth: 0
ref: ${{ github.ref }}
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: 16
node-version: 16
- uses: actions/setup-python@v2
- name: 'configure git'
run: |
git config --global user.email "github-actions@github.com"
git config --global user.name "Github Actions"
- name: 'Checkout new branch'
run: |
git checkout -b $PublishBranch
git push -u origin $PublishBranch
- name: 'install dependencies'
run: |
yarn -D
@@ -49,9 +55,23 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
PUBLISH_PRERELEASE: ${{ github.event.inputs.prerelease }}
- name: 'merge into main branch'
if: github.event.inputs.prerelease == '' # unless it's a prerelease
- name: 'Create PR to merge into ref branch'
run: |
git checkout main && \
git merge ${{ github.ref }} && \
git push
gh pr create \
-B ${{ github.ref_name }} \
-H $PublishBranch \
--title "Publish: CHANGELOG and Package Version Updates into ${{ github.ref_name }}" \
--body "Syncing CHANGELOG and package version updates from publish action ${{github.run_id}}-${{github.run_number}} into ${{ github.ref_name}} branch" \
--reviewer ${{ github.actor }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: 'Create PR to merge ref branch into main'
run: |
gh pr create \
-B main \
-H ${{ github.ref_name }} \
--title "Publish: Sync ${{ github.ref_name }} into main " \
--body "Syncing ${{ github.ref_name }} back into main after publish action. NOTE: this PR should be merged after CHANGELOG and package version updates have been merged into ${{ github.ref_name }}" \
--reviewer ${{ github.actor }}
env:
GITHUB_TOKEN: ${{ github.token }}

3
.gitignore vendored
View File

@@ -84,6 +84,9 @@ TODO.md
# IDE file
.vscode
.idea
*~
.\#*
\#*\#
# generated contract artifacts/
generated-artifacts/

View File

@@ -1,4 +1,76 @@
[
{
"timestamp": 1700094997,
"version": "4.0.14",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1693346928,
"version": "4.0.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1692368658,
"version": "4.0.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1691617396,
"version": "4.0.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1689974915,
"version": "4.0.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1689791426,
"version": "4.0.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1683749017,
"version": "4.0.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1682976338,
"version": "4.0.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1681969282,
"version": "4.0.6",

View File

@@ -5,6 +5,38 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.0.14 - _November 16, 2023_
* Dependencies updated
## v4.0.13 - _August 29, 2023_
* Dependencies updated
## v4.0.12 - _August 18, 2023_
* Dependencies updated
## v4.0.11 - _August 9, 2023_
* Dependencies updated
## v4.0.10 - _July 21, 2023_
* Dependencies updated
## v4.0.9 - _July 19, 2023_
* Dependencies updated
## v4.0.8 - _May 10, 2023_
* Dependencies updated
## v4.0.7 - _May 1, 2023_
* Dependencies updated
## v4.0.6 - _April 20, 2023_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc20",
"version": "4.0.6",
"version": "4.0.14",
"engines": {
"node": ">=6.12"
},
@@ -24,7 +24,7 @@
},
"homepage": "https://github.com/0xProject/protocol",
"devDependencies": {
"@0x/contracts-utils": "^4.8.44",
"@0x/contracts-utils": "^4.8.52",
"@0x/ts-doc-gen": "^0.0.28",
"typedoc": "~0.16.11"
},

View File

@@ -39,7 +39,6 @@ contract WETH9V06Test is Test {
function testShouldConvertDepositedETHToWrappedETH() public {
vm.prank(user);
etherToken.deposit{value: 1e20}();
vm.stopPrank();
assertEq(etherToken.balanceOf(user), 1e20);
assertEq(address(etherToken).balance, 1e20);
@@ -58,7 +57,6 @@ contract WETH9V06Test is Test {
etherToken.deposit{value: 1e20}();
vm.prank(user);
etherToken.withdraw(100);
vm.stopPrank();
assertEq(etherToken.balanceOf(user), 1e20 - 100);
assertEq(address(etherToken).balance, 1e20 - 100);
@@ -68,7 +66,6 @@ contract WETH9V06Test is Test {
function testShouldConvertSentETHToWrappedETH() public {
vm.prank(user);
address(etherToken).call{value: 1e20}(new bytes(0));
vm.stopPrank();
assertEq(etherToken.balanceOf(user), 1e20);
assertEq(address(etherToken).balance, 1e20);

View File

@@ -34,7 +34,6 @@ contract ZRXTokenTest is Test {
assembly {
_address := create(0, add(_bytecode, 0x20), mload(_bytecode))
}
vm.stopPrank();
zrxToken = IERC20Token(address(_address));
}
@@ -73,7 +72,6 @@ contract ZRXTokenTest is Test {
function testShouldReturnFalseIfSenderHasInsufficientBalance() public {
vm.prank(owner);
zrxToken.approve(user, totalSupply + 1);
vm.stopPrank();
bool success = zrxToken.transferFrom(owner, user, totalSupply + 1);
assertEq(success, false);
@@ -82,7 +80,6 @@ contract ZRXTokenTest is Test {
function testShouldReturnFalseIfRecipientHasInsufficientAllowance() public {
vm.prank(owner);
zrxToken.approve(user, totalSupply - 1);
vm.stopPrank();
bool success = zrxToken.transferFrom(owner, user, totalSupply);
assertEq(success, false);
@@ -97,7 +94,6 @@ contract ZRXTokenTest is Test {
function testShouldNotModifySenderAllowanceIfSetToUINT256Max() public {
vm.prank(owner);
zrxToken.approve(user, type(uint256).max);
vm.stopPrank();
zrxToken.transferFrom(owner, user, 100);
assertEq(zrxToken.allowance(owner, user), type(uint256).max);
@@ -106,7 +102,6 @@ contract ZRXTokenTest is Test {
function testShouldTransferCorrectlyWhenSufficientAllowance() public {
vm.prank(owner);
zrxToken.approve(user, 1000 * 1e18);
vm.stopPrank();
vm.prank(user);
zrxToken.transferFrom(owner, user, 100 * 1e18);

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1682976338,
"version": "1.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1681756154,
"version": "1.0.4",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.5 - _May 1, 2023_
* Dependencies updated
## v1.0.4 - _April 17, 2023_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/governance",
"version": "1.0.4",
"version": "1.0.5",
"description": "Governance implementation for the 0x protocol and treasury",
"main": "index.js",
"directories": {

View File

@@ -90,7 +90,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -155,7 +154,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -266,7 +264,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -330,7 +327,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -366,7 +362,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -402,7 +397,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -438,7 +432,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);

View File

@@ -70,13 +70,12 @@ contract ZeroExProtocolGovernorTest is ZeroExGovernorBaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
vm.prank(account3);
governor.castVote(proposalId, 0); // Vote "against"
vm.stopPrank();
vm.prank(account4);
governor.castVote(proposalId, 2); // Vote "abstain"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);

View File

@@ -66,13 +66,12 @@ contract ZeroExTreasuryGovernorTest is ZeroExGovernorBaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
vm.prank(account3);
governor.castVote(proposalId, 0); // Vote "against"
vm.stopPrank();
vm.prank(account4);
governor.castVote(proposalId, 2); // Vote "abstain"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);

View File

@@ -1,4 +1,76 @@
[
{
"timestamp": 1700094997,
"version": "5.4.60",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1693346928,
"version": "5.4.59",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1692368658,
"version": "5.4.58",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1691617396,
"version": "5.4.57",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1689974915,
"version": "5.4.56",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1689791426,
"version": "5.4.55",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1683749017,
"version": "5.4.54",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1682976338,
"version": "5.4.53",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1681969282,
"version": "5.4.52",

View File

@@ -5,6 +5,38 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v5.4.60 - _November 16, 2023_
* Dependencies updated
## v5.4.59 - _August 29, 2023_
* Dependencies updated
## v5.4.58 - _August 18, 2023_
* Dependencies updated
## v5.4.57 - _August 9, 2023_
* Dependencies updated
## v5.4.56 - _July 21, 2023_
* Dependencies updated
## v5.4.55 - _July 19, 2023_
* Dependencies updated
## v5.4.54 - _May 10, 2023_
* Dependencies updated
## v5.4.53 - _May 1, 2023_
* Dependencies updated
## v5.4.52 - _April 20, 2023_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-test-utils",
"version": "5.4.52",
"version": "5.4.60",
"engines": {
"node": ">=6.12"
},
@@ -41,7 +41,7 @@
"dependencies": {
"@0x/assert": "^3.0.36",
"@0x/base-contract": "^7.0.0",
"@0x/contract-addresses": "^8.5.0",
"@0x/contract-addresses": "^8.13.0",
"@0x/dev-utils": "^5.0.2",
"@0x/json-schemas": "^6.4.4",
"@0x/order-utils": "^10.4.28",

View File

@@ -1,4 +1,85 @@
[
{
"timestamp": 1700094997,
"version": "1.4.54",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1693346928,
"version": "1.4.53",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1692368658,
"version": "1.4.52",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1691617396,
"version": "1.4.51",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1689974915,
"version": "1.4.50",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1689791426,
"version": "1.4.49",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1683749017,
"version": "1.4.48",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1682976338,
"version": "1.4.47",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1682334742,
"version": "1.4.46",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1681969282,
"version": "1.4.45",

View File

@@ -5,6 +5,42 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.4.54 - _November 16, 2023_
* Dependencies updated
## v1.4.53 - _August 29, 2023_
* Dependencies updated
## v1.4.52 - _August 18, 2023_
* Dependencies updated
## v1.4.51 - _August 9, 2023_
* Dependencies updated
## v1.4.50 - _July 21, 2023_
* Dependencies updated
## v1.4.49 - _July 19, 2023_
* Dependencies updated
## v1.4.48 - _May 10, 2023_
* Dependencies updated
## v1.4.47 - _May 1, 2023_
* Dependencies updated
## v1.4.46 - _April 24, 2023_
* Dependencies updated
## v1.4.45 - _April 20, 2023_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-treasury",
"version": "1.4.45",
"version": "1.4.54",
"engines": {
"node": ">=6.12"
},
@@ -46,12 +46,12 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
"devDependencies": {
"@0x/abi-gen": "^5.8.5",
"@0x/contract-addresses": "^8.5.0",
"@0x/contract-addresses": "^8.13.0",
"@0x/contracts-asset-proxy": "^3.7.19",
"@0x/contracts-erc20": "3.3.57",
"@0x/contracts-gen": "^2.0.50",
"@0x/contracts-staking": "^2.0.45",
"@0x/contracts-test-utils": "^5.4.52",
"@0x/contracts-test-utils": "^5.4.60",
"@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.21.0",
"@0x/protocol-utils": "^11.24.2",
"@0x/subproviders": "^8.0.1",
"@0x/types": "^3.3.7",
"@0x/typescript-typings": "^5.3.1",

View File

@@ -1,4 +1,76 @@
[
{
"timestamp": 1700094997,
"version": "4.8.52",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1693346928,
"version": "4.8.51",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1692368658,
"version": "4.8.50",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1691617396,
"version": "4.8.49",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1689974915,
"version": "4.8.48",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1689791426,
"version": "4.8.47",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1683749017,
"version": "4.8.46",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1682976338,
"version": "4.8.45",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1681969282,
"version": "4.8.44",

View File

@@ -5,6 +5,38 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.8.52 - _November 16, 2023_
* Dependencies updated
## v4.8.51 - _August 29, 2023_
* Dependencies updated
## v4.8.50 - _August 18, 2023_
* Dependencies updated
## v4.8.49 - _August 9, 2023_
* Dependencies updated
## v4.8.48 - _July 21, 2023_
* Dependencies updated
## v4.8.47 - _July 19, 2023_
* Dependencies updated
## v4.8.46 - _May 10, 2023_
* Dependencies updated
## v4.8.45 - _May 1, 2023_
* Dependencies updated
## v4.8.44 - _April 20, 2023_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-utils",
"version": "4.8.44",
"version": "4.8.52",
"engines": {
"node": ">=6.12"
},
@@ -45,7 +45,7 @@
"devDependencies": {
"@0x/abi-gen": "^5.8.5",
"@0x/contracts-gen": "^2.0.50",
"@0x/contracts-test-utils": "^5.4.52",
"@0x/contracts-test-utils": "^5.4.60",
"@0x/dev-utils": "^5.0.2",
"@0x/order-utils": "^10.4.28",
"@0x/sol-compiler": "^4.8.2",

View File

@@ -1,4 +1,94 @@
[
{
"version": "0.49.0",
"changes": [
{
"note": "Allowlist Sepolia in AbstractBridgeAdapter"
}
],
"timestamp": 1700094997
},
{
"version": "0.48.0",
"changes": [
{
"note": "Add VelodromeV2 support on Base"
}
],
"timestamp": 1693346928
},
{
"version": "0.47.0",
"changes": [
{
"note": "Add MaverickV1 support on Ethereum, BSC, and Base"
}
],
"timestamp": 1692368658
},
{
"version": "0.46.0",
"changes": [
{
"note": "Add VelodromeV2 support on Optimism"
}
],
"timestamp": 1691617396
},
{
"timestamp": 1689974915,
"version": "0.45.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.45.0",
"changes": [
{
"note": "Remove Bancor V1 support"
},
{
"note": "Remove Shell and MStable support"
},
{
"note": "Add Base Mainnet and Goerli BridgeAdapters"
},
{
"note": "Add Uniswap V3 support on Avalanche and BSC"
}
],
"timestamp": 1689791426
},
{
"version": "0.44.0",
"changes": [
{
"note": "Add Trader Joe V2 MixIn to Arbitrum"
}
],
"timestamp": 1683749017
},
{
"version": "0.43.0",
"changes": [
{
"note": "Add Trader Joe V2.1 Router Support for MixIn"
}
],
"timestamp": 1682976338
},
{
"timestamp": 1682334742,
"version": "0.42.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.42.0",
"changes": [

View File

@@ -5,6 +5,45 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v0.49.0 - _November 16, 2023_
* Allowlist Sepolia in AbstractBridgeAdapter
## v0.48.0 - _August 29, 2023_
* Add VelodromeV2 support on Base
## v0.47.0 - _August 18, 2023_
* Add MaverickV1 support on Ethereum, BSC, and Base
## v0.46.0 - _August 9, 2023_
* Add VelodromeV2 support on Optimism
## v0.45.1 - _July 21, 2023_
* Dependencies updated
## v0.45.0 - _July 19, 2023_
* Remove Bancor V1 support
* Remove Shell and MStable support
* Add Base Mainnet and Goerli BridgeAdapters
* Add Uniswap V3 support on Avalanche and BSC
## v0.44.0 - _May 10, 2023_
* Add Trader Joe V2 MixIn to Arbitrum
## v0.43.0 - _May 1, 2023_
* Add Trader Joe V2.1 Router Support for MixIn
## v0.42.1 - _April 24, 2023_
* Dependencies updated
## v0.42.0 - _April 20, 2023_
* Add Trader Joe V2 support on Avalanche

View File

@@ -115,6 +115,8 @@
"./contracts/src/transformers/bridges/ArbitrumBridgeAdapter.sol",
"./contracts/src/transformers/bridges/AvalancheBridgeAdapter.sol",
"./contracts/src/transformers/bridges/BSCBridgeAdapter.sol",
"./contracts/src/transformers/bridges/BaseBridgeAdapter.sol",
"./contracts/src/transformers/bridges/BaseGoerliBridgeAdapter.sol",
"./contracts/src/transformers/bridges/BridgeProtocols.sol",
"./contracts/src/transformers/bridges/CeloBridgeAdapter.sol",
"./contracts/src/transformers/bridges/EthereumBridgeAdapter.sol",
@@ -125,7 +127,6 @@
"./contracts/src/transformers/bridges/mixins/MixinAaveV2.sol",
"./contracts/src/transformers/bridges/mixins/MixinBalancer.sol",
"./contracts/src/transformers/bridges/mixins/MixinBalancerV2Batch.sol",
"./contracts/src/transformers/bridges/mixins/MixinBancor.sol",
"./contracts/src/transformers/bridges/mixins/MixinBancorV3.sol",
"./contracts/src/transformers/bridges/mixins/MixinCompound.sol",
"./contracts/src/transformers/bridges/mixins/MixinCryptoCom.sol",
@@ -136,12 +137,10 @@
"./contracts/src/transformers/bridges/mixins/MixinGMX.sol",
"./contracts/src/transformers/bridges/mixins/MixinKyberDmm.sol",
"./contracts/src/transformers/bridges/mixins/MixinLido.sol",
"./contracts/src/transformers/bridges/mixins/MixinMStable.sol",
"./contracts/src/transformers/bridges/mixins/MixinMakerPSM.sol",
"./contracts/src/transformers/bridges/mixins/MixinMooniswap.sol",
"./contracts/src/transformers/bridges/mixins/MixinNerve.sol",
"./contracts/src/transformers/bridges/mixins/MixinPlatypus.sol",
"./contracts/src/transformers/bridges/mixins/MixinShell.sol",
"./contracts/src/transformers/bridges/mixins/MixinSolidly.sol",
"./contracts/src/transformers/bridges/mixins/MixinSynthetix.sol",
"./contracts/src/transformers/bridges/mixins/MixinUniswap.sol",

View File

@@ -23,12 +23,14 @@ abstract contract AbstractBridgeAdapter is IBridgeAdapter {
assembly {
chainId := chainid()
}
// Skip chain id validation on Ganache (1337), Anvil (31337), Goerli (5), Mumbai (80001), Base Goerli (84531)
// Skip chain id validation on Ganache (1337), Anvil (31337), Goerli (5), Mumbai (80001), Base Goerli (84531),
// Sepolia (11155111)
bool skipValidation = (chainId == 1337 ||
chainId == 31337 ||
chainId == 5 ||
chainId == 80001 ||
chainId == 84531);
chainId == 84531 ||
chainId == 11155111);
if (chainId != expectedChainId && !skipValidation) {
revert(string(abi.encodePacked(expectedChainName, "BridgeAdapter.constructor: wrong chain ID")));

View File

@@ -26,6 +26,7 @@ import "./mixins/MixinKyberDmm.sol";
import "./mixins/MixinKyberElastic.sol";
import "./mixins/MixinGMX.sol";
import "./mixins/MixinNerve.sol";
import "./mixins/MixinTraderJoeV2.sol";
import "./mixins/MixinUniswapV3.sol";
import "./mixins/MixinUniswapV2.sol";
import "./mixins/MixinWOOFi.sol";
@@ -42,6 +43,7 @@ contract ArbitrumBridgeAdapter is
MixinKyberElastic,
MixinGMX,
MixinNerve,
MixinTraderJoeV2,
MixinUniswapV3,
MixinUniswapV2,
MixinWOOFi,
@@ -97,6 +99,11 @@ contract ArbitrumBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeUniswapV2(buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.TRADERJOEV2) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeTraderJoeV2(buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.GMX) {
if (dryRun) {
return (0, true);

View File

@@ -28,6 +28,7 @@ import "./mixins/MixinNerve.sol";
import "./mixins/MixinPlatypus.sol";
import "./mixins/MixinTraderJoeV2.sol";
import "./mixins/MixinUniswapV2.sol";
import "./mixins/MixinUniswapV3.sol";
import "./mixins/MixinWOOFi.sol";
import "./mixins/MixinZeroExBridge.sol";
@@ -44,6 +45,7 @@ contract AvalancheBridgeAdapter is
MixinPlatypus,
MixinTraderJoeV2,
MixinUniswapV2,
MixinUniswapV3,
MixinWOOFi,
MixinZeroExBridge
{
@@ -72,6 +74,11 @@ contract AvalancheBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeUniswapV2(buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.UNISWAPV3) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeUniswapV3(sellToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.NERVE) {
if (dryRun) {
return (0, true);

View File

@@ -22,9 +22,11 @@ import "./mixins/MixinDodo.sol";
import "./mixins/MixinDodoV2.sol";
import "./mixins/MixinKyberDmm.sol";
import "./mixins/MixinKyberElastic.sol";
import "./mixins/MixinMaverickV1.sol";
import "./mixins/MixinMooniswap.sol";
import "./mixins/MixinNerve.sol";
import "./mixins/MixinUniswapV2.sol";
import "./mixins/MixinUniswapV3.sol";
import "./mixins/MixinWOOFi.sol";
import "./mixins/MixinZeroExBridge.sol";
@@ -35,9 +37,11 @@ contract BSCBridgeAdapter is
MixinDodoV2,
MixinKyberDmm,
MixinKyberElastic,
MixinMaverickV1,
MixinMooniswap,
MixinNerve,
MixinUniswapV2,
MixinUniswapV3,
MixinWOOFi,
MixinZeroExBridge
{
@@ -61,6 +65,11 @@ contract BSCBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeUniswapV2(buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.UNISWAPV3) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeUniswapV3(sellToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.MOONISWAP) {
if (dryRun) {
return (0, true);
@@ -96,6 +105,11 @@ contract BSCBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeWOOFi(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.MAVERICKV1) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeMaverickV1(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.UNKNOWN) {
if (dryRun) {
return (0, true);

View 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 "./AbstractBridgeAdapter.sol";
import "./BridgeProtocols.sol";
import "./mixins/MixinUniswapV3.sol";
import "./mixins/MixinUniswapV2.sol";
import "./mixins/MixinBalancerV2Batch.sol";
import "./mixins/MixinCurve.sol";
import "./mixins/MixinCurveV2.sol";
import "./mixins/MixinMaverickV1.sol";
import "./mixins/MixinSolidly.sol";
import "./mixins/MixinVelodromeV2.sol";
contract BaseBridgeAdapter is
AbstractBridgeAdapter(8453, "Base"),
MixinUniswapV3,
MixinUniswapV2,
MixinBalancerV2Batch,
MixinCurve,
MixinCurveV2,
MixinMaverickV1,
MixinSolidly,
MixinVelodromeV2
{
constructor(IEtherToken weth) public MixinCurve(weth) {}
function _trade(
BridgeOrder memory order,
IERC20Token sellToken,
IERC20Token buyToken,
uint256 sellAmount,
bool dryRun
) internal override returns (uint256 boughtAmount, bool supportedSource) {
uint128 protocolId = uint128(uint256(order.source) >> 128);
if (protocolId == BridgeProtocols.CURVE) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeCurve(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.CURVEV2) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeCurveV2(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.UNISWAPV3) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeUniswapV3(sellToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.UNISWAPV2) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeUniswapV2(buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.SOLIDLY) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeSolidly(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.BALANCERV2BATCH) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeBalancerV2Batch(sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.MAVERICKV1) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeMaverickV1(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.VELODROMEV2) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeVelodromeV2(sellToken, sellAmount, order.bridgeData);
}
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);
}
}

View File

@@ -0,0 +1,45 @@
// 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 "./AbstractBridgeAdapter.sol";
import "./BridgeProtocols.sol";
import "./mixins/MixinUniswapV3.sol";
import "./mixins/MixinUniswapV2.sol";
contract BaseGoerliBridgeAdapter is AbstractBridgeAdapter(84531, "Base Goerli"), MixinUniswapV3, MixinUniswapV2 {
function _trade(
BridgeOrder memory order,
IERC20Token sellToken,
IERC20Token buyToken,
uint256 sellAmount,
bool dryRun
) internal override returns (uint256 boughtAmount, bool supportedSource) {
uint128 protocolId = uint128(uint256(order.source) >> 128);
if (protocolId == BridgeProtocols.UNISWAPV3) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeUniswapV3(sellToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.UNISWAPV2) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeUniswapV2(buyToken, sellAmount, order.bridgeData);
}
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);
}
}

View File

@@ -57,4 +57,6 @@ library BridgeProtocols {
uint128 internal constant KYBERELASTIC = 33;
uint128 internal constant BARTER = 34;
uint128 internal constant TRADERJOEV2 = 35;
uint128 internal constant VELODROMEV2 = 36;
uint128 internal constant MAVERICKV1 = 37;
}

View File

@@ -20,7 +20,6 @@ import "./BridgeProtocols.sol";
import "./mixins/MixinAaveV2.sol";
import "./mixins/MixinBalancer.sol";
import "./mixins/MixinBalancerV2Batch.sol";
import "./mixins/MixinBancor.sol";
import "./mixins/MixinBancorV3.sol";
import "./mixins/MixinBarter.sol";
import "./mixins/MixinCompound.sol";
@@ -33,9 +32,8 @@ import "./mixins/MixinKyberDmm.sol";
import "./mixins/MixinKyberElastic.sol";
import "./mixins/MixinLido.sol";
import "./mixins/MixinMakerPSM.sol";
import "./mixins/MixinMStable.sol";
import "./mixins/MixinMaverickV1.sol";
import "./mixins/MixinNerve.sol";
import "./mixins/MixinShell.sol";
import "./mixins/MixinSynthetix.sol";
import "./mixins/MixinUniswap.sol";
import "./mixins/MixinUniswapV2.sol";
@@ -47,7 +45,6 @@ contract EthereumBridgeAdapter is
MixinAaveV2,
MixinBalancer,
MixinBalancerV2Batch,
MixinBancor,
MixinBancorV3,
MixinBarter,
MixinCompound,
@@ -60,9 +57,8 @@ contract EthereumBridgeAdapter is
MixinKyberElastic,
MixinLido,
MixinMakerPSM,
MixinMStable,
MixinMaverickV1,
MixinNerve,
MixinShell,
MixinSynthetix,
MixinUniswap,
MixinUniswapV2,
@@ -71,15 +67,7 @@ contract EthereumBridgeAdapter is
{
constructor(
IEtherToken weth
)
public
MixinBancor(weth)
MixinBancorV3(weth)
MixinCompound(weth)
MixinCurve(weth)
MixinLido(weth)
MixinUniswap(weth)
{}
) public MixinBancorV3(weth) MixinCompound(weth) MixinCurve(weth) MixinLido(weth) MixinUniswap(weth) {}
function _trade(
BridgeOrder memory order,
@@ -129,16 +117,6 @@ contract EthereumBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeMakerPsm(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.MSTABLE) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeMStable(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.SHELL) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeShell(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.DODO) {
if (dryRun) {
return (0, true);
@@ -154,11 +132,6 @@ contract EthereumBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeCryptoCom(buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.BANCOR) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeBancor(buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.NERVE) {
if (dryRun) {
return (0, true);
@@ -204,6 +177,11 @@ contract EthereumBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeBarter(sellToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.MAVERICKV1) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeMaverickV1(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.UNKNOWN) {
if (dryRun) {
return (0, true);

View File

@@ -26,6 +26,7 @@ import "./mixins/MixinNerve.sol";
import "./mixins/MixinSolidly.sol";
import "./mixins/MixinSynthetix.sol";
import "./mixins/MixinUniswapV3.sol";
import "./mixins/MixinVelodromeV2.sol";
import "./mixins/MixinWOOFi.sol";
import "./mixins/MixinZeroExBridge.sol";
@@ -39,6 +40,7 @@ contract OptimismBridgeAdapter is
MixinNerve,
MixinSynthetix,
MixinUniswapV3,
MixinVelodromeV2,
MixinSolidly,
MixinWOOFi,
MixinZeroExBridge
@@ -109,6 +111,11 @@ contract OptimismBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeKyberElastic(sellToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.VELODROMEV2) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeVelodromeV2(sellToken, sellAmount, order.bridgeData);
}
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);

View File

@@ -26,7 +26,6 @@ import "./mixins/MixinDodo.sol";
import "./mixins/MixinDodoV2.sol";
import "./mixins/MixinKyberDmm.sol";
import "./mixins/MixinKyberElastic.sol";
import "./mixins/MixinMStable.sol";
import "./mixins/MixinNerve.sol";
import "./mixins/MixinSolidly.sol";
import "./mixins/MixinUniswapV2.sol";
@@ -45,7 +44,6 @@ contract PolygonBridgeAdapter is
MixinDodoV2,
MixinKyberDmm,
MixinKyberElastic,
MixinMStable,
MixinNerve,
MixinUniswapV2,
MixinUniswapV3,
@@ -88,11 +86,6 @@ contract PolygonBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeBalancerV2Batch(sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.MSTABLE) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeMStable(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.DODO) {
if (dryRun) {
return (0, true);

View File

@@ -1,93 +0,0 @@
// 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 "@0x/contracts-erc20/src/v06/LibERC20TokenV06.sol";
import "@0x/contracts-erc20/src/IERC20Token.sol";
import "@0x/contracts-erc20/src/IEtherToken.sol";
import "../IBridgeAdapter.sol";
interface IBancorNetwork {
function convertByPath(
IERC20Token[] calldata _path,
uint256 _amount,
uint256 _minReturn,
address _beneficiary,
address _affiliateAccount,
uint256 _affiliateFee
) external payable returns (uint256);
}
contract MixinBancor {
/// @dev Bancor ETH pseudo-address.
IERC20Token public constant BANCOR_ETH_ADDRESS = IERC20Token(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);
IEtherToken private immutable WETH;
constructor(IEtherToken weth) public {
WETH = weth;
}
function _tradeBancor(
IERC20Token buyToken,
uint256 sellAmount,
bytes memory bridgeData
) internal returns (uint256 boughtAmount) {
// Decode the bridge data.
IBancorNetwork bancorNetworkAddress;
IERC20Token[] memory path;
{
address[] memory _path;
(bancorNetworkAddress, _path) = abi.decode(bridgeData, (IBancorNetwork, address[]));
// To get around `abi.decode()` not supporting interface array types.
assembly {
path := _path
}
}
require(path.length >= 2, "MixinBancor/PATH_LENGTH_MUST_BE_AT_LEAST_TWO");
require(
path[path.length - 1] == buyToken || (path[path.length - 1] == BANCOR_ETH_ADDRESS && buyToken == WETH),
"MixinBancor/LAST_ELEMENT_OF_PATH_MUST_MATCH_OUTPUT_TOKEN"
);
uint256 payableAmount = 0;
// If it's ETH in the path then withdraw from WETH
// The Bancor path will have ETH as the 0xeee address
// Bancor expects to be paid in ETH not WETH
if (path[0] == BANCOR_ETH_ADDRESS) {
WETH.withdraw(sellAmount);
payableAmount = sellAmount;
} else {
// Grant an allowance to the Bancor Network.
LibERC20TokenV06.approveIfBelow(path[0], address(bancorNetworkAddress), sellAmount);
}
// Convert the tokens
boughtAmount = bancorNetworkAddress.convertByPath{value: payableAmount}(
path, // path originating with source token and terminating in destination token
sellAmount, // amount of source token to trade
1, // minimum amount of destination token expected to receive
address(this), // beneficiary
address(0), // affiliateAccount; no fee paid
0 // affiliateFee; no fee paid
);
if (path[path.length - 1] == BANCOR_ETH_ADDRESS) {
WETH.deposit{value: boughtAmount}();
}
return boughtAmount;
}
}

View File

@@ -0,0 +1,63 @@
// 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 "@0x/contracts-erc20/src/v06/LibERC20TokenV06.sol";
import "@0x/contracts-erc20/src/IERC20Token.sol";
interface IMaverickV1Router {
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
address pool;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint256 sqrtPriceLimitD18;
}
function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);
}
contract MixinMaverickV1 {
using LibERC20TokenV06 for IERC20Token;
function _tradeMaverickV1(
IERC20Token sellToken,
IERC20Token buyToken,
uint256 sellAmount,
bytes memory bridgeData
) internal returns (uint256 boughtAmount) {
(IMaverickV1Router router, address pool) = abi.decode(bridgeData, (IMaverickV1Router, address));
// Grant the MaverickV1 router an allowance to sell the sellToken
sellToken.approveIfBelow(address(router), sellAmount);
boughtAmount = router.exactInputSingle(
IMaverickV1Router.ExactInputSingleParams({
tokenIn: address(sellToken),
tokenOut: address(buyToken),
pool: pool,
recipient: address(this),
deadline: block.timestamp,
amountIn: sellAmount,
amountOutMinimum: 1,
sqrtPriceLimitD18: 0
})
);
}
}

View File

@@ -1,57 +0,0 @@
// 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 "@0x/contracts-erc20/src/v06/LibERC20TokenV06.sol";
import "@0x/contracts-erc20/src/IERC20Token.sol";
interface IShell {
function originSwap(
IERC20Token from,
IERC20Token to,
uint256 fromAmount,
uint256 minTargetAmount,
uint256 deadline
) external returns (uint256 toAmount);
}
contract MixinShell {
using LibERC20TokenV06 for IERC20Token;
function _tradeShell(
IERC20Token sellToken,
IERC20Token buyToken,
uint256 sellAmount,
bytes memory bridgeData
) internal returns (uint256 boughtAmount) {
IShell pool = abi.decode(bridgeData, (IShell));
// Grant the Shell contract an allowance to sell the first token.
IERC20Token(sellToken).approveIfBelow(address(pool), sellAmount);
boughtAmount = pool.originSwap(
sellToken,
buyToken,
// Sell all tokens we hold.
sellAmount,
// Minimum buy amount.
1,
// deadline
block.timestamp + 1
);
return boughtAmount;
}
}

View File

@@ -20,19 +20,43 @@ import "@0x/contracts-erc20/src/IERC20Token.sol";
import "../IBridgeAdapter.sol";
interface ILBRouter {
/// @notice Swaps exact tokens for tokens while performing safety checks
/// @param amountIn The amount of token to send
/// @param amountOutMin The min amount of token to receive
/// @param pairBinSteps The bin step of the pairs (0: V1, other values will use V2)
/// @param tokenPath The swap path using the binSteps following `_pairBinSteps`
/// @param to The address of the recipient
/// @param deadline The deadline of the tx
/// @return amountOut Output amount of the swap
/**
* @dev This enum represents the version of the pair requested
* - V1: Joe V1 pair
* - V2: LB pair V2. Also called legacyPair
* - V2_1: LB pair V2.1 (current version)
*/
enum Version {
V1,
V2,
V2_1
}
/**
* @dev The path parameters, such as:
* - pairBinSteps: The list of bin steps of the pairs to go through
* - versions: The list of versions of the pairs to go through
* - tokenPath: The list of tokens in the path to go through
*/
struct Path {
uint256[] pairBinSteps;
Version[] versions;
IERC20Token[] tokenPath;
}
/**
* @notice Swaps exact tokens for tokens while performing safety checks
* @param amountIn The amount of token to send
* @param amountOutMin The min amount of token to receive
* @param path The path of the swap
* @param to The address of the recipient
* @param deadline The deadline of the tx
* @return amountOut Output amount of the swap
*/
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
uint256[] memory pairBinSteps,
IERC20Token[] memory tokenPath,
Path memory path,
address to,
uint256 deadline
) external returns (uint256 amountOut);
@@ -49,12 +73,16 @@ contract MixinTraderJoeV2 {
ILBRouter router;
IERC20Token[] memory tokenPath;
uint256[] memory pairBinSteps;
ILBRouter.Version[] memory versions;
{
address[] memory _path;
(router, _path, pairBinSteps) = abi.decode(bridgeData, (ILBRouter, address[], uint256[]));
address[] memory _tokenPath;
(router, _tokenPath, pairBinSteps, versions) = abi.decode(
bridgeData,
(ILBRouter, address[], uint256[], ILBRouter.Version[])
);
// To get around `abi.decode()` not supporting interface array types.
assembly {
tokenPath := _path
tokenPath := _tokenPath
}
}
@@ -63,6 +91,10 @@ contract MixinTraderJoeV2 {
tokenPath.length == pairBinSteps.length + 1,
"MixinTraderJoeV2/PAIR_BIN_STEPS_LENGTH_MUST_BE_ONE_LESS_THAN_TOKEN_PATH_LENGTH"
);
require(
versions.length == pairBinSteps.length,
"MixinTraderJoeV2/VERSIONS_LENGTH_MUST_BE_EQUAL_TO_PAIR_BIN_STEPS_LENGTH"
);
require(
tokenPath[tokenPath.length - 1] == buyToken,
"MixinTraderJoeV2/LAST_ELEMENT_OF_PATH_MUST_MATCH_OUTPUT_TOKEN"
@@ -70,13 +102,11 @@ contract MixinTraderJoeV2 {
// Grant the Trader Joe V2 router an allowance to sell the first token.
tokenPath[0].approveIfBelow(address(router), sellAmount);
boughtAmount = router.swapExactTokensForTokens(
sellAmount,
1,
pairBinSteps,
tokenPath,
address(this),
block.timestamp
);
ILBRouter.Path memory path = ILBRouter.Path({
pairBinSteps: pairBinSteps,
versions: versions,
tokenPath: tokenPath
});
boughtAmount = router.swapExactTokensForTokens(sellAmount, 1, path, address(this), block.timestamp);
}
}

View File

@@ -31,6 +31,18 @@ interface IUniswapV3Router {
function exactInput(ExactInputParams memory params) external payable returns (uint256 amountOut);
}
// https://github.com/Uniswap/swap-router-contracts/blob/main/contracts/interfaces/IV3SwapRouter.sol
interface IUniswapV3Router2 {
struct ExactInputParams {
bytes path;
address recipient;
uint256 amountIn;
uint256 amountOutMinimum;
}
function exactInput(ExactInputParams memory params) external payable returns (uint256 amountOut);
}
contract MixinUniswapV3 {
using LibERC20TokenV06 for IERC20Token;
@@ -39,19 +51,30 @@ contract MixinUniswapV3 {
uint256 sellAmount,
bytes memory bridgeData
) internal returns (uint256 boughtAmount) {
(IUniswapV3Router router, bytes memory path) = abi.decode(bridgeData, (IUniswapV3Router, bytes));
(address router, bytes memory path, uint256 routerVersion) = abi.decode(bridgeData, (address, bytes, uint256));
// Grant the Uniswap router an allowance to sell the sell token.
sellToken.approveIfBelow(address(router), sellAmount);
sellToken.approveIfBelow(router, sellAmount);
boughtAmount = router.exactInput(
IUniswapV3Router.ExactInputParams({
path: path,
recipient: address(this),
deadline: block.timestamp,
amountIn: sellAmount,
amountOutMinimum: 1
})
);
if (routerVersion != 2) {
boughtAmount = IUniswapV3Router(router).exactInput(
IUniswapV3Router.ExactInputParams({
path: path,
recipient: address(this),
deadline: block.timestamp,
amountIn: sellAmount,
amountOutMinimum: 1
})
);
} else {
boughtAmount = IUniswapV3Router2(router).exactInput(
IUniswapV3Router2.ExactInputParams({
path: path,
recipient: address(this),
amountIn: sellAmount,
amountOutMinimum: 1
})
);
}
}
}

View File

@@ -0,0 +1,69 @@
// 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 "@0x/contracts-erc20/src/v06/LibERC20TokenV06.sol";
import "@0x/contracts-erc20/src/IERC20Token.sol";
interface IVelodromeV2Router {
struct Route {
address from;
address to;
bool stable;
address factory;
}
/// @notice Swap one token for another
/// @param amountIn Amount of token in
/// @param amountOutMin Minimum amount of desired token received
/// @param routes Array of trade routes used in the swap
/// @param to Recipient of the tokens received
/// @param deadline Deadline to receive tokens
/// @return amounts Array of amounts returned per route
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
Route[] calldata routes,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
}
contract MixinVelodromeV2 {
using LibERC20TokenV06 for IERC20Token;
function _tradeVelodromeV2(
IERC20Token sellToken,
uint256 sellAmount,
bytes memory bridgeData
) internal returns (uint256 boughtAmount) {
(IVelodromeV2Router router, IVelodromeV2Router.Route[] memory routes) = abi.decode(
bridgeData,
(IVelodromeV2Router, IVelodromeV2Router.Route[])
);
sellToken.approveIfBelow(address(router), sellAmount);
uint256[] memory amounts = router.swapExactTokensForTokens(
sellAmount,
1,
routes,
address(this),
block.timestamp + 1
);
return amounts[amounts.length - 1];
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-zero-ex",
"version": "0.42.0",
"version": "0.49.0",
"engines": {
"node": ">=6.12"
},
@@ -36,9 +36,9 @@
"typechain": "typechain --target=ethers-v5 --out-dir='typechain-wrappers' './foundry-artifacts/**/*.json'"
},
"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,MetaTransactionsFeatureV2",
"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,BaseGoerliBridgeAdapter,BaseBridgeAdapter,BSCBridgeAdapter,CeloBridgeAdapter,EthereumBridgeAdapter,FantomBridgeAdapter,OptimismBridgeAdapter,PolygonBridgeAdapter,MetaTransactionsFeatureV2",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
"abis": "./test/generated-artifacts/@(AbstractBridgeAdapter|AffiliateFeeTransformer|ArbitrumBridgeAdapter|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|IMetaTransactionsFeatureV2|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|MetaTransactionsFeatureV2|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"
"abis": "./test/generated-artifacts/@(AbstractBridgeAdapter|AffiliateFeeTransformer|ArbitrumBridgeAdapter|AvalancheBridgeAdapter|BSCBridgeAdapter|BaseBridgeAdapter|BaseGoerliBridgeAdapter|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|IMetaTransactionsFeatureV2|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|MetaTransactionsFeatureV2|MixinAaveV2|MixinBalancer|MixinBalancerV2Batch|MixinBancorV3|MixinCompound|MixinCryptoCom|MixinCurve|MixinCurveV2|MixinDodo|MixinDodoV2|MixinGMX|MixinKyberDmm|MixinLido|MixinMakerPSM|MixinMooniswap|MixinNerve|MixinPlatypus|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",
@@ -51,10 +51,10 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
"devDependencies": {
"@0x/abi-gen": "^5.8.5",
"@0x/contract-addresses": "^8.5.0",
"@0x/contract-addresses": "^8.13.0",
"@0x/contracts-erc20": "^3.3.57",
"@0x/contracts-gen": "^2.0.50",
"@0x/contracts-test-utils": "^5.4.52",
"@0x/contracts-test-utils": "^5.4.60",
"@0x/dev-utils": "^5.0.2",
"@0x/order-utils": "^10.4.28",
"@0x/sol-compiler": "^4.8.2",
@@ -80,7 +80,7 @@
},
"dependencies": {
"@0x/base-contract": "^7.0.0",
"@0x/protocol-utils": "^11.21.0",
"@0x/protocol-utils": "^11.24.2",
"@0x/subproviders": "^8.0.1",
"@0x/types": "^3.3.7",
"@0x/typescript-typings": "^5.3.1",

View File

@@ -7,6 +7,8 @@ import { ContractArtifact } from 'ethereum-types';
import * as AffiliateFeeTransformer from '../generated-artifacts/AffiliateFeeTransformer.json';
import * as AvalancheBridgeAdapter from '../generated-artifacts/AvalancheBridgeAdapter.json';
import * as BaseBridgeAdapter from '../generated-artifacts/BaseBridgeAdapter.json';
import * as BaseGoerliBridgeAdapter from '../generated-artifacts/BaseGoerliBridgeAdapter.json';
import * as BatchFillNativeOrdersFeature from '../generated-artifacts/BatchFillNativeOrdersFeature.json';
import * as BSCBridgeAdapter from '../generated-artifacts/BSCBridgeAdapter.json';
import * as CeloBridgeAdapter from '../generated-artifacts/CeloBridgeAdapter.json';
@@ -79,6 +81,8 @@ export const artifacts = {
OtcOrdersFeature: OtcOrdersFeature as ContractArtifact,
IOtcOrdersFeature: IOtcOrdersFeature as ContractArtifact,
AvalancheBridgeAdapter: AvalancheBridgeAdapter as ContractArtifact,
BaseGoerliBridgeAdapter: BaseGoerliBridgeAdapter as ContractArtifact,
BaseBridgeAdapter: BaseBridgeAdapter as ContractArtifact,
BSCBridgeAdapter: BSCBridgeAdapter as ContractArtifact,
CeloBridgeAdapter: CeloBridgeAdapter as ContractArtifact,
EthereumBridgeAdapter: EthereumBridgeAdapter as ContractArtifact,

View File

@@ -6,6 +6,8 @@
export * from '../generated-wrappers/affiliate_fee_transformer';
export * from '../generated-wrappers/avalanche_bridge_adapter';
export * from '../generated-wrappers/b_s_c_bridge_adapter';
export * from '../generated-wrappers/base_bridge_adapter';
export * from '../generated-wrappers/base_goerli_bridge_adapter';
export * from '../generated-wrappers/batch_fill_native_orders_feature';
export * from '../generated-wrappers/celo_bridge_adapter';
export * from '../generated-wrappers/curve_liquidity_provider';

View File

@@ -9,6 +9,8 @@ import * as AbstractBridgeAdapter from '../test/generated-artifacts/AbstractBrid
import * as AffiliateFeeTransformer from '../test/generated-artifacts/AffiliateFeeTransformer.json';
import * as ArbitrumBridgeAdapter from '../test/generated-artifacts/ArbitrumBridgeAdapter.json';
import * as AvalancheBridgeAdapter from '../test/generated-artifacts/AvalancheBridgeAdapter.json';
import * as BaseBridgeAdapter from '../test/generated-artifacts/BaseBridgeAdapter.json';
import * as BaseGoerliBridgeAdapter from '../test/generated-artifacts/BaseGoerliBridgeAdapter.json';
import * as BatchFillNativeOrdersFeature from '../test/generated-artifacts/BatchFillNativeOrdersFeature.json';
import * as BootstrapFeature from '../test/generated-artifacts/BootstrapFeature.json';
import * as BridgeProtocols from '../test/generated-artifacts/BridgeProtocols.json';
@@ -109,7 +111,6 @@ import * as MetaTransactionsFeatureV2 from '../test/generated-artifacts/MetaTran
import * as MixinAaveV2 from '../test/generated-artifacts/MixinAaveV2.json';
import * as MixinBalancer from '../test/generated-artifacts/MixinBalancer.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';
import * as MixinCompound from '../test/generated-artifacts/MixinCompound.json';
import * as MixinCryptoCom from '../test/generated-artifacts/MixinCryptoCom.json';
@@ -122,10 +123,8 @@ import * as MixinKyberDmm from '../test/generated-artifacts/MixinKyberDmm.json';
import * as MixinLido from '../test/generated-artifacts/MixinLido.json';
import * as MixinMakerPSM from '../test/generated-artifacts/MixinMakerPSM.json';
import * as MixinMooniswap from '../test/generated-artifacts/MixinMooniswap.json';
import * as MixinMStable from '../test/generated-artifacts/MixinMStable.json';
import * as MixinNerve from '../test/generated-artifacts/MixinNerve.json';
import * as MixinPlatypus from '../test/generated-artifacts/MixinPlatypus.json';
import * as MixinShell from '../test/generated-artifacts/MixinShell.json';
import * as MixinSolidly from '../test/generated-artifacts/MixinSolidly.json';
import * as MixinSynthetix from '../test/generated-artifacts/MixinSynthetix.json';
import * as MixinUniswap from '../test/generated-artifacts/MixinUniswap.json';
@@ -322,6 +321,8 @@ export const artifacts = {
ArbitrumBridgeAdapter: ArbitrumBridgeAdapter as ContractArtifact,
AvalancheBridgeAdapter: AvalancheBridgeAdapter as ContractArtifact,
BSCBridgeAdapter: BSCBridgeAdapter as ContractArtifact,
BaseBridgeAdapter: BaseBridgeAdapter as ContractArtifact,
BaseGoerliBridgeAdapter: BaseGoerliBridgeAdapter as ContractArtifact,
BridgeProtocols: BridgeProtocols as ContractArtifact,
CeloBridgeAdapter: CeloBridgeAdapter as ContractArtifact,
EthereumBridgeAdapter: EthereumBridgeAdapter as ContractArtifact,
@@ -332,7 +333,6 @@ export const artifacts = {
MixinAaveV2: MixinAaveV2 as ContractArtifact,
MixinBalancer: MixinBalancer as ContractArtifact,
MixinBalancerV2Batch: MixinBalancerV2Batch as ContractArtifact,
MixinBancor: MixinBancor as ContractArtifact,
MixinBancorV3: MixinBancorV3 as ContractArtifact,
MixinCompound: MixinCompound as ContractArtifact,
MixinCryptoCom: MixinCryptoCom as ContractArtifact,
@@ -343,12 +343,10 @@ export const artifacts = {
MixinGMX: MixinGMX as ContractArtifact,
MixinKyberDmm: MixinKyberDmm as ContractArtifact,
MixinLido: MixinLido as ContractArtifact,
MixinMStable: MixinMStable as ContractArtifact,
MixinMakerPSM: MixinMakerPSM as ContractArtifact,
MixinMooniswap: MixinMooniswap as ContractArtifact,
MixinNerve: MixinNerve as ContractArtifact,
MixinPlatypus: MixinPlatypus as ContractArtifact,
MixinShell: MixinShell as ContractArtifact,
MixinSolidly: MixinSolidly as ContractArtifact,
MixinSynthetix: MixinSynthetix as ContractArtifact,
MixinUniswap: MixinUniswap as ContractArtifact,

View File

@@ -8,6 +8,8 @@ export * from '../test/generated-wrappers/affiliate_fee_transformer';
export * from '../test/generated-wrappers/arbitrum_bridge_adapter';
export * from '../test/generated-wrappers/avalanche_bridge_adapter';
export * from '../test/generated-wrappers/b_s_c_bridge_adapter';
export * from '../test/generated-wrappers/base_bridge_adapter';
export * from '../test/generated-wrappers/base_goerli_bridge_adapter';
export * from '../test/generated-wrappers/batch_fill_native_orders_feature';
export * from '../test/generated-wrappers/bootstrap_feature';
export * from '../test/generated-wrappers/bridge_protocols';
@@ -107,7 +109,6 @@ export * from '../test/generated-wrappers/meta_transactions_feature_v2';
export * from '../test/generated-wrappers/mixin_aave_v2';
export * from '../test/generated-wrappers/mixin_balancer';
export * from '../test/generated-wrappers/mixin_balancer_v2_batch';
export * from '../test/generated-wrappers/mixin_bancor';
export * from '../test/generated-wrappers/mixin_bancor_v3';
export * from '../test/generated-wrappers/mixin_compound';
export * from '../test/generated-wrappers/mixin_crypto_com';
@@ -118,12 +119,10 @@ export * from '../test/generated-wrappers/mixin_dodo_v2';
export * from '../test/generated-wrappers/mixin_g_m_x';
export * from '../test/generated-wrappers/mixin_kyber_dmm';
export * from '../test/generated-wrappers/mixin_lido';
export * from '../test/generated-wrappers/mixin_m_stable';
export * from '../test/generated-wrappers/mixin_maker_p_s_m';
export * from '../test/generated-wrappers/mixin_mooniswap';
export * from '../test/generated-wrappers/mixin_nerve';
export * from '../test/generated-wrappers/mixin_platypus';
export * from '../test/generated-wrappers/mixin_shell';
export * from '../test/generated-wrappers/mixin_solidly';
export * from '../test/generated-wrappers/mixin_synthetix';
export * from '../test/generated-wrappers/mixin_uniswap';

View File

@@ -263,6 +263,7 @@ contract MetaTransactionTest is LocalTest {
function test_transformERC20() external {
bytes memory transformCallData = _transformERC20Call(zrx, dai, USER_ADDRESS);
IMetaTransactionsFeatureV2.MetaTransactionDataV2 memory mtxData = _getMetaTransaction(transformCallData);
LibSignature.Signature memory sig = _mtxSignature(mtxData);
assertEq(dai.balanceOf(USER_ADDRESS), 1e18);
vm.expectEmit(true, false, false, true);
@@ -273,10 +274,8 @@ contract MetaTransactionTest is LocalTest {
address(this)
);
IMetaTransactionsFeatureV2(address(zeroExDeployed.zeroEx)).executeMetaTransactionV2(
mtxData,
_mtxSignature(mtxData)
);
IMetaTransactionsFeatureV2(address(zeroExDeployed.zeroEx)).executeMetaTransactionV2(mtxData, sig);
assertEq(zrx.balanceOf(USER_ADDRESS), 1e18);
assertEq(dai.balanceOf(USER_ADDRESS), 0);
assertEq(weth.balanceOf(address(this)), 1);
@@ -285,6 +284,7 @@ contract MetaTransactionTest is LocalTest {
function test_rfqOrder() external {
bytes memory callData = _makeTestRfqOrder(zrx, dai, signerAddress, USER_ADDRESS, signerKey);
IMetaTransactionsFeatureV2.MetaTransactionDataV2 memory mtxData = _getMetaTransaction(callData);
LibSignature.Signature memory sig = _mtxSignature(mtxData);
assertEq(dai.balanceOf(USER_ADDRESS), 1e18);
vm.expectEmit(true, false, false, true);
@@ -295,10 +295,7 @@ contract MetaTransactionTest is LocalTest {
address(this)
);
IMetaTransactionsFeatureV2(address(zeroExDeployed.zeroEx)).executeMetaTransactionV2(
mtxData,
_mtxSignature(mtxData)
);
IMetaTransactionsFeatureV2(address(zeroExDeployed.zeroEx)).executeMetaTransactionV2(mtxData, sig);
assertEq(zrx.balanceOf(signerAddress), 0);
assertEq(zrx.balanceOf(USER_ADDRESS), 1e18);
@@ -310,6 +307,7 @@ contract MetaTransactionTest is LocalTest {
function test_fillLimitOrder() external {
bytes memory callData = _makeTestLimitOrder(zrx, dai, signerAddress, USER_ADDRESS, signerKey);
IMetaTransactionsFeatureV2.MetaTransactionDataV2 memory mtxData = _getMetaTransaction(callData);
LibSignature.Signature memory sig = _mtxSignature(mtxData);
assertEq(dai.balanceOf(USER_ADDRESS), 1e18);
vm.expectEmit(true, false, false, true);
@@ -320,10 +318,7 @@ contract MetaTransactionTest is LocalTest {
address(this)
);
IMetaTransactionsFeatureV2(address(zeroExDeployed.zeroEx)).executeMetaTransactionV2(
mtxData,
_mtxSignature(mtxData)
);
IMetaTransactionsFeatureV2(address(zeroExDeployed.zeroEx)).executeMetaTransactionV2(mtxData, sig);
assertEq(zrx.balanceOf(signerAddress), 0);
assertEq(zrx.balanceOf(USER_ADDRESS), 1e18);

View File

@@ -5,7 +5,7 @@
"KyberElasticQuoter": "0x0d125c15d54ca1f8a813c74a81aee34ebb508c1f",
"KyberElasticRouter": "0xc1e7dfe73e1598e3910ef4c7845b68a9ab6f4c83",
"KyberElasticPool": "0x952ffc4c47d66b454a8181f5c68b6248e18b66ec",
"TraderJoeV2Pool": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Quoter": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Router": "0x0000000000000000000000000000000000000000"
},
"56": {
@@ -14,7 +14,7 @@
"KyberElasticQuoter": "0x0d125c15d54ca1f8a813c74a81aee34ebb508c1f",
"KyberElasticRouter": "0xc1e7dfe73e1598e3910ef4c7845b68a9ab6f4c83",
"KyberElasticPool": "0xfbfab68ba077d099cd4b66fa76920572cc0b557c",
"TraderJoeV2Pool": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Quoter": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Router": "0x0000000000000000000000000000000000000000"
},
"137": {
@@ -23,7 +23,7 @@
"KyberElasticQuoter": "0x0d125c15d54ca1f8a813c74a81aee34ebb508c1f",
"KyberElasticRouter": "0xc1e7dfe73e1598e3910ef4c7845b68a9ab6f4c83",
"KyberElasticPool": "0xf9cc934753a127100585812181ac04d07158a4c2",
"TraderJoeV2Pool": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Quoter": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Router": "0x0000000000000000000000000000000000000000"
},
"43114": {
@@ -32,8 +32,8 @@
"KyberElasticQuoter": "0x0d125c15d54ca1f8a813c74a81aee34ebb508c1f",
"KyberElasticRouter": "0xc1e7dfe73e1598e3910ef4c7845b68a9ab6f4c83",
"KyberElasticPool": "0x6038373de7f64da99b2a31951628b7d778b2c3cf",
"TraderJoeV2Pool": "0x1D7A1a79e2b4Ef88D2323f3845246D24a3c20F1d",
"TraderJoeV2Router": "0xE3Ffc583dC176575eEA7FD9dF2A7c65F7E23f4C3"
"TraderJoeV2Quoter": "0x64b57F4249aA99a812212cee7DAEFEDC40B203cD",
"TraderJoeV2Router": "0xb4315e873dBcf96Ffd0acd8EA43f689D8c20fB30"
},
"250": {
"UniswapV2Router": "0x1b02da8cb0d097eb8d57a175b88c7d8b47997506",
@@ -41,7 +41,7 @@
"KyberElasticQuoter": "0x0d125c15d54ca1f8a813c74a81aee34ebb508c1f",
"KyberElasticRouter": "0xc1e7dfe73e1598e3910ef4c7845b68a9ab6f4c83",
"KyberElasticPool": "0x8dcf5fed6ae6bf0befb5e4f0c9414c2cb9a4ed01",
"TraderJoeV2Pool": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Quoter": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Router": "0x0000000000000000000000000000000000000000"
},
"10": {
@@ -50,7 +50,7 @@
"KyberElasticQuoter": "0x0d125c15d54ca1f8a813c74a81aee34ebb508c1f",
"KyberElasticRouter": "0xc1e7dfe73e1598e3910ef4c7845b68a9ab6f4c83",
"KyberElasticPool": "0x7e29ccaa4bf2894aca02c77e6b99cafc1d24b2f5",
"TraderJoeV2Pool": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Quoter": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Router": "0x0000000000000000000000000000000000000000"
},
"42161": {
@@ -59,7 +59,7 @@
"KyberElasticQuoter": "0x0d125c15d54ca1f8a813c74a81aee34ebb508c1f",
"KyberElasticRouter": "0xc1e7dfe73e1598e3910ef4c7845b68a9ab6f4c83",
"KyberElasticPool": "0x087abaab9cd85025a8b3916948c69fe173c837ea",
"TraderJoeV2Pool": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Router": "0x0000000000000000000000000000000000000000"
"TraderJoeV2Quoter": "0x64b57F4249aA99a812212cee7DAEFEDC40B203cD",
"TraderJoeV2Router": "0xb4315e873dBcf96Ffd0acd8EA43f689D8c20fB30"
}
}

View File

@@ -56,8 +56,8 @@ contract SwapERC20ForERC20Test is Test, ForkUtils, TestUtils {
function test_swapERC20ForERC20OnTraderJoeV2() public {
for (uint256 i = 0; i < chains.length; i++) {
// TraderJoeV2 mixin only enabled on Avalanche
if (i != 3) {
// TraderJoeV2 mixin only enabled on Avalanche and Arbitrum
if (i != 3 && i != 6) {
continue;
}
vm.selectFork(forkIds[chains[i]]);
@@ -81,8 +81,8 @@ contract SwapERC20ForERC20Test is Test, ForkUtils, TestUtils {
emit log_string("TraderJoeV2Router not available on this chain");
return;
}
if (sources.TraderJoeV2Pool == address(0)) {
emit log_string("TraderJoeV2Pool not available on this chain");
if (sources.TraderJoeV2Quoter == address(0)) {
emit log_string("TraderJoeV2Quoter not available on this chain");
return;
}
@@ -94,12 +94,11 @@ contract SwapERC20ForERC20Test is Test, ForkUtils, TestUtils {
fqtData.fillSequence[0] = FillQuoteTransformer.OrderType.Bridge;
fqtData.fillAmount = 1e6;
(uint256 amountOut, uint256 binStep) = sampleTraderJoeV2(
(uint256 amountOut, uint256 binStep, uint256 version) = sampleTraderJoeV2(
fqtData.fillAmount,
address(fqtData.sellToken),
address(fqtData.buyToken),
sources.TraderJoeV2Router,
sources.TraderJoeV2Pool
sources.TraderJoeV2Quoter
);
log_named_uint("amountOut", amountOut);
@@ -110,7 +109,9 @@ contract SwapERC20ForERC20Test is Test, ForkUtils, TestUtils {
tokenPath[1] = address(fqtData.buyToken);
uint256[] memory binSteps = new uint256[](1);
binSteps[0] = binStep;
order.bridgeData = abi.encode(address(sources.TraderJoeV2Router), tokenPath, binSteps);
uint256[] memory versions = new uint256[](1);
versions[0] = version;
order.bridgeData = abi.encode(address(sources.TraderJoeV2Router), tokenPath, binSteps, versions);
}
order.source = bytes32(uint256(BridgeProtocols.TRADERJOEV2) << 128);
@@ -198,20 +199,23 @@ contract SwapERC20ForERC20Test is Test, ForkUtils, TestUtils {
uint256 amount,
address takerToken,
address makerToken,
address router,
address pool
) private returns (uint256 makerTokenAmount, uint256 binStep) {
address quoter
) private returns (uint256 makerTokenAmount, uint256 binStep, uint256 version) {
log_string("Sampling TraderJoeV2");
log_named_address("takerToken", takerToken);
log_named_address("makerToken", makerToken);
log_named_address("router", router);
log_named_address("pool", pool);
log_named_address("quoter", quoter);
bool swapForY = ITraderJoeV2Pool(pool).tokenY() == makerToken;
address[] memory tokenPath = new address[](2);
tokenPath[0] = takerToken;
tokenPath[1] = makerToken;
(makerTokenAmount, ) = ITraderJoeV2Router(router).getSwapOut(pool, amount, swapForY);
ITraderJoeV2Quoter.Quote memory quote = ITraderJoeV2Quoter(quoter).findBestPathFromAmountIn(
tokenPath,
uint128(amount)
);
binStep = ITraderJoeV2Pool(pool).feeParameters().binStep;
return (quote.amounts[1], quote.binSteps[0], uint256(quote.versions[0]));
}
function deployFQTAndGetDeploymentNonce(

View File

@@ -0,0 +1,35 @@
// 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/transformers/bridges/AvalancheBridgeAdapter.sol";
import "../../../contracts/src/transformers/bridges/BridgeProtocols.sol";
contract AvalancheBridgeAdapterTest is Test {
address constant WAVAX = 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7;
AvalancheBridgeAdapter private adapter;
function setUp() public {
vm.chainId(43114);
adapter = new AvalancheBridgeAdapter(IEtherToken(WAVAX));
}
function testSupportsUniswapV3() public {
assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.UNISWAPV3) << 128)));
}
}

View File

@@ -0,0 +1,39 @@
// 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/transformers/bridges/BSCBridgeAdapter.sol";
import "../../../contracts/src/transformers/bridges/BridgeProtocols.sol";
contract BSCBridgeAdapterTest is Test {
address constant WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;
BSCBridgeAdapter private adapter;
function setUp() public {
vm.chainId(56);
adapter = new BSCBridgeAdapter(IEtherToken(WBNB));
}
function testSupportsUniswapV3() public {
assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.UNISWAPV3) << 128)));
}
function testSupportMaverickV1() public {
assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.MAVERICKV1) << 128)));
}
}

View File

@@ -0,0 +1,47 @@
// 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/transformers/bridges/BaseBridgeAdapter.sol";
import "../../../contracts/src/transformers/bridges/BridgeProtocols.sol";
contract BaseBridgeAdapterTest is Test {
address constant WETH = 0x4200000000000000000000000000000000000006;
BaseBridgeAdapter private adapter;
function setUp() public {
vm.chainId(8453);
adapter = new BaseBridgeAdapter(IEtherToken(WETH));
}
function testSupportsUniswapV3() public {
assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.UNISWAPV3) << 128)));
}
function testSupportMaverickV1() public {
assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.MAVERICKV1) << 128)));
}
function testSupportSolidly() public {
assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.SOLIDLY) << 128)));
}
function testSupportVelodromeV2() public {
assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.VELODROMEV2) << 128)));
}
}

View File

@@ -0,0 +1,39 @@
// 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/transformers/bridges/EthereumBridgeAdapter.sol";
import "../../../contracts/src/transformers/bridges/BridgeProtocols.sol";
contract EthereumBridgeAdapterTest is Test {
address constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
EthereumBridgeAdapter private adapter;
function setUp() public {
vm.chainId(1);
adapter = new EthereumBridgeAdapter(IEtherToken(WETH));
}
function testSupportsUniswapV3() public {
assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.UNISWAPV3) << 128)));
}
function testSupportMaverickV1() public {
assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.MAVERICKV1) << 128)));
}
}

View File

@@ -0,0 +1,35 @@
// 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/transformers/bridges/OptimismBridgeAdapter.sol";
import "../../../contracts/src/transformers/bridges/BridgeProtocols.sol";
contract OptimismBridgeAdapterTest is Test {
address constant WETH = 0x4200000000000000000000000000000000000006;
OptimismBridgeAdapter private adapter;
function setUp() public {
vm.chainId(10);
adapter = new OptimismBridgeAdapter(IEtherToken(WETH));
}
function testSupportVelodromeV2() public {
assertTrue(adapter.isSupportedSource(bytes32(uint256(BridgeProtocols.VELODROMEV2) << 128)));
}
}

View File

@@ -93,7 +93,7 @@ struct LiquiditySources {
address KyberElasticPool;
address KyberElasticQuoter;
address KyberElasticRouter;
address TraderJoeV2Pool;
address TraderJoeV2Quoter;
address TraderJoeV2Router;
address UniswapV2Router;
address UniswapV3Router;
@@ -103,35 +103,27 @@ interface IFQT {
function bridgeAdapter() external returns (address);
}
interface ITraderJoeV2Pool {
struct FeeParameters {
// 144 lowest bits in slot
uint16 binStep;
uint16 baseFactor;
uint16 filterPeriod;
uint16 decayPeriod;
uint16 reductionFactor;
uint24 variableFeeControl;
uint16 protocolShare;
uint24 maxVolatilityAccumulated;
// 112 highest bits in slot
uint24 volatilityAccumulated;
uint24 volatilityReference;
uint24 indexRef;
uint40 time;
interface ITraderJoeV2Quoter {
enum Version {
V1,
V2,
V2_1
}
function feeParameters() external view returns (FeeParameters memory);
struct Quote {
address[] route;
address[] pairs;
uint256[] binSteps;
Version[] versions;
uint128[] amounts;
uint128[] virtualAmountsWithoutSlippage;
uint128[] fees;
}
function tokenY() external view returns (address);
}
interface ITraderJoeV2Router {
function getSwapOut(
address pool,
uint256 amountIn,
bool swapForY
) external view returns (uint256 amountOut, uint256 feesIn);
function findBestPathFromAmountIn(
address[] calldata route,
uint128 amountIn
) external view returns (Quote memory quote);
}
interface IKyberElasticQuoter {

View File

@@ -6,6 +6,8 @@
"generated-artifacts/AffiliateFeeTransformer.json",
"generated-artifacts/AvalancheBridgeAdapter.json",
"generated-artifacts/BSCBridgeAdapter.json",
"generated-artifacts/BaseBridgeAdapter.json",
"generated-artifacts/BaseGoerliBridgeAdapter.json",
"generated-artifacts/BatchFillNativeOrdersFeature.json",
"generated-artifacts/CeloBridgeAdapter.json",
"generated-artifacts/CurveLiquidityProvider.json",
@@ -48,6 +50,8 @@
"test/generated-artifacts/ArbitrumBridgeAdapter.json",
"test/generated-artifacts/AvalancheBridgeAdapter.json",
"test/generated-artifacts/BSCBridgeAdapter.json",
"test/generated-artifacts/BaseBridgeAdapter.json",
"test/generated-artifacts/BaseGoerliBridgeAdapter.json",
"test/generated-artifacts/BatchFillNativeOrdersFeature.json",
"test/generated-artifacts/BootstrapFeature.json",
"test/generated-artifacts/BridgeProtocols.json",
@@ -147,7 +151,6 @@
"test/generated-artifacts/MixinAaveV2.json",
"test/generated-artifacts/MixinBalancer.json",
"test/generated-artifacts/MixinBalancerV2Batch.json",
"test/generated-artifacts/MixinBancor.json",
"test/generated-artifacts/MixinBancorV3.json",
"test/generated-artifacts/MixinCompound.json",
"test/generated-artifacts/MixinCryptoCom.json",
@@ -158,12 +161,10 @@
"test/generated-artifacts/MixinGMX.json",
"test/generated-artifacts/MixinKyberDmm.json",
"test/generated-artifacts/MixinLido.json",
"test/generated-artifacts/MixinMStable.json",
"test/generated-artifacts/MixinMakerPSM.json",
"test/generated-artifacts/MixinMooniswap.json",
"test/generated-artifacts/MixinNerve.json",
"test/generated-artifacts/MixinPlatypus.json",
"test/generated-artifacts/MixinShell.json",
"test/generated-artifacts/MixinSolidly.json",
"test/generated-artifacts/MixinSynthetix.json",
"test/generated-artifacts/MixinUniswap.json",

View File

@@ -4,28 +4,34 @@ Audits
Below are links to our third-party audit reports.
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
| **Release** | **Reports** |
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
| ERC721OrdersFeature | * `ABDK Consulting <https://s3.us-east-2.amazonaws.com/zeips.0x.org/audits/abdk-consulting/ABDK_0x_Solidity_v_1_0.pdf>`__ |
| | |
| | |
| ERC1155OrdersFeature | |
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
| Exchange V4 | * `Consensys Diligence (December 2020) <https://consensys.net/diligence/audits/2020/12/0x-exchange-v4/>`__ |
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
| Exchange V3 | * `Trail of Bits <http://zeips.0x.org.s3-website.us-east-2.amazonaws.com/audits/56/trail-of-bits/audit.pdf>`__ |
| | * `Consensys Diligence (Exchange) <https://diligence.consensys.net/audits/2019/09/0x-v3-exchange/>`__ |
| | * `Consensys Diligence (Staking) <https://diligence.consensys.net/audits/2019/10/0x-v3-staking/>`__ |
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
| Exchange V2.1 | * `First <https://docs.google.com/document/d/1jYv6V21MfCSwCS5fxD6ZyaLWGzkpRSUO0lZpST94XsA/edit>`_ |
| | * `Consensys Diligence <https://github.com/ConsenSys/0x_audit_report_2018-07-23>`_ |
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
| MultiAssetProxy | * `Consensys Diligence <https://github.com/ConsenSys/0x-audit-report-2018-12>`__ |
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
| ERC1155Proxy | * `Consensys Diligence <https://github.com/ConsenSys/0x-audit-report-2019-05>`__ |
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
| StaticCallProxy | * No third-party audit. |
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
| ERC20BridgeProxy | * No third-party audit. |
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| **Release** | **Reports** |
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| Governance | * `Ourovoros <https://github.com/0xProject/protocol/blob/development/contracts/governance/audits/0xProtocol-06-04-2023-Final.pdf>`__ |
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| MultiplexFeature | * `ABDK Consulting <https://github.com/0xProject/ZEIPs/blob/master/zeip96_images/ABDK_0x_MetaTransaction_v_1_0.pdf>`__ |
| | |
| MetaTransactions | |
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| ERC721OrdersFeature | * `ABDK Consulting <https://s3.us-east-2.amazonaws.com/zeips.0x.org/audits/abdk-consulting/ABDK_0x_Solidity_v_1_0.pdf>`__ |
| | |
| | |
| ERC1155OrdersFeature | |
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| Exchange V4 | * `Consensys Diligence (December 2020) <https://consensys.net/diligence/audits/2020/12/0x-exchange-v4/>`__ |
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| Exchange V3 | * `Trail of Bits <http://zeips.0x.org.s3-website.us-east-2.amazonaws.com/audits/56/trail-of-bits/audit.pdf>`__ |
| | * `Consensys Diligence (Exchange) <https://diligence.consensys.net/audits/2019/09/0x-v3-exchange/>`__ |
| | * `Consensys Diligence (Staking) <https://diligence.consensys.net/audits/2019/10/0x-v3-staking/>`__ |
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| Exchange V2.1 | * `First <https://docs.google.com/document/d/1jYv6V21MfCSwCS5fxD6ZyaLWGzkpRSUO0lZpST94XsA/edit>`_ |
| | * `Consensys Diligence <https://github.com/ConsenSys/0x_audit_report_2018-07-23>`_ |
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| MultiAssetProxy | * `Consensys Diligence <https://github.com/ConsenSys/0x-audit-report-2018-12>`__ |
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| ERC1155Proxy | * `Consensys Diligence <https://github.com/ConsenSys/0x-audit-report-2019-05>`__ |
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| StaticCallProxy | * No third-party audit. |
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| ERC20BridgeProxy | * No third-party audit. |
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+

View File

@@ -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/>`__ | `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 V4 | * Documentation at `https://docs.0xProtocol.org/en/latest/ <https://docs.0xProtocol.org/en/latest/>`__ | |
| | * `ZeroEx.sol <https://github.com/0xProject/protocol/tree/development/contracts/zero-ex/contracts/src/ZeroEx.sol>`__ | |
| | * `ZeroExOptimized.sol <https://github.com/0xProject/protocol/tree/development/contracts/zero-ex/contracts/src/ZeroExOptimized.sol>`__ | |
| | * `external/*.sol <https://github.com/0xProject/protocol/tree/development/contracts/zero-ex/contracts/src/external>`__ | |
| | * `features/*.sol <https://github.com/0xProject/protocol/tree/development/contracts/zero-ex/contracts/src/features>`__ | |
| | * `fixins/*.sol <https://github.com/0xProject/protocol/tree/development/contracts/zero-ex/contracts/src/fixins>`__ | |
| | * `migrations/*.sol <https://github.com/0xProject/protocol/tree/development/contracts/zero-ex/contracts/src/migrations>`__ | |
| | * `storage/*.sol <https://github.com/0xProject/protocol/tree/development/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,8 +46,6 @@ 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/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src>`__ | `c1177416f5 <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src>`_ |
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
Bounties
--------
@@ -67,19 +65,10 @@ The final reward amount is at the sole discretion of 0x Labs and will be paid in
| Low (CVSS 0.0 - 3.9) | up to $5,000 |
+----------------------------+---------------------+
Recent Inclusions
-----------------
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Change** | **** |
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| NFT feature | * Trade ERC721 and ERC1155 assets. See `ZEIP-93 <https://github.com/0xProject/ZEIPs/issues/93>`__ for more details |
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
Disclosures
-----------
Please e-mail all submissions to security@0x.org with the subject "BUG BOUNTY". Your submission
should include any steps required to reproduce or exploit the vulnerability. Please allow time for
the vulnerability to be fixed before discussing any findings publicly. After receiving a submission,
we will contact you with expected timelines for a fix to be implemented.
we will contact you with expected timelines for a fix to be implemented.

View File

@@ -66,3 +66,8 @@ Note: Some addresses have changed across various networks
Avalanche, `0xdef1c0ded9bec7f1a1670819833240f027b25eff <https://snowtrace.io/address/0xdef1c0ded9bec7f1a1670819833240f027b25eff>`__
Fantom, `0xdef189deaef76e379df891899eb5a00a94cbc250 <https://ftmscan.com/address/0xdef189deaef76e379df891899eb5a00a94cbc250>`__
Celo, `0xdef1c0ded9bec7f1a1670819833240f027b25eff <https://explorer.celo.org/address/0xdef1c0ded9bec7f1a1670819833240f027b25eff>`__
Arbitrum, `0xdef1c0ded9bec7f1a1670819833240f027b25eff <https://arbiscan.io/address/0xdef1c0ded9bec7f1a1670819833240f027b25eff>`__
Base, `0xdef1c0ded9bec7f1a1670819833240f027b25eff <https://basescan.org/address/0xdef1c0ded9bec7f1a1670819833240f027b25eff>`__
zkEVM, `0xdef1c0ded9bec7f1a1670819833240f027b25eff <https://zkevm.polygonscan.com/address/0xdef1c0ded9bec7f1a1670819833240f027b25eff>`__
Sepolia, `0xdef1c0ded9bec7f1a1670819833240f027b25eff <https://sepolia.etherscan.io/address/0xdef1c0ded9bec7f1a1670819833240f027b25eff>`__
Mumbai, `0xf471d32cb40837bf24529fcf17418fc1a4807626 <https://mumbai.polygonscan.com/address/0xf471d32cb40837bf24529fcf17418fc1a4807626>`__

View File

@@ -295,7 +295,7 @@ In both cases, the ``@0x/protocol-utils`` package simplifies generating these si
The Orderbook
=======================
Orders can be hosted by any server and are usually represented as a JSON object off-chain. For example, one off-chain way to post and discover orders is through `0x API <https://0x.org/api>`_.
Orders can be hosted by any server and are usually represented as a JSON object off-chain. For example, one off-chain way to post and discover orders is through `0x Orderbook API <https://0x.org/docs/category/orderbook-api>`_.
Below is a table represention and example of how orders should be formatted off-chain.

View File

@@ -15,6 +15,7 @@ Create an ERC721Order
The following code snippet shows how to construct a basic ERC721 sell order in JavaScript. In the following example, the seller indicates that they would like to receive ether by providing the sentinel value `0xeee...`` as the `erc20Token`.
.. code-block:: javascript
const { ERC721Order, NFTOrder } = require("@0x/protocol-utils");
const utils = require("@0x/utils");
@@ -48,6 +49,7 @@ The following code snippet shows how to construct a basic ERC721 sell order in J
An ERC721 sell order can be created similarly. Note that buy orders must use WETH instead of ether, because the ERC20 `transferFrom` functionality is needed to execute a buy order.
.. code-block:: javascript
const { ERC721Order, NFTOrder } = require("@0x/protocol-utils");
const utils = require("@0x/utils");
@@ -97,6 +99,7 @@ Fees are paid by the **buyer**, denominated in the asset paid by the buyer, and
The following code snippet shows how to create an ERC721 order with a single fee. Multiple fees can be specified by providing multiple fee objects in the order fees field.
.. code-block:: javascript
const { ERC721Order, NFTOrder } = require("@0x/protocol-utils");
const utils = require("@0x/utils");
@@ -130,6 +133,7 @@ The following code snippet shows how to create an ERC721 order with a single fee
In 0x V4, it is possible to create a bid for any NFT in a particular collection. The following code snippet shows how to create an order to buy any CryptoCoven $WITCH.
.. code-block:: javascript
const { ERC721Order, NFTOrder } = require("@0x/protocol-utils");
const utils = require("@0x/utils");
@@ -169,6 +173,7 @@ Off-chain orders must be signed by the order maker to be filled. For on-chain or
Signing an order with a private key is easy: the `ERC721Order` and `ERC1155Order` classes from `@0x/protocol-utils` expose a `getSignatureWithKey` function that take a 0x-prefixed private key string.
.. code-block:: javascript
const { ERC721Order, NFTOrder, SignatureType } = require("@0x/protocol-utils");
const utils = require("@0x/utils");
@@ -196,6 +201,7 @@ Signing an order with a private key is easy: the `ERC721Order` and `ERC1155Order
**Signing with ethers**
.. code-block:: javascript
const { ERC721Order, NFTOrder, SignatureType } = require("@0x/protocol-utils");
const utils = require("@0x/utils");
const { ethers } = require("ethers");
@@ -243,6 +249,7 @@ Signing an order with a private key is easy: the `ERC721Order` and `ERC1155Order
Orders can be simultaneously "signed" and listed on-chain using the `preSignERC721Order` or `preSignERC1155Order` functions. Orders can only be signed by the maker address specified in the order.
.. code-block:: solidity
/// @dev Approves an ERC721 order on-chain. After pre-signing
/// the order, the `PRESIGNED` signature type will become
/// valid for that order and signer.
@@ -260,6 +267,7 @@ Orders can be simultaneously "signed" and listed on-chain using the `preSignERC7
If an order has been pre-signed, it can be filled by providing a “null” signature with the PRESIGNED signature type (see `LibSignature.sol <https://github.com/0xProject/protocol/blob/refactor/nft-orders/contracts/zero-ex/contracts/src/features/libs/LibSignature.sol#L42-L61>`_):
.. code-block:: solidity
LibSignature.Signature({
signatureType: LibSignature.SignatureType.PRESIGNED,
v: uint8(0),
@@ -270,6 +278,7 @@ If an order has been pre-signed, it can be filled by providing a “null” sign
The pre-sign functions emit the entire order as an event, so that the order is easily indexable by subgraphs and thus easily indexable by subgraphs and thus easily discoverable without the need for an off-chain database.
.. code-block:: solidity
/// @dev Emitted when an `ERC721Order` is pre-signed.
/// Contains all the fields of the order.
event ERC721OrderPreSigned(
@@ -311,6 +320,7 @@ Filling an ERC721 Order
The basic functions used for filling NFT orders are the following:
.. code-block:: solidity
/// @dev Sells an ERC721 asset to fill the given order.
/// @param buyOrder The ERC721 buy order.
/// @param signature The order signature from the maker.
@@ -407,6 +417,7 @@ Cancelling an ERC721 Order
All orders, whether off-chain or on-chain, can only be cancelled on-chain. The following contract functions are used to cancel individual ERC721 and ERC1155 orders.
.. code-block:: solidity
/// @dev Cancel a single ERC721 order by its nonce. The caller
/// should be the maker of the order. Silently succeeds if
/// an order with the same nonce has already been filled or
@@ -427,6 +438,7 @@ Note that if there are multiple outstanding orders with the same nonce, calling
The following functions can be used to cancel multiple orders.
.. code-block:: solidity
/// @dev Cancel multiple ERC721 orders by their nonces. The caller
/// should be the maker of the orders. Silently succeeds if
/// an order with the same nonce has already been filled or

View File

@@ -9,7 +9,7 @@ This documentation is aimed to serve as the canonical technical documentation fo
- Subsections will provide a deep dive into each contracts
- Tutorial and tools to get started building with/on top of 0x Protocol
To learn more about why 0x Protocol was created, read the whitepaper `here <https://github.com/0xProject/whitepaper/blob/master/0x_white_paper.pdf>`_ and at `0xProtocol.org <httpsL//0xProtocol.org>`_.
To learn more about why 0x Protocol was created, read the whitepaper `here <https://github.com/0xProject/whitepaper/blob/master/0x_white_paper.pdf>`_ and at `0xProtocol.org <https://0xProtocol.org>`_.
All code is open sourced on `GitHub <https://github.com/0xProject/protocol>`_.

5
funding.json Normal file
View File

@@ -0,0 +1,5 @@
{
"opRetro": {
"projectId": "0x0fad18f37ecec4f4f4ca18e60c353eb11462363e8aa14562b5d96af54108d106"
}
}

View File

@@ -1,4 +1,79 @@
[
{
"version": "8.13.0",
"changes": [
{
"note": "Add Sepolia addresses"
}
],
"timestamp": 1700094997
},
{
"version": "8.12.0",
"changes": [
{
"note": "Add VelodromeV2 support on Base"
}
],
"timestamp": 1693346928
},
{
"version": "8.11.0",
"changes": [
{
"note": "Add MaverickV1 support on Ethereum, BSC, and Base"
}
],
"timestamp": 1692368658
},
{
"version": "8.10.0",
"changes": [
{
"note": "Add VelodromeV2 support on Optimism"
}
],
"timestamp": 1691617396
},
{
"version": "8.9.0",
"changes": [
{
"note": "Add Uniswap V3 router v2 support in Base FillQuoteTransformer"
}
],
"timestamp": 1689974915
},
{
"version": "8.8.0",
"changes": [
{
"note": "Add Base mainnet addresses"
},
{
"note": "Add UniswapV3 support in Avalanche and BSC FillQuoteTransformers"
}
],
"timestamp": 1689791426
},
{
"version": "8.7.0",
"changes": [
{
"note": "Add Trader Joe V2 MixIn to Arbitrum"
}
],
"timestamp": 1683749017
},
{
"version": "8.6.0",
"changes": [
{
"note": "Add Trader Joe V2.1 Router Support for MixIn"
}
],
"timestamp": 1682976338
},
{
"version": "8.5.0",
"changes": [

View File

@@ -6,6 +6,31 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v8.13.0 - _November 16, 2023_
* Add Sepolia addresses
## v8.12.0 - _August 29, 2023_
* Add VelodromeV2 support on Base
## v8.11.0 - _August 18, 2023_
* Add MaverickV1 support on Ethereum, BSC, and Base
## v8.10.0 - _August 9, 2023_
* Add VelodromeV2 support on Optimism
## v8.9.0 - _July 21, 2023_
* Add Uniswap V3 router v2 support in Base FillQuoteTransformer
## v8.8.0 - _July 19, 2023_
* Add Base mainnet addresses
* Add UniswapV3 support in Avalanche and BSC FillQuoteTransformers
## v8.7.0 - _May 10, 2023_
* Add Trader Joe V2 MixIn to Arbitrum
## v8.6.0 - _May 1, 2023_
* Add Trader Joe V2.1 Router Support for MixIn
## v8.5.0 - _April 20, 2023_
* Add Trader Joe V2 support on Avalanche

View File

@@ -18,7 +18,7 @@
"wethTransformer": "0xb2bc06a4efb20fc6553a69dbfa49b7be938034a7",
"payTakerTransformer": "0xea500d073652336a58846ada15c25f2c6d2d241f",
"affiliateFeeTransformer": "0x8146cbbe327364b13d0699f2ced39c637f92501a",
"fillQuoteTransformer": "0x21c3bee93fad436dedd29f971dc4fdf82f3e3a3a",
"fillQuoteTransformer": "0x2fd08c1f9fc8406c1d7e3a799a13883a7e7949f0",
"positiveSlippageFeeTransformer": "0x818a4a855bfeb16c305cb65e8d4fb239a308bc48"
}
},
@@ -64,7 +64,7 @@
"wethTransformer": "0xac3d95668c092e895cd83a9cbafe9c7d9906471f",
"payTakerTransformer": "0x7e788f3a3e39cdd1944ba111fafc5fb7e59b5e90",
"affiliateFeeTransformer": "0x043300d113de0c64684ab89c56a45cd94c7ef54c",
"fillQuoteTransformer": "0x43d10801db01c28093265ef9b77d532e553fa578",
"fillQuoteTransformer": "0x6073f12fc63bcc64bd4fed5d44aa1035e37d68ee",
"positiveSlippageFeeTransformer": "0x6ff35e8cbaf56d8a8f6bf9963b902a4576243030"
}
},
@@ -156,7 +156,7 @@
"wethTransformer": "0x9b8b52391071d71cd4ad1e61d7f273268fa34c6c",
"payTakerTransformer": "0xb9a4c32547bc3cdc2ee2fb13cc1a0717dac9888f",
"affiliateFeeTransformer": "0x105679f99d668001370b4621ad8648ac570c860f",
"fillQuoteTransformer": "0x540079df6023d39b2686fd9f6c06f1f8f66aca4a",
"fillQuoteTransformer": "0x463fe1a80acb62ce1e4f0a4f7b83df674c2cce2c",
"positiveSlippageFeeTransformer": "0xadbfdc58a24b6dbc16f21541800f43dd6e282250"
}
},
@@ -225,7 +225,7 @@
"wethTransformer": "0x02ce7af6520e2862f961f5d7eda746642865179c",
"payTakerTransformer": "0xa6c3ca183a67fcb4299fb4199c12ca74874ca489",
"affiliateFeeTransformer": "0x3102aea537ecb6f164550b094663c82a8c53a972",
"fillQuoteTransformer": "0xd140adb61d4e3e3978d4f32ac6b92240ff6e3a6e",
"fillQuoteTransformer": "0x521f3184ab27abde4a34e744a908b1a08dc8ef91",
"positiveSlippageFeeTransformer": "0x9a4947d3fb77a7afc2c9cd6714bbae96dddde059"
}
},
@@ -248,8 +248,54 @@
"wethTransformer": "0x10e968968f49dd66a5efeebbb2edcb9c49c4fc49",
"payTakerTransformer": "0xd81e65fc9bb7323bdbef8b2cdddd3b83fe41d630",
"affiliateFeeTransformer": "0x970e318b8f074c20bf0cee06970f01dc7a761e50",
"fillQuoteTransformer": "0x5d3a221bad31c3f3c07bea2f1de9b3ec17664b69",
"fillQuoteTransformer": "0x4a8815c2fc605e3b01aee52aade4d096c4e862c6",
"positiveSlippageFeeTransformer": "0x20f935b037e8490d8027f2751f9452725eee01ad"
}
},
"8453": {
"zrxToken": "0x0000000000000000000000000000000000000000",
"etherToken": "0x4200000000000000000000000000000000000006",
"zeroExGovernor": "0xecc4f2a8e0fd933623b2ea4ad84bffd12cb1286c",
"zrxVault": "0x0000000000000000000000000000000000000000",
"staking": "0x0000000000000000000000000000000000000000",
"stakingProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
"exchangeProxyGovernor": "0xecc4f2a8e0fd933623b2ea4ad84bffd12cb1286c",
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"exchangeProxyTransformerDeployer": "0x58bca53ebba1aaf25f0edcd8dad6421872fe20b2",
"exchangeProxyFlashWallet": "0xdb6f1920a889355780af7570773609bd8cb1f498",
"exchangeProxyLiquidityProviderSandbox": "0x0000000000000000000000000000000000000000",
"zrxTreasury": "0x0000000000000000000000000000000000000000",
"transformers": {
"wethTransformer": "0x63186ea36e78ecbf0128e448362f1b81e9bf7412",
"payTakerTransformer": "0x5cc22a0e06ea11097c612a962e63674b90e96099",
"affiliateFeeTransformer": "0x9e52d8b32d835206d09810c310593bcc77264066",
"fillQuoteTransformer": "0x2c46d57bb5af87a13a51dd5b62ba7d3bc7e12e9c",
"positiveSlippageFeeTransformer": "0xf98a130d3b4029c70e6d93098cb82a003421341e"
}
},
"11155111": {
"zrxToken": "0x0000000000000000000000000000000000000000",
"etherToken": "0xfff9976782d46cc05630d1f6ebab18b2324d6b14",
"zeroExGovernor": "0x5c1f7772ce24d942b85e9b6576f7b5ef70686f5a",
"zrxVault": "0x0000000000000000000000000000000000000000",
"staking": "0x0000000000000000000000000000000000000000",
"stakingProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
"exchangeProxyGovernor": "0x5c1f7772ce24d942b85e9b6576f7b5ef70686f5a",
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"exchangeProxyTransformerDeployer": "0x58bca53ebba1aaf25f0edcd8dad6421872fe20b2",
"exchangeProxyFlashWallet": "0xdb6f1920a889355780af7570773609bd8cb1f498",
"exchangeProxyLiquidityProviderSandbox": "0x0000000000000000000000000000000000000000",
"zrxTreasury": "0x0000000000000000000000000000000000000000",
"transformers": {
"wethTransformer": "0xf98a130d3b4029c70e6d93098cb82a003421341e",
"payTakerTransformer": "0x44e0f3975e95387f3866dd7cab1f51050394a3d1",
"affiliateFeeTransformer": "0x5cc22a0e06ea11097c612a962e63674b90e96099",
"fillQuoteTransformer": "0x63186ea36e78ecbf0128e448362f1b81e9bf7412",
"positiveSlippageFeeTransformer": "0x9e52d8b32d835206d09810c310593bcc77264066"
}
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-addresses",
"version": "8.5.0",
"version": "8.13.0",
"engines": {
"node": ">=6.12"
},

View File

@@ -1,20 +1,16 @@
import addresses from '../addresses.json';
export interface ContractAddresses {
zrxToken: string;
etherToken: string;
zeroExGovernor: string;
zrxVault: string;
staking: string;
stakingProxy: string;
erc20BridgeProxy: string;
erc20BridgeSampler: string;
exchangeProxyGovernor: string;
etherToken: string;
exchangeProxy: string;
exchangeProxyTransformerDeployer: string;
exchangeProxyFlashWallet: string;
exchangeProxyGovernor: string;
exchangeProxyLiquidityProviderSandbox: string;
zrxTreasury: string;
exchangeProxyTransformerDeployer: string;
staking: string;
stakingProxy: string;
transformers: {
wethTransformer: string;
payTakerTransformer: string;
@@ -22,20 +18,33 @@ export interface ContractAddresses {
affiliateFeeTransformer: string;
positiveSlippageFeeTransformer: string;
};
zeroExGovernor: string;
zrxToken: string;
zrxTreasury: string;
zrxVault: string;
}
export enum ChainId {
Mainnet = 1,
Goerli = 5,
Ganache = 1337,
Optimism = 10,
BSC = 56,
Polygon = 137,
PolygonMumbai = 80001,
Avalanche = 43114,
Fantom = 250,
Celo = 42220,
Optimism = 10,
Ganache = 1337,
Base = 8453,
Arbitrum = 42161,
Avalanche = 43114,
Celo = 42220,
PolygonMumbai = 80001,
Sepolia = 11155111
}
/**
* Narrow a JavaScript number to a Chain ID.
*/
export function isChainId(chainId: number): chainId is ChainId {
return Object.values(ChainId).includes(chainId);
}
/**

View File

@@ -2,7 +2,7 @@ import * as chai from 'chai';
import { bufferToHex, rlphash } from 'ethereumjs-util';
import 'mocha';
import { ChainId, getContractAddressesForChainOrThrow } from '../src';
import { ChainId, getContractAddressesForChainOrThrow, isChainId } from '../src';
const expect = chai.expect;
@@ -68,3 +68,12 @@ describe('addresses.json sanity test', () => {
});
});
});
describe("isChainId", () => {
it("should return true for existing chain ids", () => {
expect(isChainId(1)).to.be.true;
});
it("should return false for non-existing chain ids", () => {
expect(isChainId(666)).to.be.false;
});
});

View File

@@ -1,4 +1,13 @@
[
{
"version": "3.19.0",
"changes": [
{
"note": "Regenerate IZeroEx artifact"
}
],
"timestamp": 1682334742
},
{
"timestamp": 1674517560,
"version": "3.18.3",

View File

@@ -6,6 +6,9 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.19.0 - _April 24, 2023_
* Regenerate IZeroEx artifact
## v3.18.3 - _January 23, 2023_
* Dependencies updated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-artifacts",
"version": "3.18.3",
"version": "3.19.0",
"engines": {
"node": ">=6.12"
},

View File

@@ -1,4 +1,85 @@
[
{
"timestamp": 1700094997,
"version": "13.23.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1693346928,
"version": "13.23.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1692368658,
"version": "13.23.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1691617396,
"version": "13.23.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1689974915,
"version": "13.23.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1689791426,
"version": "13.23.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1683749017,
"version": "13.23.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1682976338,
"version": "13.23.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "13.23.0",
"changes": [
{
"note": "Regenerate IZeroEx wrapper"
}
],
"timestamp": 1682334742
},
{
"timestamp": 1681969282,
"version": "13.22.21",

View File

@@ -6,6 +6,33 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v13.23.8 - _November 16, 2023_
* Dependencies updated
## v13.23.7 - _August 29, 2023_
* Dependencies updated
## v13.23.6 - _August 18, 2023_
* Dependencies updated
## v13.23.5 - _August 9, 2023_
* Dependencies updated
## v13.23.4 - _July 21, 2023_
* Dependencies updated
## v13.23.3 - _July 19, 2023_
* Dependencies updated
## v13.23.2 - _May 10, 2023_
* Dependencies updated
## v13.23.1 - _May 1, 2023_
* Dependencies updated
## v13.23.0 - _April 24, 2023_
* Regenerate IZeroEx wrapper
## v13.22.21 - _April 20, 2023_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-wrappers",
"version": "13.22.21",
"version": "13.23.8",
"engines": {
"node": ">=6.12"
},
@@ -59,7 +59,7 @@
"dependencies": {
"@0x/assert": "^3.0.36",
"@0x/base-contract": "^7.0.0",
"@0x/contract-addresses": "^8.5.0",
"@0x/contract-addresses": "^8.13.0",
"@0x/json-schemas": "^6.4.4",
"@0x/types": "^3.3.7",
"@0x/utils": "^7.0.0",

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,85 @@
[
{
"timestamp": 1700094997,
"version": "11.24.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1693346928,
"version": "11.24.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "11.24.0",
"changes": [
{
"note": "Add MaverickV1 support on Ethereum, BSC, and Base"
}
],
"timestamp": 1692368658
},
{
"version": "11.23.0",
"changes": [
{
"note": "Add VelodromeV2 support on Optimism"
}
],
"timestamp": 1691617396
},
{
"timestamp": 1689974915,
"version": "11.22.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1689791426,
"version": "11.22.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1683749017,
"version": "11.22.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1682976338,
"version": "11.22.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "11.22.0",
"changes": [
{
"note": "Add MetaTransactionV2 utilities"
}
],
"timestamp": 1682334742
},
{
"version": "11.21.0",
"changes": [

View File

@@ -6,6 +6,33 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v11.24.2 - _November 16, 2023_
* Dependencies updated
## v11.24.1 - _August 29, 2023_
* Dependencies updated
## v11.24.0 - _August 18, 2023_
* Add MaverickV1 support on Ethereum, BSC, and Base
## v11.23.0 - _August 9, 2023_
* Add VelodromeV2 support on Optimism
## v11.22.4 - _July 21, 2023_
* Dependencies updated
## v11.22.3 - _July 19, 2023_
* Dependencies updated
## v11.22.2 - _May 10, 2023_
* Dependencies updated
## v11.22.1 - _May 1, 2023_
* Dependencies updated
## v11.22.0 - _April 24, 2023_
* Add MetaTransactionV2 utilities
## v11.21.0 - _April 20, 2023_
* Add Trader Joe V2 support on Avalanche

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/protocol-utils",
"version": "11.21.0",
"version": "11.24.2",
"engines": {
"node": ">=6.12"
},
@@ -62,8 +62,8 @@
},
"dependencies": {
"@0x/assert": "^3.0.36",
"@0x/contract-addresses": "^8.5.0",
"@0x/contract-wrappers": "^13.22.21",
"@0x/contract-addresses": "^8.13.0",
"@0x/contract-wrappers": "^13.23.8",
"@0x/json-schemas": "^6.4.4",
"@0x/subproviders": "^8.0.1",
"@0x/utils": "^7.0.0",

View File

@@ -12,6 +12,7 @@ export const NFTOrder = {
export * from './eip712_utils';
export * from './orders';
export * from './meta_transactions';
export * from './meta_transactions_v2';
export * from './signature_utils';
export * from './transformer_utils';
export * from './constants';

View File

@@ -0,0 +1,143 @@
import { getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
import { EIP712TypedData } from '@0x/types';
import { BigNumber, hexUtils, NULL_ADDRESS } from '@0x/utils';
import { ZERO } from './constants';
import {
createExchangeProxyEIP712Domain,
EIP712_DOMAIN_PARAMETERS,
getExchangeProxyEIP712Hash,
getTypeHash,
} from './eip712_utils';
export interface MetaTransactionV2Fee {
recipient: string,
amount: BigNumber,
}
const MTX_DEFAULT_VALUES = {
signer: NULL_ADDRESS,
sender: NULL_ADDRESS,
expirationTimeSeconds: ZERO,
salt: ZERO,
callData: hexUtils.leftPad(0),
feeToken: NULL_ADDRESS,
fees: [] as MetaTransactionV2Fee[],
chainId: 1,
verifyingContract: getContractAddressesForChainOrThrow(1).exchangeProxy,
};
export type MetaTransactionV2Fields = typeof MTX_DEFAULT_VALUES;
export class MetaTransactionV2 {
public static readonly FEE_STRUCT_NAME = 'MetaTransactionFeeData';
public static readonly FEE_STRUCT_ABI = [
{ type: 'address', name: 'recipient' },
{ type: 'uint256', name: 'amount' },
];
public static readonly FEE_TYPE_HASH = getTypeHash(MetaTransactionV2.FEE_STRUCT_NAME, MetaTransactionV2.FEE_STRUCT_ABI);
public static readonly MTX_STRUCT_NAME = 'MetaTransactionDataV2';
public static readonly MTX_STRUCT_ABI = [
{ type: 'address', name: 'signer' },
{ type: 'address', name: 'sender' },
{ type: 'uint256', name: 'expirationTimeSeconds' },
{ type: 'uint256', name: 'salt' },
{ type: 'bytes', name: 'callData' },
{ type: 'address', name: 'feeToken' },
{ type: `${MetaTransactionV2.FEE_STRUCT_NAME}[]`, name: 'fees' },
];
public static readonly MTX_TYPE_HASH = getTypeHash(
MetaTransactionV2.MTX_STRUCT_NAME,
MetaTransactionV2.MTX_STRUCT_ABI,
{ [MetaTransactionV2.FEE_STRUCT_NAME]: MetaTransactionV2.FEE_STRUCT_ABI }
);
public signer: string;
public sender: string;
public expirationTimeSeconds: BigNumber;
public salt: BigNumber;
public callData: string;
public feeToken: string;
public fees: MetaTransactionV2Fee[];
public chainId: number;
public verifyingContract: string;
public constructor(fields: Partial<MetaTransactionV2Fields> = {}) {
const _fields = { ...MTX_DEFAULT_VALUES, ...fields };
this.signer = _fields.signer;
this.sender = _fields.sender;
this.expirationTimeSeconds = _fields.expirationTimeSeconds;
this.salt = _fields.salt;
this.callData = _fields.callData;
this.feeToken = _fields.feeToken;
this.fees = _fields.fees;
this.chainId = _fields.chainId;
this.verifyingContract = _fields.verifyingContract;
}
public clone(fields: Partial<MetaTransactionV2Fields> = {}): MetaTransactionV2 {
return new MetaTransactionV2({
signer: this.signer,
sender: this.sender,
expirationTimeSeconds: this.expirationTimeSeconds,
salt: this.salt,
callData: this.callData,
feeToken: this.feeToken,
fees: this.fees,
chainId: this.chainId,
verifyingContract: this.verifyingContract,
...fields,
});
}
public getStructHash(): string {
const feesHash = hexUtils.hash(hexUtils.concat(
...this.fees.map((fee) => hexUtils.hash(hexUtils.concat(
hexUtils.leftPad(MetaTransactionV2.FEE_TYPE_HASH),
hexUtils.leftPad(fee.recipient),
hexUtils.leftPad(fee.amount),
)))
));
return hexUtils.hash(
hexUtils.concat(
hexUtils.leftPad(MetaTransactionV2.MTX_TYPE_HASH),
hexUtils.leftPad(this.signer),
hexUtils.leftPad(this.sender),
hexUtils.leftPad(this.expirationTimeSeconds),
hexUtils.leftPad(this.salt),
hexUtils.hash(this.callData),
hexUtils.leftPad(this.feeToken),
hexUtils.leftPad(feesHash),
),
);
}
public getEIP712TypedData(): EIP712TypedData {
return {
types: {
EIP712Domain: EIP712_DOMAIN_PARAMETERS,
[MetaTransactionV2.MTX_STRUCT_NAME]: MetaTransactionV2.MTX_STRUCT_ABI,
[MetaTransactionV2.FEE_STRUCT_NAME]: MetaTransactionV2.FEE_STRUCT_ABI,
},
domain: createExchangeProxyEIP712Domain(this.chainId, this.verifyingContract) as any,
primaryType: MetaTransactionV2.MTX_STRUCT_NAME,
message: {
signer: this.signer,
sender: this.sender,
expirationTimeSeconds: this.expirationTimeSeconds.toString(10),
salt: this.salt.toString(10),
callData: this.callData,
feeToken: this.feeToken,
fees: this.fees.map(({recipient, amount}) => ({
recipient,
amount: amount.toString(10),
})) as any,
},
};
}
public getHash(): string {
return getExchangeProxyEIP712Hash(this.getStructHash(), this.chainId, this.verifyingContract);
}
}

View File

@@ -166,6 +166,8 @@ export enum BridgeProtocol {
KyberElastic,
Barter,
TraderJoeV2,
VelodromeV2,
MaverickV1,
}
/**

View File

@@ -0,0 +1,66 @@
import { chaiSetup, } from '@0x/dev-utils';
import { BigNumber } from '@0x/utils';
import { expect } from 'chai';
import { MetaTransactionV2 } from '../src/meta_transactions_v2';
chaiSetup.configure();
describe('mtxs v2', () => {
describe('MetaTransactionV2 (no fees)', () => {
const mtx = new MetaTransactionV2({
signer: '0x349e8d89e8b37214d9ce3949fc5754152c525bc3',
sender: '0x83c62b2e67dea0df2a27be0def7a22bd7102642c',
expirationTimeSeconds: new BigNumber(9101112),
salt: new BigNumber(2001),
callData: '0x12345678',
feeToken: '0xcc3c7ea403427154ec908203ba6c418bd699f7ce',
fees: [] as any,
chainId: 8008,
verifyingContract: '0x6701704d2421c64ee9aa93ec7f96ede81c4be77d',
});
it('can get the struct hash', () => {
const actual = mtx.getStructHash();
const expected = '0x57db4055edfed82a6d86103197c21390bf29412fb4585e08c708454e03d92516';
expect(actual).to.eq(expected);
});
it('can get the EIP712 hash', () => {
const actual = mtx.getHash();
const expected = '0x05fc975cb9f37cc442a2975bc479502ce33d2d068fe8a1d6f50dbb11c1499137';
expect(actual).to.eq(expected);
});
});
describe('MetaTransactionV2 (two fees)', () => {
const mtx = new MetaTransactionV2({
signer: '0x349e8d89e8b37214d9ce3949fc5754152c525bc3',
sender: '0x83c62b2e67dea0df2a27be0def7a22bd7102642c',
expirationTimeSeconds: new BigNumber(9101112),
salt: new BigNumber(2001),
callData: '0x12345678',
feeToken: '0xcc3c7ea403427154ec908203ba6c418bd699f7ce',
fees: [{
recipient: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
amount: new BigNumber(1000000),
}, {
recipient: '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',
amount: new BigNumber(1000),
}] as any,
chainId: 8008,
verifyingContract: '0x6701704d2421c64ee9aa93ec7f96ede81c4be77d',
});
it('can get the struct hash', () => {
const actual = mtx.getStructHash();
const expected = '0x441c8b8a8f25c1716f2880326d008d07d0b8eb9606623c0a81dd5d9fa14dd12e';
expect(actual).to.eq(expected);
});
it('can get the EIP712 hash', () => {
const actual = mtx.getHash();
const expected = '0xfc85ef2149bd49fcc8fee2571ed8f0ecd671dec03845637ab1ded3d891ac3386';
expect(actual).to.eq(expected);
});
});
});