Compare commits

...

360 Commits

Author SHA1 Message Date
Github Actions
9c821dbfc3 Publish
- @0x/contracts-asset-proxy@3.6.1
 - @0x/contracts-broker@1.1.9
 - @0x/contracts-coordinator@3.1.10
 - @0x/contracts-dev-utils@1.3.8
 - @0x/contracts-erc1155@2.1.10
 - @0x/contracts-erc20@3.2.4
 - @0x/contracts-erc721@3.1.10
 - @0x/contracts-exchange-forwarder@4.2.10
 - @0x/contracts-exchange-libs@4.3.10
 - @0x/contracts-exchange@3.2.10
 - @0x/contracts-extensions@6.2.4
 - @0x/contracts-integrations@2.7.3
 - @0x/contracts-multisig@4.1.10
 - @0x/contracts-staking@2.0.17
 - @0x/contracts-test-utils@5.3.7
 - @0x/contracts-utils@4.5.4
 - @0x/contracts-zero-ex@0.5.1
 - @0x/asset-swapper@4.8.1
 - @0x/contract-addresses@5.0.1
 - @0x/contract-wrappers-test@12.2.20
 - @0x/contract-wrappers@13.9.2
 - @0x/migrations@6.4.4
 - @0x/order-utils@10.4.2
2020-10-28 02:10:57 +00:00
Github Actions
af1b890423 Updated CHANGELOGS & MD docs 2020-10-28 02:10:51 +00:00
Romain Butteaud
673835d2de fix: update kovan erc20BridgeSampler (#14)
* fix: update kovan erc20BridgeSampler

* fix update CHANGELOG
2020-10-27 17:51:51 -07:00
Greg Hysz
500b57e935 Adds Template for Specs (#12)
* Adds `docs` directory, along with boilerplate code and templates for readthedocs.org.

* docs: update orders spec

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2020-10-27 16:31:15 -07:00
Jacob Evans
3f7d0580c1 Set the FeeSchedule to Required (#15) 2020-10-28 09:26:14 +10:00
Github Actions
a71c356bba Publish
- @0x/contracts-asset-proxy@3.6.0
 - @0x/contracts-broker@1.1.8
 - @0x/contracts-coordinator@3.1.9
 - @0x/contracts-dev-utils@1.3.7
 - @0x/contracts-erc1155@2.1.9
 - @0x/contracts-erc20@3.2.3
 - @0x/contracts-erc721@3.1.9
 - @0x/contracts-exchange-forwarder@4.2.9
 - @0x/contracts-exchange-libs@4.3.9
 - @0x/contracts-exchange@3.2.9
 - @0x/contracts-extensions@6.2.3
 - @0x/contracts-integrations@2.7.2
 - @0x/contracts-multisig@4.1.9
 - @0x/contracts-staking@2.0.16
 - @0x/contracts-test-utils@5.3.6
 - @0x/contracts-utils@4.5.3
 - @0x/contracts-zero-ex@0.5.0
 - @0x/asset-swapper@4.8.0
 - @0x/contract-addresses@5.0.0
 - @0x/contract-wrappers-test@12.2.19
 - @0x/contract-wrappers@13.9.1
 - @0x/migrations@6.4.3
 - @0x/order-utils@10.4.1
2020-10-27 21:13:56 +00:00
Github Actions
c3a95b7fb1 Updated CHANGELOGS & MD docs 2020-10-27 21:13:47 +00:00
Lawrence Forman
f01540fb35 fix publish 2020-10-27 16:42:30 -04:00
Daniel Pyrathon
689a8881c2 fix: Changed price-aware RFQ flag to be a argument parameter (#13)
* Changed price-aware RFQ flag to be a argument parameter

* prettified tests

* lint
2020-10-27 12:56:26 -07:00
Jacob Evans
99f5be8378 chore: [asset swapper] sampler Solidity 0.6 + Bridge addresses in AS (#4)
* Refactor excess interfaces

* Compiles on 0.6

* Refactored into try/catch

* Rebase and Refactored to v06

* Handle invalid registry in LP

* Update packages/asset-swapper/contracts/src/LiquidityProviderSampler.sol

Co-authored-by: Lawrence Forman <lawrence@0xproject.com>

* chore: [asset-swapper] Move Bridge Addresses and Gas schedule

* curve->pool

* lint

* Refactor to fix module load order

* Move FEE Schedule

* rollup: Swerve/Sushi/SnowSwap/DODO (#7)

* rollup: Swerve/Sushi

* DODO Rollup + Snowswap Swerve

* hardcode addresses temporarily

* rebase

* rename to SUSHISWAP_ROUTER

* CHANGELOGs

* CHANGELOGs

Co-authored-by: Lawrence Forman <lawrence@0xproject.com>
2020-10-27 15:16:09 +10:00
Lawrence Forman
8de0282d92 fix run:publish:gha package script 2020-10-23 17:11:56 -04:00
Github Actions
f99804d56a Publish
- @0x/contracts-integrations@2.7.1
 - @0x/contracts-zero-ex@0.4.0
 - @0x/asset-swapper@4.7.1
 - @0x/contract-wrappers-test@12.2.18
 - @0x/migrations@6.4.2
2020-10-23 21:08:02 +00:00
Github Actions
f13d27b749 Updated CHANGELOGS & MD docs 2020-10-23 21:07:56 +00:00
Lawrence Forman
465fd59cbc add publish github action 2020-10-23 16:56:36 -04:00
F. Eugene Aumson
5fdabe6612 Change contracts/integrations to use LOCAL a-s (#9)
Change contracts/integrations/package.json to refer to the LOCAL
asset-swapper, not a gitpkg one, since asset-swapper does live in this
same repo now.
2020-10-23 13:21:25 -04:00
Steve Marx
861871134b add LibTokenSpender and convert to using that (#3)
add LibTokenSpender and convert to using that

This skips the allowance target. Allowances are instead just set on the
exchange proxy itself. There is a fallback, though, to try spending from
the allowance target if the original transfer fails.
2020-10-23 10:45:46 -04:00
Daniel Pyrathon
c246d98093 Merge pull request #1 from 0xProject/asset-swapper-update-lockfile
updated lockfile
2020-10-21 10:20:01 -07:00
Daniel Pyrathon
02076dba1b updated lockfile 2020-10-21 10:07:56 -07:00
Lawrence Forman
7b136a5ad8 Publish
- @0x/contracts-asset-proxy@3.5.0
 - @0x/contracts-broker@1.1.7
 - @0x/contracts-coordinator@3.1.8
 - @0x/contracts-dev-utils@1.3.6
 - @0x/contracts-erc1155@2.1.8
 - @0x/contracts-erc20@3.2.2
 - @0x/contracts-erc721@3.1.8
 - @0x/contracts-exchange-forwarder@4.2.8
 - @0x/contracts-exchange-libs@4.3.8
 - @0x/contracts-exchange@3.2.8
 - @0x/contracts-extensions@6.2.2
 - @0x/contracts-integrations@2.7.0
 - @0x/contracts-multisig@4.1.8
 - @0x/contracts-staking@2.0.15
 - @0x/contracts-test-utils@5.3.5
 - @0x/contracts-utils@4.5.2
 - @0x/contracts-zero-ex@0.3.0
 - @0x/asset-swapper@4.7.0
 - @0x/contract-addresses@4.12.0
 - @0x/contract-artifacts@3.8.0
 - @0x/contract-wrappers-test@12.2.17
 - @0x/contract-wrappers@13.9.0
 - @0x/migrations@6.4.1
 - @0x/order-utils@10.4.0
2020-10-21 03:33:23 -04:00
Lawrence Forman
0c4a67fa35 Updated CHANGELOGS & MD docs 2020-10-21 03:33:18 -04:00
Lawrence Forman
668aeb77f7 disable coverage ci job 2020-10-21 03:08:33 -04:00
Lawrence Forman
135ae392d5 add @0x/asset-swapper to non contract packages
fix missing non-dev dep in `@0x/contracts-coordinator`
2020-10-21 02:53:41 -04:00
Lawrence Forman
88ba04307c update deps 2020-10-21 02:27:55 -04:00
Lawrence Forman
e4b8000a48 update yarn.lock 2020-10-21 02:14:47 -04:00
Lawrence Forman
b9df108314 disable doc gen on contract packages 2020-10-21 02:13:27 -04:00
Lawrence Forman
6106185bf6 disable testing inactive packages in ci 2020-10-21 02:11:04 -04:00
Lawrence Forman
3a3e289864 pin doc related deps and regen yarn lock 2020-10-21 01:56:47 -04:00
Lawrence Forman
6558632f10 remove bundlewatch from static-tests ci job 2020-10-21 01:18:41 -04:00
Lawrence Forman
376ee6bdff fix missing non-dev dependencies in packages 2020-10-21 01:18:41 -04:00
Lawrence Forman
fc5d759131 update typedoc-plugin-markdown deps
fix broken static-tests ci job
2020-10-21 00:54:56 -04:00
Lawrence Forman
7c16bb3df8 update prettierrc and run prettier 2020-10-20 23:52:44 -04:00
Lawrence Forman
5df74d35d0 @0x/contract-artifacts: Fix contract-artifacts tests 2020-10-20 23:24:42 -04:00
Lawrence Forman
72fc0c845a Fix prettier minor version.
update lock file
2020-10-20 23:24:08 -04:00
Lawrence Forman
b995715a2c update URLs in package manifests 2020-10-20 23:08:05 -04:00
Lawrence Forman
857b5c97b0 update deps 2020-10-20 23:00:26 -04:00
Lawrence Forman
178d9c280a update repo scripts 2020-10-20 22:59:39 -04:00
Lawrence Forman
2416deba25 update root package.json 2020-10-20 20:53:39 -04:00
Lawrence Forman
0ce6243653 update @0x/tools deps
skip kyber bridge tests
ignore some contract packages in tests by default
update package deps
update README, CI, and GH configs
2020-10-20 20:53:39 -04:00
Lawrence Forman
40dc10729b delete packages 2020-10-20 20:53:39 -04:00
Daniel Pyrathon
0571244e9e Merge pull request #2720 from 0xProject/refactor_rfq_comparison_price_integration
feat: Refactor rfq comparison price integration
2020-10-20 16:17:04 -07:00
Daniel Pyrathon
3213131cad Merge pull request #2735 from 0xProject/rfqt_comparison_feature_flag
Rfqt comparison feature flag
2020-10-20 15:48:29 -07:00
F. Eugene Aumson
61bf93aac2 Leave link to PR in comments 2020-10-20 14:30:04 -04:00
F. Eugene Aumson
a9d0cec6d1 Ran prettier 2020-10-20 14:17:48 -04:00
F. Eugene Aumson
b5e3f0b90c Disable tests per IS_PRICE_AWARE_RFQ_ENABLED flag 2020-10-20 13:48:46 -04:00
F. Eugene Aumson
61f1fe42b0 Merge branch 'refactor_rfq_comparison_price_integration' into rfqt_comparison_feature_flag 2020-10-20 13:48:27 -04:00
F. Eugene Aumson
1cfdc49021 Ran prettier 2020-10-20 12:15:44 -04:00
Lawrence Forman
c4d58277cf Merge pull request #2738 from 0xProject/feat/sol-compiler/changelog-fix
add updated changelog for sol-compiler
2020-10-20 12:10:18 -04:00
Lawrence Forman
9ac66c2130 add updated changelog for sol-compiler 2020-10-20 12:09:02 -04:00
Daniel Pyrathon
6366163006 small lint fix 2020-10-19 17:09:37 -07:00
Daniel Pyrathon
85fde8f9a5 comments and renaming 2020-10-19 17:03:26 -07:00
Daniel Pyrathon
a03d0800b0 Add changes for the feature flag 2020-10-19 16:58:45 -07:00
Romain Butteaud
9cb21006a7 Merge pull request #2729 from 0xProject/feat/snowswap
feat: SnowSwap
2020-10-19 16:21:31 -07:00
Romain Butteaud
649202f1c4 fix: prettier 2020-10-19 14:59:18 -07:00
Romain Butteaud
b798556774 feat: adjusting CURVE_CALL_GAS for SnowSwap, disabling yVaultUSDUnderlying pool for underlying tokens 2020-10-19 13:24:44 -07:00
Romain Butteaud
03bc15fbdf fix: add _target comment for Swerve pool 2020-10-19 13:24:44 -07:00
Romain Butteaud
b2dfd8740c feat: fix CURVE_CALL_GAS and SnowSwap pool addresses 2020-10-19 13:24:44 -07:00
Romain Butteaud
3182c12b4d feat: use pool attribute instead of curve for all Curve like pools 2020-10-19 13:24:44 -07:00
Romain Butteaud
f783625d60 feat: adding yVaultUSDUnderlying 2020-10-19 13:24:44 -07:00
Romain Butteaud
891aa8e8bf feat: SnowSwap 2020-10-19 13:24:44 -07:00
Daniel Pyrathon
4b508d255d Merge branch 'development' of github.com:0xProject/0x-monorepo into refactor_rfq_comparison_price_integration 2020-10-19 13:04:25 -07:00
Lawrence Forman
1cad43bf5d Merge pull request #2733 from 0xProject/feat/sol-compiler/0.7.x-pr-2710
sol-compiler: support 0.7x (#2710)
2020-10-19 13:41:07 -04:00
Lawrence Forman
a0cd727832 @0x/sol-compiler: Update changelog 2020-10-19 13:40:36 -04:00
Lawrence Forman
ab90e15015 @0x.js: add pinned node types to 0x.js 2020-10-19 13:03:48 -04:00
Lawrence Forman
52cbddf054 @0x/sol-compiler: fix build error with new node types 2020-10-19 12:25:01 -04:00
Lawrence Forman
db98ff8cb7 fix sol-compiler linter error
pin `@types/node` to appease publish job
2020-10-19 12:04:38 -04:00
Lawrence Forman
1d8dd2f89c Merge pull request #2710 from HenryNguyen5/feature/sol-compiler_support_v0.7
Support solidity v0.7.x
2020-10-19 11:52:17 -04:00
Daniel Pyrathon
0ae1c926d3 Merge branch 'development' of github.com:0xProject/0x-monorepo into refactor_rfq_comparison_price_integration
# Conflicts:
#	packages/asset-swapper/src/utils/market_operation_utils/index.ts
2020-10-16 15:16:59 -07:00
Daniel Pyrathon
1fcab58e2f cheap lint fix 2020-10-16 14:49:25 -07:00
Daniel Pyrathon
a8cbd1a16c apply PR feedback 2020-10-16 14:47:37 -07:00
Alex Kroeger
3aaa0ad6b2 Merge pull request #2715 from 0xProject/feat/add-cream
feat: Add CREAM as a liquidity source
2020-10-16 14:18:09 -07:00
HenryNguyen5
e34bc77157 Support solidity v0.7.x 2020-10-16 17:02:39 -04:00
Alex Kroeger
088b331f19 Prettier, cleared up naming 2020-10-16 10:28:48 -07:00
Alex Kroeger
56f2dec441 Merge branch 'development' into feat/add-cream 2020-10-16 10:23:38 -07:00
Alex Kroeger
ac8b08d3cf Fix type error in migrations 2020-10-15 23:35:23 -07:00
Jacob Evans
c4ead689a9 fix: [asset-swapper] excludedFeeSources. DODO Trade Allowed (#2731)
* fix: Fee sources and Ganache existence

* Added excludedFeeSources

* Comments and CHANGELOG

* fix: DODO Trade Allowed (#2732)
2020-10-16 10:01:12 +10:00
Alex Kroeger
07ab10b000 Deployed CreamBridge, refactor to simplify code 2020-10-15 16:58:39 -07:00
F. Eugene Aumson
c969a8652a Reduce solidity compiler optimizer runs...
...in order to accomodate now-too-big contract TestERC20BridgeSampler,
which imports the recently-added-to NativeOrderSampler.sol.

Fixes test failing like:
  1) erc20-bridge-sampler
       "before all" hook in "erc20-bridge-sampler":
     RuntimeError: VM Exception while processing transaction: out of gas
2020-10-15 13:18:31 -04:00
Jacob Evans
fb21ca5404 fix: [asset-swapper] MultiHop edge cases (#2730)
* fix: [asset-swapper] MultiHop edge cases

* CHANGELOG
2020-10-15 17:31:22 +10:00
Alex Kroeger
bbfa9c34ab Add CREAM to market operation utils constants 🤦 2020-10-14 12:42:06 -07:00
Alex Kroeger
7161bbe836 prettier 2020-10-14 11:38:05 -07:00
Alex Kroeger
ef65aa5bf6 further fixes in market operation utils 2020-10-14 11:37:03 -07:00
F. Eugene Aumson
2cf31f05a1 Drop |undefined from type of optional param
Addresses review comment https://github.com/0xProject/0x-monorepo/pull/2720#discussion_r500453526
2020-10-14 13:23:02 -04:00
F. Eugene Aumson
2b1a1ba0db Fix failing test-doc-generation 2020-10-14 13:21:14 -04:00
F. Eugene Aumson
05b25c6229 Ran prettier 2020-10-14 13:02:17 -04:00
F. Eugene Aumson
2db52c6983 Fixed linter error
ERROR: 793:24  no-unnecessary-type-assertion  This assertion is unnecessary since it does not change the type of the expression.
2020-10-14 13:02:17 -04:00
Alex Kroeger
4803e2f68c Add peer dependencies for cream-sor, small fix to sampler routing 2020-10-14 09:56:23 -07:00
F. Eugene Aumson
7030572f1d Stop referring to GetMarketOrdersOpts.shouldBat...
Because it doesn't exist on that type.
2020-10-14 11:58:18 -04:00
F. Eugene Aumson
6e2eb9c5bb Merge branch 'development' into refactor_rfq_comparison_price_integration 2020-10-14 11:57:58 -04:00
Alex Kroeger
eb27e260e0 merged into development to grab dodo 2020-10-13 23:23:05 -07:00
Alex Kroeger
c72aa653e8 Integrated CREAM into asset-swapper 2020-10-13 20:27:08 -07:00
Jacob Evans
4d04b72674 feat: DODO (#2701)
* feat: DODO

* DODO Bridge

* export DODOFillData

* Use deployed DODOHelper

* Deployed Bridge. Half of buys supported

* other half of buys

* refactor

* CHANGELOGs

* Lint
2020-10-13 18:20:31 +10:00
F. Eugene Aumson
e3b92d2c8b Fix linter errors 2020-10-12 18:01:22 -04:00
F. Eugene Aumson
4aa5a89cd7 Merge branch 'development' into refactor_rfq_comparison_price_integration 2020-10-12 12:44:30 -04:00
Alex Kroeger
c6b9ea5723 Merge branch 'development' into feat/add-cream 2020-10-11 20:11:24 -07:00
Alex Kroeger
2dc0bff1ea Merge pull request #2725 from 0xProject/refactor-asset-swapper-v1
removed v0-specific code in asset-swapper
2020-10-09 09:55:15 -07:00
Alex Kroeger
408e66e8b4 altered changelog wording 2020-10-08 16:54:16 -07:00
Alex Kroeger
40fe12a86b Updated changelog 2020-10-08 16:52:14 -07:00
Alex Kroeger
1adb56f092 prettier 🤦 2020-10-08 16:43:52 -07:00
Alex Kroeger
629d48c766 removed unused functions 2020-10-08 16:43:52 -07:00
Alex Kroeger
c8886febb9 removed v0-specific code in asset-swapper 2020-10-08 16:43:52 -07:00
Daniel Pyrathon
efe598c8fd Merge branch 'development' of github.com:0xProject/0x-monorepo into refactor_rfq_comparison_price_integration 2020-10-08 15:27:14 -07:00
mzhu25
32218ce25e Merge pull request #2728 from 0xProject/fix/uint80
add abi encoder support for uint80 lol
2020-10-08 15:12:57 -07:00
F. Eugene Aumson
f7ae697475 Merge pull request #2726 from 0xProject/fix/asset-swapper/rfqtMakerInteraction-with-blacklisting
asset-swapper: isBlacklisted in rfqtMakerInteraction
2020-10-08 14:19:10 -04:00
F. Eugene Aumson
6e954385ce Include requestParams in maker-blacklisted log
Addresses review comment https://github.com/0xProject/0x-monorepo/pull/2726#discussion_r501332160
2020-10-08 09:15:58 -04:00
Daniel Pyrathon
f8df89b506 fixed broken package 2020-10-07 23:49:04 -07:00
Daniel Pyrathon
a3ff406461 update quote server 2020-10-07 19:37:38 -07:00
Daniel Pyrathon
221de054f4 fixes a few issues with the typing 2020-10-07 19:34:12 -07:00
Michael Zhu
98e6aa4bac add abi encoder support for uint80 lol 2020-10-07 18:40:17 -07:00
Daniel Pyrathon
199808dc44 Merge branch 'development' of github.com:0xProject/0x-monorepo into refactor_rfq_comparison_price_integration
# Conflicts:
#	packages/asset-swapper/src/utils/market_operation_utils/index.ts
2020-10-07 14:28:35 -07:00
F. Eugene Aumson
5d8e35fb68 asset-swapp: isBlacklisted in rfqtMakerInteraction 2020-10-07 16:32:22 -04:00
Jacob Evans
36546480b1 fix: [asset-swapper] Catch Uint256BinOp which can occur (#2724)
* fix: [asset-swapper] Catch Uint256BinOp which can occur

* Perform a local bounds check
2020-10-07 17:36:44 +10:00
Jacob Evans
cd9e408ea3 fix: exchange proxy overhead scaled by gas price (#2723) 2020-10-06 21:09:46 +10:00
Jacob Evans
7698f21517 feat: [asset-swapper] Shell 🐚 (#2722)
* feat: [asset-swapper] Shell

* Deployed and Changelogs

* Glue up the deployed address

* Glue for FQT rollup
2020-10-06 15:55:51 +10:00
mzhu25
10724e5745 Merge pull request #2691 from 0xProject/feature/liquidity_provider_swap
`@0x/contracts-zero-ex`: LiquidityProviderFeature
2020-10-05 19:01:41 -07:00
Daniel Pyrathon
dde76a4dbb Mark decimal places 2020-10-05 17:36:52 -07:00
Michael Zhu
86ff5c53bb account for EP gas overhead in multihop 2020-10-05 17:33:13 -07:00
Daniel Pyrathon
efef5f122f added fix 2020-10-05 17:24:23 -07:00
Daniel Pyrathon
83c942ad8c Added fix for decimals 2020-10-05 17:20:43 -07:00
Michael Zhu
31e90e314c lint 2020-10-05 10:20:54 -07:00
Michael Zhu
33caae705e Update changelogs 2020-10-05 10:09:06 -07:00
Michael Zhu
961273a2ff Fix broken test 2020-10-05 10:09:06 -07:00
Michael Zhu
46e512a27c Fix test-doc-generation 2020-10-05 10:09:06 -07:00
Michael Zhu
290a04a0ad Appease linter 2020-10-05 10:09:06 -07:00
Michael Zhu
12ff4ec438 Add tests for exchange proxy gas overhead accounting in the path optimizer 2020-10-05 10:09:06 -07:00
Michael Zhu
1c15ecacb0 add tests for LiquidityProviderFeature 2020-10-05 10:09:06 -07:00
Michael Zhu
c6d738ed0c Refactor asset-swapper 2020-10-05 10:09:06 -07:00
Michael Zhu
f089f5d87f Add migrate function to LiquidityProviderFeature 2020-10-05 09:43:19 -07:00
Michael Zhu
78e3cd39d1 @0x/contracts-zero-ex: Add LiquidityProviderFeature contracts 2020-10-05 09:43:19 -07:00
Daniel Pyrathon
1588c1f362 Added initial unit tests and implementation 2020-10-02 15:04:50 -07:00
F. Eugene Aumson
a35d1b8a9d Merge pull request #2714 from 0xProject/feat/asset-swapper/rfq-maker-blacklist-logging
asset-swapper: log RFQ maker (un)blacklistings
2020-10-02 15:52:23 -04:00
F. Eugene Aumson
32923ec7e1 Blacklist for timeout === max, not just > 2020-10-02 14:18:31 -04:00
F. Eugene Aumson
5a3bd716ad Merge branch 'development' into feat/asset-swapper/rfq-maker-blacklist-logging 2020-10-02 13:44:31 -04:00
F. Eugene Aumson
84862f15c1 Store blacklistedUntil as local var, don't ref map
Addresses review comment https://github.com/0xProject/0x-monorepo/pull/2714#discussion_r497816501
2020-10-02 13:43:17 -04:00
Daniel Pyrathon
9e42dce5c4 added initial implementation 2020-10-01 14:28:36 -07:00
Daniel Pyrathon
a360109013 Merge pull request #2716 from 0xProject/fix/buy-orders-quote-report
fix: fixed a small bug with buys and quote reporter
2020-10-01 10:39:47 -07:00
F. Eugene Aumson
68d6b3a033 Merge branch 'development' into feat/asset-swapper/rfq-maker-blacklist-logging 2020-10-01 12:09:28 -04:00
Daniel Pyrathon
733c3046bc fixed a small bug with buys and quote reporter 2020-09-30 17:02:09 -07:00
Daniel Pyrathon
23d4b6bf1c Merge branch 'development' of github.com:0xProject/0x-monorepo into refactor_rfq_request_positioning
# Conflicts:
#	packages/asset-swapper/src/utils/market_operation_utils/index.ts
2020-09-30 16:59:21 -07:00
Daniel Pyrathon
39bd0c5459 Merge pull request #2713 from 0xProject/refactor_reporter
[Price-aware RFQ requests] Decouple QuoteReporter from _generateOptimizedOrdersAsync
2020-09-30 14:11:43 -07:00
Daniel Pyrathon
c13ffb2072 added linting and prettifying 2020-09-30 13:54:48 -07:00
Daniel Pyrathon
38bcab1f86 Merge branch 'development' of github.com:0xProject/0x-monorepo into refactor_rfq_request_positioning 2020-09-30 11:18:32 -07:00
Daniel Pyrathon
a24f01c90f added a few fixed and added some comments: 2020-09-29 23:07:14 -07:00
Daniel Pyrathon
708e34602b added further unit tests 2020-09-29 23:00:02 -07:00
Daniel Pyrathon
d60c8ddd5a added more unit tests 2020-09-29 22:25:24 -07:00
Daniel Pyrathon
eea63292f0 added initial RFQ tests 2020-09-29 17:02:12 -07:00
Alex Kroeger
a97342a594 updated changelog 2020-09-29 13:06:36 -07:00
Alex Kroeger
00f55be83e Added cream bridge contract 2020-09-29 12:59:54 -07:00
Daniel Pyrathon
90ed283b20 performed linting 2020-09-29 02:08:00 -07:00
Daniel Pyrathon
61272961a8 fixed a broken import, renamed variable 2020-09-29 02:02:17 -07:00
Daniel Pyrathon
507690f9db refactor coding and avoid running indicative quotes when sampling market liquidity 2020-09-29 00:59:14 -07:00
Daniel Pyrathon
90ad5eb6c4 refactor market side ops 2020-09-28 13:57:30 -07:00
Daniel Pyrathon
7bc9701c81 initial implementation 2020-09-28 13:15:44 -07:00
Daniel Pyrathon
a7d502a501 create quote report regardless of RFQT 2020-09-28 12:53:40 -07:00
F. Eugene Aumson
fbe99b41f8 asset-swapper: log RFQ maker (un)blacklistings 2020-09-28 14:14:52 -04:00
Lawrence Forman
66e2d93e9c Merge pull request #2711 from 0xProject/fix/balancer-sampling
Handle max in/out ratio reverts in Balancer sampling functions
2020-09-25 00:45:47 -04:00
Lawrence Forman
4672c72fef @0x/asset-swapper: compute max quote slippage from the first non-native order in getSwapMinBuyAmount() 2020-09-24 23:22:27 -04:00
Lawrence Forman
ac6b03cd4a fix LP and MB sources leaking into getSell/BuyOperations() when they should be disabled 2020-09-24 23:22:27 -04:00
Lawrence Forman
d7de191947 @0x/asset-swapper: Handle native orders in getSwapMinBuyAmount() 2020-09-24 23:22:27 -04:00
Lawrence Forman
de7f1fc207 @0x/asset-swapper: rename getMinBuyAmount() to getSwapMinBuyAmount()` and export for use in API. 2020-09-24 23:22:27 -04:00
Lawrence Forman
99de5a3814 @0x/asset-swapper: factor affiliate fees into new minBuyAmount calculation in EP consumer 2020-09-24 23:22:27 -04:00
Lawrence Forman
4cf566cad8 @0x/asset-swapper: Special case two-hop quotes in getMinBuyAmount() 2020-09-24 23:22:27 -04:00
Lawrence Forman
6138955f93 @0x/asset-swapper: respect max slippage in EP consumer 2020-09-24 23:22:27 -04:00
Michael Zhu
a57cf68ee4 Handle max in/out ratio reverts in Balancer sampling functions 2020-09-24 23:22:25 -04:00
Daniel Pyrathon
20edcd1ae5 lint and fix 2020-09-24 16:32:56 -07:00
Daniel Pyrathon
5333befd89 optionally return a quote report too 2020-09-24 15:37:18 -07:00
Daniel Pyrathon
235e406620 initial decoupling of Quote reporter 2020-09-24 15:27:55 -07:00
Kim Persson
5f570b772d asset-swapper: Quote report pass back optional fill data (#2702)
* ADDS quote report: pass back optional fill data for dex samples

* ADDS return fillData for Multihop in quote report

* FIXES quote report generator tests handle passing back fillData

* FIXES typing multi hop report source will always have fillData

* ADDS asset-swapper CHANGELOG entry
2020-09-24 15:06:44 +02:00
Jacob Evans
f2507cb94a [asset-swapper]: Added Curve Tripool (#2708) 2020-09-23 17:03:03 +10:00
Lawrence Forman
f84b375cde UniswapFeature (#2703)
* Minimal Uniswap accessor.

* Add comments

* Safe math

* mainnet gas benchmark

* Assembler Uniswap

* Selectors and addresses

* Fix bugs in ABI encoders

* Typo

* AsmUniswap test

* Fix wantAmount computation

* Golfing

* Bypass AllowanceTarget

* Generalized asm uniswapper

* Implement ordering

* Fix pair computation

* #6 Golfing Iron

* Remove 'to' argument (saves 377 gas)

* New contract api

* `@0x/contracts-zero-ex`: Add `UniswapFeature`

* `@0x/contract-artifacts`: Regenerate artifacts

* `@0x/contract-wrappers`: Regenerate wrappers

* `@0x/asset-swapper`: Add Uniswap VIP support.
`@0x/asset-swapper`: Add `includeSources` support.

* `@0x/contracts-zero-ex`: Fix misleading comments in `UniswapFeature`.
`@0x/asset-swapper`: Fix linter errors.

* `@0x/asset-swapper`: Fix source filter bugs.

* `@0x/contracts-zero-ex`: `UniswapFeature`: Reduce calldata size for AllowanceTarget call
`@0x/asset-swapper`: Fix failing test.

* `@0x/contracts-zero-ex`: Fix ETH buy tokens not being normalized to WETH.

* `@0x/asset-swapper`: Fix multi-hop weirdness with source filters.

* `@0x/asset-swapper`: Fix failing test.

* `@0x/asset-swapper`: Really fix that broken AS test.

* `@0x/asset-swapper`: use filter objects instead of source array for valid buy and sell sources/

* `@0x/asset-swapper`: Move some source filtering logic into the sampler operations.

* `@0x/contracts-zero-ex`: Address PR feedback

* `@0x/contracts-zero-ex`: Fix feature version bug.

* `@0x/asset-swapper`: Did I actually fix AS tests this time? Who knows.

Co-authored-by: Remco Bloemen <remco@0x.org>
Co-authored-by: Michael Zhu <mchl.zhu.96@gmail.com>
Co-authored-by: Lawrence Forman <me@merklejerk.com>
2020-09-23 16:27:48 +10:00
F. Eugene Aumson
32d11d1ba5 Merge pull request #2706 from 0xProject/feat/asset-swapper/punish-latent-rfqt-makers
asset-swapper: Punish latent RFQT makers
2020-09-18 18:06:12 -04:00
F. Eugene Aumson
5c9b6eb078 Add tests of class RfqMakerBlacklist
Addresses review comment https://github.com/0xProject/0x-monorepo/pull/2706#pullrequestreview-489852363
2020-09-16 19:18:13 -04:00
F. Eugene Aumson
f53a512e70 Blacklist when threshhold reached, not surpassed 2020-09-16 19:09:17 -04:00
F. Eugene Aumson
ec08715090 Streamline isMakerBlacklisted() logic 2020-09-16 19:09:17 -04:00
F. Eugene Aumson
79e0a9ef37 Add and use constant ONE_MINUTE_MS
Addresses review comments
https://github.com/0xProject/0x-monorepo/pull/2706#discussion_r489610605
and
https://github.com/0xProject/0x-monorepo/pull/2706#discussion_r489614731
2020-09-16 19:08:27 -04:00
F. Eugene Aumson
1ce8a33937 asset-swapper: Punish latent RFQT makers 2020-09-14 19:07:48 -04:00
xianny
b3053dfb91 remove Bancor from list of on-chain sources 2020-09-11 16:05:14 -07:00
Xianny
3da05f2812 batch requests with bancor SDK (#2699)
* upgrade bancor SDK for batch requests

* lint

* changes after review

* deploy bancor bridge

* small fixes
2020-09-11 11:09:10 -07:00
Steve Klebanoff
0ba79b060d Merge pull request #2696 from 0xProject/bugfix/quote-report-generator-signature
Quote report generator: use signature instead of order hash for lookup
2020-09-09 17:32:51 -05:00
Steve Klebanoff
c4bcc26e29 Merge branch 'development' into bugfix/quote-report-generator-signature 2020-09-09 09:36:21 -05:00
Jacob Evans
630108ccb6 feat: Swerve Finance and SushiSwap (#2698)
* feat: Swerve Finance

* export SwerveFillData

* test and CHANGELOG

* feat: Sushiswap (#2700)

* feat: SushiSwap

* Changelog

* fix tests

* Deployed SushiSwap bridge

* Fix test

* IGNORED_EXCESSIVE_TYPES
2020-09-09 21:35:24 +10:00
Steve Klebanoff
1ab33aa132 Merge branch 'development' into bugfix/quote-report-generator-signature 2020-09-08 11:35:14 -05:00
Steve Klebanoff
ee456ea6e7 remove unused import 2020-09-04 11:01:24 -05:00
Steve Klebanoff
e7541ac2af update tests to use signatures instead of order hashes 2020-09-04 10:52:49 -05:00
Steve Klebanoff
d34d46b7fd change look up from order hash to order signature 2020-09-04 09:54:47 -05:00
Lawrence Forman
08ae43aad3 Merge pull request #2657 from 0xProject/fix/ep/meta-transactions
EP: MetaTransactions fixes
2020-09-03 23:21:19 -04:00
Lawrence Forman
eb141075c7 Merge pull request #2692 from 0xProject/feat/ep/fqt-rfqt-kyber-mooni-events
FQT: RFQT, more rollups, etc
2020-09-03 21:02:17 -04:00
Lawrence Forman
bd3387a408 @0x/contract-addresses: Update EP addresses 2020-09-03 16:52:28 -04:00
Lawrence Forman
e1a48e80e1 @0x/asset-swapper: Fix mooniswap sell sampling bug 2020-09-03 14:45:03 -04:00
Lawrence Forman
bf899d40a0 @0x/contracts-zero-ex: Only deploy FlashWallet in TransformERC20 migration if it does not already exist. 2020-09-03 13:39:30 -04:00
Lawrence Forman
dc66f1b886 @0x/asset-swapper: Fix Mooniswap buy sampling bug. 2020-09-03 11:01:41 -04:00
Lawrence Forman
3753b1a7d0 @0x/asset-swapper: Increase default error tolerance on quote simulation tests.
Run prettier.
2020-09-03 09:45:54 -04:00
Lawrence Forman
05c5acdb15 @0x/contracts-zero-ex: Fix Mooniswap WETH buying bug 2020-09-03 03:27:58 -04:00
Lawrence Forman
ca63bcc9b0 @0x/migrations: Remove mooniswapRegistry from BridgeAdapter addreses 2020-09-03 01:21:21 -04:00
Lawrence Forman
3733d503db @0x/contracts-zero-ex: Remove mooniswapRegistry from BridgeAdapter addreses 2020-09-03 01:21:09 -04:00
Lawrence Forman
ab28e42c22 @0x/asset-swapper: Fix mooniswap encoding 2020-09-03 01:07:00 -04:00
Lawrence Forman
7e53b4f834 @0x/contract-addresses: Update transformer deployer and transformers for champagne-problems deployment.
`@0x/migrations`: Reorder transformer deployments.
2020-09-02 22:23:20 -04:00
Lawrence Forman
3bb60fee19 @0x/asset-swapper: Export MooniswapFillData. 2020-09-02 21:22:24 -04:00
Lawrence Forman
9f7840e12b @0x/contracts-zero-ex: Remove only from tests. 2020-09-02 21:22:07 -04:00
Lawrence Forman
f41e13b574 @0x/contracts-zero-ex: Decode secret mooniswap bridge data parameter. 2020-09-02 17:45:37 -04:00
Lawrence Forman
4049143630 @0x/asset-swapper: Return Mooniswap pool in sampler and encode it in bridge data 2020-09-02 17:42:03 -04:00
Lawrence Forman
705f46717f @0x/contracts-integrations: Add EP + MTX + RFQT integration tests. 2020-09-02 15:58:41 -04:00
Lawrence Forman
a6cf8ae0b6 @0x/asset-swapper: Add rfqtTakerAddress to FillQuoteTransformerData 2020-09-02 15:58:41 -04:00
Lawrence Forman
dba6972281 @0x/order-utils: Add rfqtTakerAddress to FillQuoteTransformerData 2020-09-02 15:58:41 -04:00
Lawrence Forman
52d36f5a8b @0x/migrations: Fix FQT deployment 2020-09-02 15:58:41 -04:00
Lawrence Forman
889b58a914 @0x/contracts-zero-ex: Add RFQT taker enforcement to FQT.
`@0x/contracts-zero-ex`: Remove redundant event from `BridgeAdapter`.
`@0x/contracts-zero-ex`: Treat all calldata as signed if quote signer is not in `TransformERC20Feature`.

`@0x/contracts-zero-ex`: Update bridge adapters
2020-09-02 15:58:38 -04:00
Lawrence Forman
43810835d7 @0x/utils: Fix broken test 2020-09-01 18:52:32 -04:00
Lawrence Forman
4b9867f167 update changelogs 2020-09-01 18:02:17 -04:00
Lawrence Forman
e9c91e59bd @0x/contracts-zero-ex: Fix shadowed variable in TransformerDeployer. 2020-09-01 17:51:53 -04:00
Lawrence Forman
d8844f6970 @0x/contracts-integrations: Fix broken tests. 2020-09-01 17:32:29 -04:00
Lawrence Forman
1cdc6e7184 @0x/contracts-integrations: Remove stray only modifier. 2020-09-01 16:56:32 -04:00
Lawrence Forman
36ad373f03 @0x/utils: Fix StakingErrors.ExchangeManagerError incorrect param name 2020-09-01 16:55:04 -04:00
Lawrence Forman
78dfb6d525 @0x/migrations: Fix linter error. 2020-09-01 16:54:17 -04:00
Lawrence Forman
79254de7bc @0x/contracts-exchange: Fix failing tests. 2020-09-01 16:53:49 -04:00
Lawrence Forman
1d6aef5cd6 @0x/contracts-zero-ex: Remove UniswapFeature
`@0x/contracts-zero-ex`: Fix broken tests.
2020-09-01 16:05:14 -04:00
Lawrence Forman
f9d02c9e27 @0x/utils: Fix nested revert decoding 2020-09-01 16:04:01 -04:00
Lawrence Forman
228246089e Merge branch 'feat/exchange-proxy/vip-uniswap' into fix/ep/meta-transactions 2020-09-01 11:59:44 -04:00
Lawrence Forman
b6319ba3d8 @0x/contracts-zero-ex: Fix rebase artifacts. 2020-09-01 10:35:02 -04:00
Lawrence Forman
2636384ead Merge remote-tracking branch 'origin/feat/exchange-proxy/post-cd-audit' into fix/ep/meta-transactions 2020-09-01 09:48:17 -04:00
Lawrence Forman
0425f76284 Merge remote-tracking branch 'origin/fix/zero-ex/transformer-deployer-kill-fix' into fix/ep/meta-transactions 2020-09-01 09:42:38 -04:00
Lawrence Forman
d93e72f56a @0x/asset-swapper: Fix rebase conflicts 2020-09-01 09:41:00 -04:00
Lawrence Forman
195d543ce3 @0x/contracts-zero-ex: Remove bugged parity signature compatibility. 2020-09-01 09:41:00 -04:00
Lawrence Forman
9cda9f69cd @0x/contracts-zero-ex: Add reentrancy guard to mtx functions
`@0x/contracts-zero-ex`: Add refund mechanism to mtxs
`@0x/contracts-zero-ex`: Pass sender to transfomers.
`@0x/contracts-zero-ex`: Refund protocol fees to `refundReceiver` in FQT.
`@0x/utils`: Add EP flavor of `IllegalReentrancyError`
`@0x/order-utils`: Add `refundReceiver` to FQT transform data.
`@0x/asset-swapper`: Add `refundReceiver` support to EP swap quote consumer.
2020-09-01 09:40:58 -04:00
F. Eugene Aumson
7b0a1c3630 Merge pull request #2684 from 0xProject/feat/asset-swapper/rfqt-indicative-without-takerAddress
asset-swapper: Stop requiring takerAddress for indicative RFQ-T quotes.
2020-08-31 20:14:30 -04:00
F. Eugene Aumson
a8f3a47240 asset-swapper: Update comments 2020-08-31 16:36:00 -04:00
F. Eugene Aumson
db0f3a8780 Merge branch 'development' into feat/asset-swapper/rfqt-indicative-without-takerAddress 2020-08-31 12:11:00 -04:00
Jacob Evans
514db24ceb chore: Optional quote report generation (#2687) 2020-08-29 09:41:01 +10:00
F. Eugene Aumson
e738743c89 asset-swapper: ensure takerAddress for indiciative
Ensure the presence of a taker address query parameter in the request to
market maker endpoints for indicative RFQ-T quotes.

Addresses review comment https://github.com/0xProject/0x-monorepo/pull/2684#pullrequestreview-477242367
2020-08-28 16:30:01 -04:00
F. Eugene Aumson
f471e1a8a3 Merge branch 'development' into feat/asset-swapper/rfqt-indicative-without-takerAddress 2020-08-27 13:49:46 -04:00
Jacob Evans
a2f0d5eedf feat: better Kyber quotes (#2683)
* feat: Kyber rework

* Get additional reserves per token
2020-08-27 15:58:57 +10:00
Jacob Evans
2f9b894d71 fix: bunny-hop small amounts (#2685)
* fix: bunny-hop small amounts

* fix lint and Dockerfile

* HACK: temporarily disable python
2020-08-27 10:49:14 +10:00
mzhu25
bab34c2d21 Feature/bunny hop (#2647)
* `@0x/contracts-erc20-bridge-sampler`: Add TwoHopSampler + refactor

* `@0x/asset-swapper`: Refactor + add two-hop skeleton

* Round out two-hop support in asset-swapper

* Add BalancerSampler, use it for two-hop quotes

* Fix bugs discovered from simbot

* rebases are hard

* Add intermediate token to MultiHop source breakdown

* Fix market buy bugs

* Use hybrid on-chain/off-chain sampling for Balancer

* Another day, another rebase

* Update changelogs

* Address PR feedback, CI fixes

* Address more PR feedback
2020-08-27 08:20:09 +10:00
F. Eugene Aumson
a68421b0f8 update CHANGELOG 2020-08-26 16:31:27 -04:00
F. Eugene Aumson
e9b0ac8820 asset-swapper: Stop req'ing takerAddr for RFQT ind
Stop requiring takerAddress for indicative RFQ-T quotes.
2020-08-25 17:42:02 -04:00
Jacob Evans
4f78f55c2a fix: mooniswap usdt (#2681) 2020-08-25 21:43:19 +10:00
Daniel Pyrathon
156093127b Merge pull request #2678 from 0xProject/moreLogging
adds more logging keys
2020-08-24 19:45:04 -07:00
Daniel Pyrathon
47d91bb4e0 adds more logging keys 2020-08-24 15:54:09 -07:00
Jacob Evans
cc31445189 feat: asset-swapper mooniswap (#2675)
* feat: asset-swapper sampler early exit

* feat: asset-swapper mooniswap

* tests and linter

* deploy to mainnet

* CHANGELOGs

* fix excluded sources difference

* typo
2020-08-24 11:21:01 +10:00
Xianny
af78238507 Feat/bancor v2 (#2650)
* Bancor Bridge contract

* refactor Quote and FillData types

* BancorService (wrapper for the Bancor SDK)

* disable bancor while waiting for bancor SDK update

* add bancor to test
2020-08-21 15:11:35 -07:00
Lawrence Forman
b30f87f50c @0x/asset-swapper: Use IZeroExContract in EP swap quote consumer. 2020-08-20 16:56:40 -04:00
Lawrence Forman
3cd03ed0f1 @0x/migrations: Update EP migration 2020-08-20 16:55:47 -04:00
Lawrence Forman
e7ad7c3af7 @0x/contracts-zero-ex: Add IUniswapV2Feature.
`@0x/contracts-zero-ex`: Rename all feature contracts to have `Feature` suffix.
`@0x/contracts-zero-ex`: Return an `IZeroExContract` instance from `fullMigrateAsync()`.
2020-08-20 16:54:50 -04:00
Jacob Evans
7e8b56eef4 feat: mStable + FQT Rollup (#2662)
* feat: mStable

* deploy and CHANGELOG

* `@0x/contracts-utils`: Add more testnet addresses.

* `@0x/contract-addresses`: Deply Mstable on testnets

* `@0x/contract-addresses`: Remove testnet deployments of mStable :-)

* move `erc20-bridge-sampler` into `asset-swapper`
remove `DevUtils` dependency from sampler contract.

* `@0x/asset-swapper`: Add ERC20BridgeSampler support for validating orders in maker fees denominated in non-maker assets.
`@0x/asset-swapper`: Add tests for `NativeOrderSampler`.

* `@0x/asset-swapper`: Return `0` sample if native order asset data is unsupported.

* `@0x/asset-swapper`: Fix failing test.

* feat: ExchangeProxy FQT fruit rollup (#2645)

* feat: Optimize Bridges in ExchangeProxy

* compile and most work

* work around to trust the delecall contract

* force allowances

* Update Kyber/Eth2Dai bridges

* Remove memory state where not required

* cleanup

* Combine Bridges into one adapter

* mixins

* refactor out ZeroExBridge

* move out interface

* comment out hacks

* update migrations

* remove simbot hacks

* AdapterAddresses and mStable

* Share constructor arg

* fix migration

* Remove whitespace

* `@0x/contracts-zero-ex`: BridgeAdapter -- revert if bridge address is 0.

* `@0x/contract-addresses`: Deploy FQT.

Co-authored-by: Lawrence Forman <me@merklejerk.com>
Co-authored-by: Lawrence Forman <lawrence@0xproject.com>

* update ganache contract addresses

* fix: asset-swapper empty batch call (#2669)

* update ganache contract addresses

* fix: asset-swapper prevent empty sampler batch call

* add sampler to migrations

* change migrations version

* Use contract-wrappers and artifacts

* remove extra data

* remove deps, set sampler to NULL_ADDRESS

* all the exports

* noop sell rate too

* update ganache contract addresses

Co-authored-by: Lawrence Forman <me@merklejerk.com>
Co-authored-by: Lawrence Forman <lawrence@0xproject.com>
2020-08-20 08:18:44 +10:00
mzhu25
458a014e6d Merge pull request #2668 from 0xProject/improvement/nested-revert-decoding
`@0x/utils`: Add support for nested rich revert decoding
2020-08-19 11:12:54 -07:00
Lawrence Forman
9b6703398e @0x/contracts-integrations: Add EP mtx tests. 2020-08-19 13:52:32 -04:00
Lawrence Forman
71700e69af @0x/zero-ex: Address CD post-audit feedback.
Add `LogMetadataTransformer`.
2020-08-19 13:52:32 -04:00
Lawrence Forman
14d6330b40 @0x/asset-swaper: Use transformer utils from @0x/order-utils. 2020-08-19 13:52:32 -04:00
Lawrence Forman
d31d646ecc @0x/order-utils: Fix EP signature utils schema assertion. 2020-08-19 13:52:32 -04:00
Michael Zhu
270d7a3f19 Update changelog 2020-08-19 10:11:25 -07:00
Michael Zhu
e078f3d479 Appease CI 2020-08-19 09:50:39 -07:00
Lawrence Forman
6aa8f17ed5 @0x/json-schemas: Add exchangeProxyMetaTransactionSchema. 2020-08-19 11:39:49 -04:00
Lawrence Forman
8e73ae3614 @0x/order-utils: Add findTransformerNonce() and getTransformerAddress() functions. 2020-08-18 16:39:59 -04:00
Michael Zhu
89117beda2 @0x/utils: Add support for nested rich revert decoding 2020-08-18 13:13:10 -07:00
Lawrence Forman
e27e6baabe @0x/contracts-integrations: Add EP mtx tests. 2020-08-17 22:08:25 -04:00
Daniel Pyrathon
15ce90c0ec Merge pull request #2665 from 0xProject/smaller_log
Smaller logs (avoid circular buffers) + add a boolean to indicate if order was included in the salad or not
2020-08-14 17:02:35 -07:00
Daniel Pyrathon
39e157499d removed toJSON check 2020-08-14 16:29:52 -07:00
Daniel Pyrathon
d22c0641fb are you included or not 2020-08-14 15:45:06 -07:00
Daniel Pyrathon
82806b6fcb avoid returning objects with circular buffers 2020-08-14 14:54:53 -07:00
Daniel Pyrathon
fe293d91ee added smaller log 2020-08-14 13:41:49 -07:00
Brandon Millman
7842bb4cad Fix deprecation message in instant README 2020-08-13 13:33:45 -06:00
Brandon Millman
6f7e156f49 Add deprecation warning to Instant README 2020-08-13 13:32:57 -06:00
Daniel Pyrathon
0d19cac487 Merge pull request #2663 from 0xProject/feature/keepAlive-timeout
Feature/keep alive timeout
2020-08-12 09:15:54 -07:00
Daniel Pyrathon
f30dfcc572 adds a long TTL to quote requestor client 2020-08-12 07:38:57 -07:00
Daniel Pyrathon
3df39d8cfe added httpAgent and httpsAgent timeouts 2020-08-11 19:12:53 -07:00
Daniel Pyrathon
ece93fed78 Merge pull request #2661 from 0xProject/feature/keepAlive
added keepAlive
2020-08-10 21:12:20 -07:00
Daniel Pyrathon
3a2c6ae9d6 updates balancer pinns to 0.3.2 2020-08-10 20:12:40 -07:00
Daniel Pyrathon
2ed71b36b6 Revert "added balancer packages"
This reverts commit ae9c301795.
2020-08-10 20:08:15 -07:00
Daniel Pyrathon
ae9c301795 added balancer packages 2020-08-10 19:26:29 -07:00
Daniel Pyrathon
68206ffb6e update balancer to 0.3.2 2020-08-10 18:10:50 -07:00
Daniel Pyrathon
25a3c18bfe fixed small test bug 2020-08-10 17:59:37 -07:00
Daniel Pyrathon
d28476e9f7 export axios 2020-08-10 16:57:08 -07:00
Daniel Pyrathon
7cd30610f9 fixed tests 2020-08-10 16:33:42 -07:00
Daniel Pyrathon
ceb90989d0 Merge branch 'development' of github.com:0xProject/0x-monorepo into feature/keepAlive
# Conflicts:
#	packages/asset-swapper/src/utils/quote_requestor.ts
2020-08-10 16:13:53 -07:00
Daniel Pyrathon
bb39d63d37 fixed class instantiation issue 2020-08-10 15:12:16 -07:00
Daniel Pyrathon
213709d020 added keepAlive 2020-08-10 14:47:15 -07:00
Jacob Evans
d0e9081852 feat: asset-swapper use ethToInputRate when ethToOutputRate is unavailable (#2660) 2020-08-10 20:41:17 +10:00
Jacob Evans
71cde281b9 fix: asset-swapper depth buy scale (#2659) 2020-08-09 16:38:59 +10:00
Lawrence Forman
c03f1586e6 asset-swapper: Fix optimization of buy paths (#2655)
* `@0x/asset-swapper`: Fix optimization of buy paths

* `@0x/asset-swapper`: Fix optimization of buy paths

* `@0x/asset-swapper`: Optimize the optimizer.

* `@0x/asset-swapper`: Remove unused `Fill` fields

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2020-08-07 13:03:52 +10:00
Lawrence Forman
10aceb164d @0x/asset-swapper: Fix rebase conflicts 2020-08-06 22:48:55 -04:00
Lawrence Forman
34f516a417 @0x/contracts-zero-ex: Remove bugged parity signature compatibility. 2020-08-06 22:32:42 -04:00
Lawrence Forman
5dd686f22f @0x/contracts-zero-ex: Add reentrancy guard to mtx functions
`@0x/contracts-zero-ex`: Add refund mechanism to mtxs
`@0x/contracts-zero-ex`: Pass sender to transfomers.
`@0x/contracts-zero-ex`: Refund protocol fees to `refundReceiver` in FQT.
`@0x/utils`: Add EP flavor of `IllegalReentrancyError`
`@0x/order-utils`: Add `refundReceiver` to FQT transform data.
`@0x/asset-swapper`: Add `refundReceiver` support to EP swap quote consumer.
2020-08-06 22:28:35 -04:00
mzhu25
5f47ad3363 Merge pull request #2658 from 0xProject/feat/asset-swapper/affiliate-fees
`@0x/asset-swapper`: Buy token affiliate fees
2020-08-06 10:39:37 -07:00
Michael Zhu
e166e9762a update changelogs 2020-08-06 09:38:33 -07:00
Michael Zhu
341c5782e5 @0x/asset-swapper: Add affiliate fee support to EP swap quote consumer 2020-08-05 22:56:39 -07:00
mzhu25
d5180d3ebc Merge pull request #2656 from 0xProject/refactor/migrations
Redeploy/verify testnet contracts
2020-08-04 15:35:24 -07:00
Michael Zhu
2c73bbd689 appease CI 2020-08-04 14:58:16 -07:00
Michael Zhu
b10522479c Update changelogs 2020-08-04 11:13:09 -07:00
Michael Zhu
2b39ae4800 Redeploy/verify testnet contracts 🙄 2020-08-04 11:08:03 -07:00
Jacob Evans
788bdba8cd fix: asset-swapper source collapse regression (#2654)
fixes source collapse regression where a split on the same source was collapsed into a single fill.
This should be kept distinct as separate fills.
2020-08-04 15:09:17 +10:00
Jacob Evans
222fd5d822 fix: Deploy UniswapV2 Bridge on Kovan (#2652)
* fix: Deploy UniswapV2 Bridge on Kovan

* CHANGELOG
2020-08-03 16:26:37 +10:00
Lawrence Forman
eedfc64a8c Merge pull request #2649 from 0xProject/feat/contract-wrappers/exchangeProxy
Add `exchangeProxy` to `ContractWrappers`
2020-07-30 20:43:33 -04:00
Lawrence Forman
78170b26e9 Merge pull request #2648 from 0xProject/fix/ethereum-types/ConstructorAbi-payable
`@0x/ethereum-types`: Make `ConstructorAbi.payable` optional.
2020-07-30 16:29:47 -04:00
Lawrence Forman
f966b6f4df @0x/ethereum-types: Make ConstructorAbi.payable optional. 2020-07-30 15:52:48 -04:00
Lawrence Forman
053b55fbbf @0x/order-utils: Add gitpkg 2020-07-30 13:56:43 -04:00
Lawrence Forman
84a55a2d84 @0x/contract-wrappers: add exchangeProxy to ContractWrappers tyoe. 2020-07-30 13:56:00 -04:00
Steve Klebanoff
498a50b229 Merge pull request #2646 from 0xProject/feature/fix-quote-report-rfqt
Send in quoteRequestor to fix RFQT tracking
2020-07-28 14:32:28 -07:00
Steve Klebanoff
766888ec41 Send in quoteRequestor to fix RFQT tracking 2020-07-28 13:39:21 -07:00
Jacob Evans
466d962c07 fix: Redeploy ERC20BridgeSampler on Kovan (#2644) 2020-07-28 12:49:21 +10:00
Lawrence Forman
ae2a6fb685 asset-swapper: Quicker path-finding (#2640)
* `@0x/asset-swapper`: Speed up path optimizer.

* `@0x/asset-swapper`: address my own review comment

* `@0x/asset-swapper`: Update changelog

Co-authored-by: Lawrence Forman <me@merklejerk.com>
Co-authored-by: Jacob Evans <jacob@dekz.net>
2020-07-27 15:09:49 +10:00
Jacob Evans
5afe2616a4 feat: asset-swapper market depth (#2641)
* feat: asset-swapper market depth

* split promises into 2

* fix lint and docs

* chore: refactor

* rebase off development

* CHANGELOG
2020-07-27 15:07:52 +10:00
Steve Klebanoff
72c869649a Merge pull request #2627 from 0xProject/feature/new-order-reporter
asset-swapper: QuoteReport response
2020-07-23 17:50:48 -07:00
Steve Klebanoff
34138fc3b5 handle empty array in reduce 2020-07-23 17:15:04 -07:00
Steve Klebanoff
f67d2b96ac fix up changelog 2020-07-23 16:25:24 -07:00
Steve Klebanoff
d877d3686c linting 2020-07-23 16:03:09 -07:00
Steve Klebanoff
8260615b4e fix merge conflict 2020-07-23 16:02:16 -07:00
Steve Klebanoff
c3f6d48966 Merge branch 'development' into feature/new-order-reporter 2020-07-23 16:01:27 -07:00
Steve Klebanoff
02f979bc74 linting 2020-07-23 15:55:56 -07:00
Steve Klebanoff
de1c71aacc fix syntax 2020-07-23 15:54:34 -07:00
Steve Klebanoff
ca2aa72e0f Merge development 2020-07-23 15:17:35 -07:00
Daniel Pyrathon
9a16f5736e Merge pull request #2642 from 0xProject/only-rfqt
Add the `nativeExclusivelyRFQT` argument.
2020-07-23 15:05:02 -07:00
Lawrence Forman
82774df715 Merge pull request #2633 from 0xProject/feat/btc-curves
BTC Curves
2020-07-23 16:43:13 -04:00
Lawrence Forman
314f53c0b3 @0x/contract-addresses: Update CurveBridge on all networks. 2020-07-23 15:58:17 -04:00
Daniel Pyrathon
6553ee0130 reordered imports 2020-07-23 11:04:51 -07:00
Daniel Pyrathon
d7918ea047 prettified 2020-07-23 10:16:22 -07:00
Lawrence Forman
4aa9c85503 @0x/asset-swapper: Reenable some curves. 2020-07-23 09:59:30 -04:00
Lawrence Forman
f172591059 @0x/contracts-integrations: Fix curve bridge mainnet tests. 2020-07-23 09:59:03 -04:00
Steve Klebanoff
dfa7e30e42 fix version number, this is just a minor bump 2020-07-23 00:35:25 -07:00
Steve Klebanoff
3fe2013398 Merge branch 'development' into feature/new-order-reporter-merged 2020-07-22 23:59:09 -07:00
Steve Klebanoff
391d501ce6 Export rfqt opts 2020-07-22 23:56:07 -07:00
Steve Klebanoff
9edaa3a64e fix 2020-07-22 23:50:55 -07:00
Steve Klebanoff
6e4e313792 Merge branch 'development' into feature/new-order-reporter-merged 2020-07-22 23:50:28 -07:00
Daniel Pyrathon
e6dcf92ec8 added new parameter nativeExclusivelyRFQT 2020-07-22 23:02:40 -07:00
Daniel Pyrathon
f359de2cac fixed a small bug in indicative quotes 2020-07-22 22:46:25 -07:00
Lawrence Forman
2d29014091 @0x/contracts-erc20-bridge-sampler: address review comments 2020-07-23 00:37:58 -04:00
Lawrence Forman
0450e430f1 @0x/asset-swapper: Support more varied curves. 2020-07-23 00:37:58 -04:00
Lawrence Forman
b6700af6a8 @0x/contract-wrappers: Regenerate ERC20BridgeSampler wrapper. 2020-07-23 00:37:57 -04:00
Lawrence Forman
bcee7546ae 0x/contract-artifacts: Regenerate ERC20BridgeSampler artifact. 2020-07-23 00:37:32 -04:00
Lawrence Forman
4dac620156 @0x/contracts-asset-proxy: Update CurveBridge to support more varied curves.
`@0x/contracts-erc20-bridge-sampler`: Refactor.
`@0x/contracts-erc20-bridge-sampler`: Add support for more varied curves.
`@0x/contracts-integrations`: Update curve bridge tests.
2020-07-23 00:36:32 -04:00
Lawrence Forman
74d9df2fb0 Merge pull request #2626 from 0xProject/feat/zero-ex/TransformERC20-call-data-validation
ZeroEx: transformERC20 call data validation
2020-07-23 00:35:34 -04:00
Lawrence Forman
9d1615fa23 @0x/contract-wrappers: Fix doc gen 2020-07-23 00:03:23 -04:00
Lawrence Forman
b1b9949e72 @0x/contract-wrappers: Add IZeroEx wrapper. 2020-07-22 23:41:11 -04:00
Lawrence Forman
957ef5ab77 @0x/contract-artifacts: Add IZeroEx artifact. 2020-07-22 23:41:11 -04:00
Lawrence Forman
07a681c77e @0x/contracts-zero-ex: Add IZeroEx contract. 2020-07-22 22:59:46 -04:00
Lawrence Forman
145ec8ede1 address review comments 2020-07-22 22:18:41 -04:00
Lawrence Forman
5f5a158060 @0x/contracts-zero-ex: Update TransformERC20 and MetaTransactions to handle signed calldata. 2020-07-22 22:18:39 -04:00
Steve Klebanoff
3e99c95791 Linting 2020-07-22 13:26:31 -07:00
Steve Klebanoff
4f83521be8 Merge branch 'development' into feature/new-order-reporter-merged 2020-07-22 13:25:35 -07:00
Jacob Evans
aae93bb6a7 fix: asset-swapper yield to the event loop every mix path (#2637)
* fix: allow a empty overrides to signal no default

* fix: asset-swapper yield to the event loop every mix path

* fix: optimizations skip order find if Native excluded

* changelogs

* chore: update protocol fee multiplier

* fix: tests async
2020-07-21 17:06:05 +10:00
Steve Klebanoff
5c1ffe7fc8 add exclude to EXTERNAL_TYPE_MAP 2020-07-13 17:11:53 -07:00
Steve Klebanoff
b1c3c60def additional imports 2020-07-13 16:45:40 -07:00
Steve Klebanoff
8763713596 ds -> dq 2020-07-13 15:49:39 -07:00
Steve Klebanoff
3e823cc9e3 export new types 2020-07-10 16:07:14 -07:00
Steve Klebanoff
1c84709db3 isApiKeyWhitelisted helper fn 2020-07-10 16:03:14 -07:00
Steve Klebanoff
9150d6bd2a major version bump 2020-07-10 16:00:24 -07:00
Steve Klebanoff
10f29b66b8 newline 2020-07-10 15:58:31 -07:00
Steve Klebanoff
259aec52a9 linting 2020-07-10 15:58:06 -07:00
Steve Klebanoff
6554bf9f08 test for buy amount and no quote requestor 2020-07-10 15:57:06 -07:00
Steve Klebanoff
d8558f5956 QuoteReportGenerator test 2020-07-10 15:45:59 -07:00
Steve Klebanoff
31fa530845 add CHANGELOG entry 2020-07-08 15:54:19 -07:00
Steve Klebanoff
120714ecfc linting and remove unused function 2020-07-08 15:49:42 -07:00
Steve Klebanoff
615874d2ec always pass through quoterequestor 2020-07-08 15:38:36 -07:00
Steve Klebanoff
67b195c942 take out old todo comment 2020-07-08 15:13:53 -07:00
Steve Klebanoff
75689cee96 create new quote requestor each time 2020-07-08 15:07:36 -07:00
Steve Klebanoff
8ba77e95a4 export swap quoter types into own object 2020-07-08 15:07:20 -07:00
Steve Klebanoff
934fbca860 make QuoteReport optional instead of forcing it for bash operaitons, fix tests so build works 2020-07-07 11:00:03 -07:00
Steve Klebanoff
e78c8038c7 take out delete note 2020-07-06 22:24:02 -07:00
Steve Klebanoff
f64a42ebb5 return quote report 2020-07-06 22:18:22 -07:00
Steve Klebanoff
e79db7de89 new quotereporter type 2020-07-06 22:07:33 -07:00
Steve Klebanoff
e58c25aa18 hold onto maker uris when fetching responses 2020-07-06 21:27:20 -07:00
Steve Klebanoff
8ec44b63b1 WIP: add quoteReport response 2020-07-06 21:06:43 -07:00
Lawrence Forman
41907936a1 @0x/contracts-zero-ex: Fix TransformerDeployer.kill() calling the wrong die() interface. 2020-07-06 23:19:35 -04:00
1573 changed files with 40997 additions and 149346 deletions

View File

@@ -4,23 +4,13 @@ jobs:
build:
resource_class: medium+
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs8
- image: nikolaik/python-nodejs:python3.7-nodejs10
environment:
CONTRACTS_COMMIT_HASH: '9ed05f5'
working_directory: ~/repo
steps:
- checkout
- run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV
# HACK(feuGeneA): commented out this hack as we're changing
# from a circleci-maintained container to a different
# container, and this hack may not apply anymore, as
# suggested by the non-existance of `/home/circleci/.bashrc`
# when running the command below.
# - run:
# # HACK(albrow): Without this, yarn commands will sometimes
# # fail with a "permission denied" error.
# name: Set npm path
# command: npm set prefix=/home/circleci/npm && echo 'export PATH=$HOME/circleci/npm/bin:$PATH' >> /home/circleci/.bashrc
- run:
name: install-yarn
command: npm install --force --global yarn@1.17.0
@@ -41,7 +31,7 @@ jobs:
test-exchange-ganache:
resource_class: medium+
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs8
- image: nikolaik/python-nodejs:python3.7-nodejs10
working_directory: ~/repo
steps:
- restore_cache:
@@ -51,7 +41,7 @@ jobs:
test-integrations-ganache:
resource_class: medium+
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs8
- image: nikolaik/python-nodejs:python3.7-nodejs10
working_directory: ~/repo
steps:
- restore_cache:
@@ -61,27 +51,37 @@ jobs:
test-contracts-staking-ganache:
resource_class: medium+
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs8
- image: nikolaik/python-nodejs:python3.7-nodejs10
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn wsrun test:circleci @0x/contracts-staking
test-contracts-rest-ganache:
test-contracts-extra-ganache:
resource_class: medium+
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs8
- image: nikolaik/python-nodejs:python3.7-nodejs10
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn wsrun test:circleci @0x/contracts-multisig @0x/contracts-utils @0x/contracts-exchange-libs @0x/contracts-erc20 @0x/contracts-erc721 @0x/contracts-erc1155 @0x/contracts-asset-proxy @0x/contracts-exchange-forwarder @0x/contracts-coordinator @0x/contracts-erc20-bridge-sampler @0x/contracts-broker @0x/contracts-zero-ex
- run: yarn wsrun test:circleci @0x/contracts-exchange-forwarder @0x/contracts-coordinator
test-contracts-rest-ganache:
resource_class: medium+
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs10
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn wsrun test:circleci @0x/contracts-multisig @0x/contracts-utils @0x/contracts-exchange-libs @0x/contracts-erc20 @0x/contracts-erc721 @0x/contracts-erc1155 @0x/contracts-asset-proxy @0x/contracts-broker @0x/contracts-zero-ex
test-publish:
resource_class: medium+
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs8
- image: nikolaik/python-nodejs:python3.7-nodejs10
- image: 0xorg/verdaccio
working_directory: ~/repo
steps:
@@ -95,7 +95,7 @@ jobs:
path: ~/.npm/_logs
test-doc-generation:
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs8
- image: nikolaik/python-nodejs:python3.7-nodejs10
working_directory: ~/repo
steps:
- restore_cache:
@@ -106,230 +106,35 @@ jobs:
no_output_timeout: 1200
test-rest:
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs8
- image: nikolaik/python-nodejs:python3.7-nodejs10
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn wsrun test:circleci @0x/contracts-test-utils
- run: yarn wsrun test:circleci @0x/abi-gen
- run: yarn wsrun test:circleci @0x/asset-swapper
- run: yarn wsrun test:circleci @0x/contract-artifacts
- run: yarn wsrun test:circleci @0x/assert
- run: yarn wsrun test:circleci @0x/base-contract
- run: yarn wsrun test:circleci @0x/connect
- run: yarn wsrun test:circleci @0x/contract-wrappers-test
- run: yarn wsrun test:circleci @0x/dev-utils
- run: yarn wsrun test:circleci @0x/json-schemas
- run: yarn wsrun test:circleci @0x/migrations
- run: yarn wsrun test:circleci @0x/order-utils
- run: yarn wsrun test:circleci @0x/orderbook
- run: yarn wsrun test:circleci @0x/sol-compiler
- run: yarn wsrun test:circleci @0x/sol-tracing-utils
- run: yarn wsrun test:circleci @0x/sol-doc
- run: yarn wsrun test:circleci @0x/subproviders
- run: yarn wsrun test:circleci @0x/web3-wrapper
- run: yarn wsrun test:circleci @0x/utils
- run: yarn wsrun test:circleci @0x/instant
- save_cache:
key: coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/abi-gen/coverage/lcov.info
- save_cache:
key: coverage-assert-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/assert/coverage/lcov.info
- save_cache:
key: coverage-asset-swapper-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/asset-swapper/coverage/lcov.info
- save_cache:
key: coverage-base-contract-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/base-contract/coverage/lcov.info
- save_cache:
key: coverage-connect-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/connect/coverage/lcov.info
- run: yarn wsrun test:circleci @0x/asset-swapper
- save_cache:
key: coverage-contract-wrappers-test-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/contract-wrappers-test/coverage/lcov.info
- save_cache:
key: coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/dev-utils/coverage/lcov.info
- save_cache:
key: coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/json-schemas/coverage/lcov.info
- save_cache:
key: coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/order-utils/coverage/lcov.info
- save_cache:
key: coverage-sol-compiler-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/sol-compiler/coverage/lcov.info
- save_cache:
key: coverage-sol-tracing-utils-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/sol-tracing-utils/coverage/lcov.info
- save_cache:
key: coverage-sol-doc-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/sol-doc/coverage/lcov.info
- save_cache:
key: coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/subproviders/coverage/lcov.info
- save_cache:
key: coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/web3-wrapper/coverage/lcov.info
test-python:
working_directory: ~/repo
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs8
- image: 0xorg/ganache-cli:6.0.0
environment:
VERSION: '6.0.0'
- image: 0xorg/mesh:0xV3
environment:
ETHEREUM_RPC_URL: 'http://localhost:8545'
ETHEREUM_CHAIN_ID: '1337'
VERBOSITY: 5
BLOCK_POLLING_INTERVAL: '50ms'
ETHEREUM_RPC_MAX_REQUESTS_PER_24_HR_UTC: '1778000'
command: |
sh -c "waitForGanache () { until printf 'POST /\r\nContent-Length: 26\r\n\r\n{\"method\":\"net_listening\"}' | nc localhost 8545 | grep true; do continue; done }; waitForGanache && ./mesh"
- image: 0xorg/launch-kit-backend:v3
environment:
RPC_URL: 'http://localhost:8545'
CHAIN_ID: 1337
WHITELIST_ALL_TOKENS: True
FEE_RECIPIENT: '0x0000000000000000000000000000000000000001'
MAKER_FEE_UNIT_AMOUNT: 0
TAKER_FEE_UNIT_AMOUNT: 0
MESH_ENDPOINT: 'ws://localhost:60557'
command: |
sh -c "waitForMesh () { sleep 30; }; waitForMesh && node_modules/.bin/forever ts/lib/index.js"
steps:
- checkout
- restore_cache:
key: installed-py-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run:
command: |
cd python-packages
python -m ensurepip
./pre_install
./install
- save_cache:
key: installed-py-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
- '/usr/local/bin'
- '/usr/local/lib/python3.7/site-packages'
- run:
command: |
cd python-packages
./parallel coverage run setup.py test
./build_docs
- run:
command: |
# copy generated wrappers into contract_wrappers/build,
# JUST so CircleCI will persist them as build artifacts.
cd python-packages/contract_wrappers/src/zero_ex
for i in contract_wrappers/[^__]*/; do mkdir -p ../../build/$i; cp $i/__init__.py ../../build/$i; done
- save_cache:
key: coverage-python-contract-addresses-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/python-packages/contract_addresses/.coverage
- save_cache:
key: coverage-python-contract-artifacts-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/python-packages/contract_artifacts/.coverage
- save_cache:
key: coverage-python-contract-demo-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/python-packages/contract_demo/.coverage
- save_cache:
key: coverage-python-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/python-packages/json_schemas/.coverage
- save_cache:
key: coverage-python-order-utils-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/python-packages/order_utils/.coverage
- save_cache:
key: coverage-python-sra-client-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/python-packages/sra_client/.coverage
- store_artifacts:
path: ~/repo/python-packages/contract_addresses/build
- store_artifacts:
path: ~/repo/python-packages/contract_artifacts/build
- store_artifacts:
path: ~/repo/python-packages/contract_wrappers/build
- store_artifacts:
path: ~/repo/python-packages/json_schemas/build
- store_artifacts:
path: ~/repo/python-packages/middlewares/build
- store_artifacts:
path: ~/repo/python-packages/order_utils/build
- store_artifacts:
path: ~/repo/python-packages/sra_client/build
test-rest-python:
working_directory: ~/repo
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs8
steps:
- checkout
- restore_cache:
key: installed-py-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- run:
command: |
cd python-packages/order_utils
python -m ensurepip
python -m pip install .
- save_cache:
key: installed-py-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
- '/usr/local/bin'
- '/usr/local/lib/python3.7/site-packages'
- '.eggs'
- '.mypy_cache'
- '.pytest_cache'
- '.tox'
- run:
command: |
cd python-packages/order_utils
tox
static-tests-python:
working_directory: ~/repo
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs8
steps:
- checkout
- restore_cache:
key: installed-py-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run:
command: |
python -m ensurepip
cd python-packages
./pre_install
./install
./lint
static-tests:
resource_class: large
working_directory: ~/repo
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs8
- image: nikolaik/python-nodejs:python3.7-nodejs10
steps:
- restore_cache:
keys:
@@ -338,94 +143,42 @@ jobs:
- run: yarn prettier:ci
- run: yarn deps_versions:ci
- run: yarn diff_md_docs:ci
- run: cd packages/0x.js && yarn build:umd:prod
- run: yarn bundlewatch
submit-coverage:
docker:
- image: nikolaik/python-nodejs:python3.7-nodejs8
- image: nikolaik/python-nodejs:python3.7-nodejs10
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-assert-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-asset-swapper-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-base-contract-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-connect-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-contract-wrappers-test-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-sol-compiler-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-sol-tracing-utils-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-sol-doc-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-contracts-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-python-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-python-contract-addresses-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-python-contract-artifacts-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-python-contract-demo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-python-sra-client-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-python-order-utils-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn report_coverage
workflows:
version: 2
main:
jobs:
- build
- test-exchange-ganache:
requires:
- build
- test-integrations-ganache:
requires:
- build
- test-contracts-staking-ganache:
requires:
- build
# Disabled until we begin actively developing on these packages again.
# - test-exchange-ganache:
# requires:
# - build
# - test-integrations-ganache:
# requires:
# - build
# - test-contracts-staking-ganache:
# requires:
# - build
# - test-contracts-extra-ganache:
# requires:
# - build
- test-contracts-rest-ganache:
requires:
- build
@@ -441,18 +194,14 @@ workflows:
- test-doc-generation:
requires:
- build
- submit-coverage:
requires:
- test-contracts-rest-ganache
- test-contracts-staking-ganache
- test-exchange-ganache
- test-rest
- static-tests
- test-python:
requires:
- build
- static-tests-python:
requires:
- build
# skip python tox run for now, as we don't yet have multiple test environments to support.
# - test-rest-python
# Disabled until this repo has a coveralls API key
# - submit-coverage:
# requires:
# # Disabled until we begin actively developing on these packages again.
# # - test-exchange-ganache
# # - test-integrations-ganache
# # - test-contracts-staking-ganache
# # - test-contracts-extra-ganache
# - test-contracts-rest-ganache
# - test-rest
# - static-tests

4
.gitattributes vendored
View File

@@ -2,7 +2,3 @@
# Automatically collapse generated files in GitHub.
*.svg linguist-generated=true
packages/contract-artifacts/artifacts/*json linguist-generated=true
packages/abi-gen-wrappers/src/generated-wrappers/*.ts linguist-generated=true
packages/contract-wrappers/src/generated-wrappers/*.ts linguist-generated=true

View File

@@ -1,33 +1,7 @@
python: ['python-packages']
contracts: ['contracts']
@0x/sol-doc: ['packages/sol-doc']
@0x/sol-resolver: ['packages/sol-resolver']
@0x/contracts-gen: ['packages/contracts-gen']
@0x/sra-spec: ['packages/sra-spec']
@0x/subproviders: ['packages/subproviders']
@0x/contract-addresses: ['packages/contract-addresses']
@0x/migrations: ['packages/migrations']
@0x/web3-wrapper: ['packages/web3-wrapper']
@0x/sol-compiler: ['packages/sol-compiler']
@0x/types: ['packages/types']
@0x/instant: ['packages/instant']
@0x/abi-gen-templates: ['packages/abi-gen-templates']
@0x/abi-gen: ['packages/abi-gen']
@0x/sol-coverage: ['packages/sol-coverage']
@0x/sol-profiler: ['packages/sol-profiler']
@0x/sol-trace: ['packages/sol-trace']
@0x/sol-tracing-utils: ['packages/sol-tracing-utils']
@0x/utils: ['packages/utils']
@0x/tslint-config: ['packages/tslint-config']
@0x/asset-swapper: ['packages/asset-swapper']
@0x/order-utils: ['packages/order-utils']
@0x/assert: ['packages/assert']
@0x/base-contract: ['packages/base-contract']
@0x/typescript-typings: ['packages/typescript-typings']
0x.js: ['packages/0x.js']
@0x/contract-artifacts: ['packages/contract-artifacts']
@0x/dev-utils: ['packages/dev-utils']
@0x/contract-wrappers: ['packages/contract-wrappers']
@0x/json-schemas: ['packages/json-schemas']
@0x/ethereum-types: ['ethereum-types']
@0x/connect: ['packages/connect']

48
.github/workflows/publish.yml vendored Normal file
View File

@@ -0,0 +1,48 @@
name: publish
on:
workflow_dispatch:
inputs:
ci_status:
description: 'required CI status'
default: 'success'
required: true
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: 'check successful status'
run: |
REF_STATUS=$(curl -s \
'https://api.github.com/repos/${{ github.repository }}/commits/${{ github.ref }}/status' \
| jq .state)
[[ "${REF_STATUS}" == '"${{ github.event.inputs.ci_status }}"' ]] || \
(echo "::error ::${{ github.ref }} does not have a successful CI status" && false)
- uses: actions/checkout@v2
with:
ref: 'development'
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: 10
- 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: 'install dependencies'
run: |
yarn -D
- name: 'build and publish'
run: |
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc
npm run run:publish:gha
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
- name: 'merge into main branch'
run: |
git checkout main && \
git merge ${{ github.ref }} && \
git push

20
.gitignore vendored
View File

@@ -113,8 +113,6 @@ contracts/dev-utils/generated-artifacts/
contracts/dev-utils/test/generated-artifacts/
contracts/zero-ex/generated-artifacts/
contracts/zero-ex/test/generated-artifacts/
packages/sol-tracing-utils/test/fixtures/artifacts/
python-packages/contract_artifacts/src/zero_ex/contract_artifacts/artifacts/
# generated truffle contract artifacts/
contracts/broker/build/
@@ -169,24 +167,6 @@ contracts/dev-utils/generated-wrappers/
contracts/dev-utils/test/generated-wrappers/
contracts/zero-ex/generated-wrappers/
contracts/zero-ex/test/generated-wrappers/
python-packages/contract_wrappers/src/zero_ex/contract_wrappers/*/__init__.py
# solc-bin in sol-compiler
packages/sol-compiler/solc_bin/
# python stuff
.eggs
.mypy_cache
.tox
python-packages/*/build
python-packages/*/dist
__pycache__
python-packages/*/src/*.egg-info
python-packages/*/.coverage
# python keeps package-local copies of json schemas and contract addresses
python-packages/json_schemas/src/zero_ex/json_schemas/schemas
python-packages/contract_addresses/src/zero_ex/contract_addresses/addresses.json
# Doc README copy
packages/*/docs/README.md

View File

@@ -40,10 +40,6 @@ lib
/contracts/erc20/test/generated-wrappers
/contracts/erc20/generated-artifacts
/contracts/erc20/test/generated-artifacts
/contracts/erc20-bridge-sampler/generated-wrappers
/contracts/erc20-bridge-sampler/test/generated-wrappers
/contracts/erc20-bridge-sampler/generated-artifacts
/contracts/erc20-bridge-sampler/test/generated-artifacts
/contracts/erc721/generated-wrappers
/contracts/erc721/test/generated-wrappers
/contracts/erc721/generated-artifacts
@@ -80,19 +76,11 @@ lib
/contracts/erc1155/build/
/contracts/extensions/build/
/contracts/exchange-forwarder/build/
/contracts/dev-utils/build/
/packages/abi-gen/test-cli/output
/packages/json-schemas/schemas
/python-packages/json_schemas/src/zero_ex/json_schemas/schemas
/packages/sra-spec/public/
/packages/asset-swapper/generated-artifacts
/packages/asset-swapper/generated-wrappers
/packages/asset-swapper/test/generated-artifacts
/packages/asset-swapper/test/generated-wrappers
package.json
scripts/postpublish_utils.js
packages/sol-coverage/test/fixtures/artifacts
.pytest_cache
.mypy_cache
.tox
packages/abi-gen/test-cli/fixtures/artifacts/AbiGenDummy.json
packages/abi-gen/test-cli/fixtures/artifacts/LibDummy.json
packages/abi-gen/test-cli/fixtures/artifacts/TestLibDummy.json
packages/*/docs
docs/
*.sol

View File

@@ -2,5 +2,6 @@
"printWidth": 120,
"tabWidth": 4,
"singleQuote": true,
"trailingComma": "all"
"trailingComma": "all",
"bracketSpacing": true
}

View File

@@ -9,30 +9,10 @@ packages/asset-swapper/ @BMillman19 @fragosti @dave4506
packages/instant/ @BMillman19 @fragosti @dave4506
# Dev tools & setup
.circleci/ @LogvinovLeon
packages/abi-gen/ @feuGeneA
packages/base-contract/ @xianny
packages/connect/ @fragosti
packages/abi-gen-templates/ @feuGeneA @xianny
.circleci/ @dorothy-zbornak
packages/contract-addresses/ @abandeali1
packages/contract-artifacts/ @abandeali1
packages/dev-utils/ @LogvinovLeon @fabioberger
packages/devnet/ @albrow
packages/ethereum-types/ @LogvinovLeon
packages/monorepo-scripts/ @fabioberger
packages/order-utils/ @fabioberger @LogvinovLeon
packages/python-contract-wrappers/ @feuGeneA
packages/sol-compiler/ @LogvinovLeon
packages/sol-coverage/ @LogvinovLeon
packages/sol-profiler/ @LogvinovLeon
packages/sol-trace/ @LogvinovLeon
packages/sol-tracing-utils/ @LogvinovLeon
packages/sol-resolver/ @LogvinovLeon
packages/subproviders/ @fabioberger @dekz
packages/verdaccio/ @albrow
packages/web3-wrapper/ @LogvinovLeon @fabioberger
python-packages/ @feuGeneA
packages/utils/ @hysz
packages/order-utils/ @dorothy-zbornak
# Protocol/smart contracts
contracts/ @abandeali1 @hysz
contracts/ @abandeali1 @hysz @dorothy-zbornak @mzhu25

View File

@@ -4,9 +4,9 @@ We welcome contributions from anyone on the internet and are grateful for even t
### Getting started
1. Fork `0xproject/0x-monorepo`
1. Fork `0xproject/0x-tools`
2. Clone your fork
3. Follow the [installation & build steps](https://github.com/0xProject/0x-monorepo#install-dependencies) in the repo's top-level README.
3. Follow the [installation & build steps](https://github.com/0xProject/0x-tools#install-dependencies) in the repo's top-level README.
4. Setup the recommended [Development Tooling](#development-tooling).
5. Open a PR with the `[WIP]` flag against the `development` branch and describe the change you are intending to undertake in the PR description. (see [our branch naming conventions](#branch-structure))
@@ -59,11 +59,11 @@ We strongly recommend you use the [VSCode](https://code.visualstudio.com/) text
#### Linter
We use [TSLint](https://palantir.github.io/tslint/) with [custom configs](https://github.com/0xProject/0x-monorepo/tree/development/packages/tslint-config) to keep our code-style consistent.
We use [TSLint](https://palantir.github.io/tslint/) with [custom configs](https://github.com/0xProject/0x-tools/tree/development/packages/tslint-config) to keep our code-style consistent.
Use `yarn:lint` to lint the entire monorepo, and `PKG={PACKAGE_NAME} yarn lint` to lint a specific package.
If you want to change a rule, or add a custom rule, please make these changes to our [tslint-config](https://github.com/0xProject/0x-monorepo/tree/development/packages/tslint-config) package. All other packages have it as a dependency.
If you want to change a rule, or add a custom rule, please make these changes to our [tslint-config](https://github.com/0xProject/0x-tools/tree/development/packages/tslint-config) package. All other packages have it as a dependency.
Integrate it into your text editor:
@@ -94,12 +94,12 @@ A few of our coding conventions are not yet enforced by the linter/auto-formatte
### Fix `submit-coverage` CI failure
If you simply fork the repo and then create a PR from it, your PR will fail the `submit-coverage` check on CI. This is because the 0x CircleCI configuration sets the `COVERALLS_REPO_TOKEN` environment variable to the token for `0xProject/0x-monorepo`, but when running the check against your fork the token needs to match your repo's name `your-username/0x-monorepo`.
If you simply fork the repo and then create a PR from it, your PR will fail the `submit-coverage` check on CI. This is because the 0x CircleCI configuration sets the `COVERALLS_REPO_TOKEN` environment variable to the token for `0xProject/0x-tools`, but when running the check against your fork the token needs to match your repo's name `your-username/0x-tools`.
To facilitate this check, after creating your fork, but before creating the branch for your PR, do the following:
1. Log in to [coveralls.io](https://coveralls.io/), go to `Add Repos`, and enable your fork. Then go to the settings for that repo, and copy the `Repo Token` identifier.
2. Log in to [CircleCI](https://circleci.com/login), go to `Add Projects`, click the `Set Up Project` button corresponding to your fork, and then click `Start Building`. (Aside from step 3 below, no actual set up is needed, since it will use the `.circleci/config.yml` file in 0x-monorepo, so you can ignore all of the instruction/explanation given on the page with the `Start Building` button.)
2. Log in to [CircleCI](https://circleci.com/login), go to `Add Projects`, click the `Set Up Project` button corresponding to your fork, and then click `Start Building`. (Aside from step 3 below, no actual set up is needed, since it will use the `.circleci/config.yml` file in 0x-tools, so you can ignore all of the instruction/explanation given on the page with the `Start Building` button.)
3. In CircleCI, configure your project to add an environment variable, with name `COVERALLS_REPO_TOKEN`, and for the value paste in the `Repo Token` you copied in step 1.
Now, when you push to your branch, CircleCI will automatically run all of the checks in your own instance, and the coverage check will work since it has the proper `Repo Token`, and the PR will magically refer to your own checks rather than running them in the 0x CircleCI instance.

View File

@@ -1,4 +1,4 @@
Copyright 2017 ZeroEx Intl.
Copyright 2020 ZeroEx Labs
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@@ -17,17 +17,6 @@ This repository is a monorepo including the 0x protocol smart contracts and nume
Visit our [developer portal](https://0x.org/docs/tools/order-utils) for a comprehensive list of core & community maintained packages. All packages maintained with this monorepo are listed below.
### Python Packages
| Package | Version | Description |
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| [`0x-contract-addresses`](/python-packages/contract_addresses) | [![PyPI](https://img.shields.io/pypi/v/0x-contract-addresses.svg)](https://pypi.org/project/0x-contract-addresses/) | A tiny utility library for getting known deployed contract addresses for a particular network |
| [`0x-contract-artifacts`](/python-packages/contract_artifacts) | [![PyPI](https://img.shields.io/pypi/v/0x-contract-artifacts.svg)](https://pypi.org/project/0x-contract-artifacts/) | 0x smart contract compilation artifacts |
| [`0x-contract-wrappers`](/python-packages/contract_wrappers) | [![PyPI](https://img.shields.io/pypi/v/0x-contract-wrappers.svg)](https://pypi.org/project/0x-contract-wrappers/) | 0x smart contract wrappers |
| [`0x-json-schemas`](/python-packages/json_schemas) | [![PyPI](https://img.shields.io/pypi/v/0x-json-schemas.svg)](https://pypi.org/project/0x-json-schemas/) | 0x-related JSON schemas |
| [`0x-order-utils`](/python-packages/order_utils) | [![PyPI](https://img.shields.io/pypi/v/0x-order-utils.svg)](https://pypi.org/project/0x-order-utils/) | A set of utilities for generating, parsing, signing and validating 0x orders |
| [`0x-sra-client`](/python-packages/sra_client) | [![PyPI](https://img.shields.io/pypi/v/0x-sra-client.svg)](https://pypi.org/project/0x-sra-client/) | A Python client for interacting with servers conforming to the Standard Relayer API specification |
### Solidity Packages
These packages are all under development. See [/contracts/README.md](/contracts/README.md) for a list of deployed packages.
@@ -53,50 +42,13 @@ These packages are all under development. See [/contracts/README.md](/contracts/
#### 0x-specific packages
| Package | Version | Description |
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| [`0x.js`](/packages/0x.js) | [![npm](https://img.shields.io/npm/v/0x.js.svg)](https://www.npmjs.com/package/0x.js) | An aggregate package combining many smaller utility packages for interacting with the 0x protocol |
| [`@0x/contract-addresses`](/packages/contract-addresses) | [![npm](https://img.shields.io/npm/v/@0x/contract-addresses.svg)](https://www.npmjs.com/package/@0x/contract-addresses) | A tiny utility library for getting known deployed contract addresses for a particular network. |
| [`@0x/contract-wrappers`](/packages/contract-wrappers) | [![npm](https://img.shields.io/npm/v/@0x/contract-wrappers.svg)](https://www.npmjs.com/package/@0x/contract-wrappers) | JS/TS wrappers for interacting with the 0x smart contracts |
| [`@0x/order-utils`](/packages/order-utils) | [![npm](https://img.shields.io/npm/v/@0x/order-utils.svg)](https://www.npmjs.com/package/@0x/order-utils) | A set of utilities for generating, parsing, signing and validating 0x orders |
| [`@0x/json-schemas`](/packages/json-schemas) | [![npm](https://img.shields.io/npm/v/@0x/json-schemas.svg)](https://www.npmjs.com/package/@0x/json-schemas) | 0x-related JSON schemas | |
| [`@0x/migrations`](/packages/migrations) | [![npm](https://img.shields.io/npm/v/@0x/migrations.svg)](https://www.npmjs.com/package/@0x/migrations) | Migration tool for deploying 0x smart contracts on private testnets |
| [`@0x/contract-artifacts`](/packages/contract-artifacts) | [![npm](https://img.shields.io/npm/v/@0x/contract-artifacts.svg)](https://www.npmjs.com/package/@0x/contract-artifacts) | 0x smart contract compilation artifacts | |
| [`@0x/sra-spec`](/packages/sra-spec) | [![npm](https://img.shields.io/npm/v/@0x/sra-spec.svg)](https://www.npmjs.com/package/@0x/sra-spec) | OpenAPI specification for the Standard Relayer API |
| [`@0x/connect`](/packages/connect) | [![npm](https://img.shields.io/npm/v/@0x/connect.svg)](https://www.npmjs.com/package/@0x/connect) | An HTTP/WS client for interacting with the Standard Relayer API |
| [`@0x/asset-swapper`](/packages/asset-swapper) | [![npm](https://img.shields.io/npm/v/@0x/asset-swapper.svg)](https://www.npmjs.com/package/@0x/asset-swapper) | Convenience package for discovering and performing swaps for any ERC20 Assets |
#### Ethereum tooling
| Package | Version | Description |
| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`@0x/web3-wrapper`](/packages/web3-wrapper) | [![npm](https://img.shields.io/npm/v/@0x/web3-wrapper.svg)](https://www.npmjs.com/package/@0x/web3-wrapper) | An Ethereum JSON RPC client |
| [`@0x/sol-compiler`](/packages/sol-compiler) | [![npm](https://img.shields.io/npm/v/@0x/sol-compiler.svg)](https://www.npmjs.com/package/@0x/sol-compiler) | A wrapper around solc-js that adds smart re-compilation, ability to compile an entire project, Solidity version specific compilation, standard input description support and much more. |
| [`@0x/sol-coverage`](/packages/sol-coverage) | [![npm](https://img.shields.io/npm/v/@0x/sol-coverage.svg)](https://www.npmjs.com/package/@0x/sol-coverage) | A solidity test coverage tool |
| [`@0x/sol-profiler`](/packages/sol-profiler) | [![npm](https://img.shields.io/npm/v/@0x/sol-profiler.svg)](https://www.npmjs.com/package/@0x/sol-profiler) | A solidity gas cost profiler |
| [`@0x/sol-trace`](/packages/sol-trace) | [![npm](https://img.shields.io/npm/v/@0x/sol-trace.svg)](https://www.npmjs.com/package/@0x/sol-trace) | A solidity stack trace tool |
| [`@0x/sol-resolver`](/packages/sol-resolver) | [![npm](https://img.shields.io/npm/v/@0x/sol-resolver.svg)](https://www.npmjs.com/package/@0x/sol-resolver) | Import resolver for smart contracts dependencies |
| [`@0x/subproviders`](/packages/subproviders) | [![npm](https://img.shields.io/npm/v/@0x/subproviders.svg)](https://www.npmjs.com/package/@0x/subproviders) | Web3 provider middlewares (e.g. LedgerSubprovider) |
| [`@0x/sol-doc`](/packages/sol-doc) | [![npm](https://img.shields.io/npm/v/@0x/sol-doc.svg)](https://www.npmjs.com/package/@0x/sol-doc) | Solidity documentation generator |
#### Utilities
| Package | Version | Description |
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| [`@0x/abi-gen`](/packages/abi-gen) | [![npm](https://img.shields.io/npm/v/@0x/abi-gen.svg)](https://www.npmjs.com/package/@0x/abi-gen) | Tool to generate TS wrappers from smart contract ABIs |
| [`@0x/tslint-config`](/packages/tslint-config) | [![npm](https://img.shields.io/npm/v/@0x/tslint-config.svg)](https://www.npmjs.com/package/@0x/tslint-config) | Custom TSLint rules used by the 0x core team |
| [`@0x/types`](/packages/types) | [![npm](https://img.shields.io/npm/v/@0x/types.svg)](https://www.npmjs.com/package/@0x/types) | Shared type declarations |
| [`@0x/typescript-typings`](/packages/typescript-typings) | [![npm](https://img.shields.io/npm/v/@0x/typescript-typings.svg)](https://www.npmjs.com/package/@0x/typescript-typings) | Repository of types for external packages |
| [`@0x/utils`](/packages/utils) | [![npm](https://img.shields.io/npm/v/@0x/utils.svg)](https://www.npmjs.com/package/@0x/utils) | Shared utilities |
| [`@0x/assert`](/packages/assert) | [![npm](https://img.shields.io/npm/v/@0x/assert.svg)](https://www.npmjs.com/package/@0x/assert) | Type and schema assertions used by our packages |
| [`@0x/base-contract`](/packages/base-contract) | [![npm](https://img.shields.io/npm/v/@0x/base-contract.svg)](https://www.npmjs.com/package/@0x/base-contract) | BaseContract used by auto-generated `abi-gen` wrapper contracts |
| [`@0x/dev-utils`](/packages/dev-utils) | [![npm](https://img.shields.io/npm/v/@0x/dev-utils.svg)](https://www.npmjs.com/package/@0x/dev-utils) | Dev utils to be shared across 0x packages |
#### Private Packages
| Package | Description |
| ---------------------------------- | -------------------------------------------------------------------------------- |
| [`@0x/instant`](/packages/instant) | A free and flexible way to offer simple crypto purchasing in any app or website. |
| Package | Version | Description |
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| [`@0x/contract-addresses`](/packages/contract-addresses) | [![npm](https://img.shields.io/npm/v/@0x/contract-addresses.svg)](https://www.npmjs.com/package/@0x/contract-addresses) | A tiny utility library for getting known deployed contract addresses for a particular network. |
| [`@0x/contract-wrappers`](/packages/contract-wrappers) | [![npm](https://img.shields.io/npm/v/@0x/contract-wrappers.svg)](https://www.npmjs.com/package/@0x/contract-wrappers) | JS/TS wrappers for interacting with the 0x smart contracts |
| [`@0x/order-utils`](/packages/order-utils) | [![npm](https://img.shields.io/npm/v/@0x/order-utils.svg)](https://www.npmjs.com/package/@0x/order-utils) | A set of utilities for generating, parsing, signing and validating 0x orders |
| [`@0x/migrations`](/packages/migrations) | [![npm](https://img.shields.io/npm/v/@0x/migrations.svg)](https://www.npmjs.com/package/@0x/migrations) | Migration tool for deploying 0x smart contracts on private testnets |
| [`@0x/contract-artifacts`](/packages/contract-artifacts) | [![npm](https://img.shields.io/npm/v/@0x/contract-artifacts.svg)](https://www.npmjs.com/package/@0x/contract-artifacts) | 0x smart contract compilation artifacts | |
## Usage
@@ -129,8 +81,6 @@ Then install dependencies
yarn install
```
You will also need to have Python 3 installed, in order to build and run the tests of `abi-gen`'s command-line interface, which is integrated with the yarn build, yarn test, and yarn lint commands described below. More specifically, your local pip should resolve to the Python 3 version of pip, not a Python 2.x version.
### Build
To build all packages:

View File

@@ -1,4 +1,65 @@
[
{
"timestamp": 1603851023,
"version": "3.6.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.6.0",
"changes": [
{
"note": "Add `SwerveBridge` and `SnowSwapBridge` (duplicate of `CurveBridge`)",
"pr": 2707
}
],
"timestamp": 1603833198
},
{
"version": "3.5.0",
"changes": [
{
"note": "Update `CurveBridge` to support more varied curves",
"pr": 2633
},
{
"note": "Export DexForwarderBridgeContract",
"pr": 2656
},
{
"note": "Add BancorBridge and IBancorNetwork, ",
"pr": 2650
},
{
"note": "Added `MStableBridge`",
"pr": 2662
},
{
"note": "Added `MooniswapBridge`",
"pr": 2675
},
{
"note": "Reworked `KyberBridge`",
"pr": 2683
},
{
"note": "Added `CreamBridge`",
"pr": 2715
},
{
"note": "Added `ShellBridge`",
"pr": 2722
},
{
"note": "Added `DODOBridge`",
"pr": 2701
}
],
"timestamp": 1603265572
},
{
"version": "3.4.0",
"changes": [

View File

@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.6.1 - _October 28, 2020_
* Dependencies updated
## v3.6.0 - _October 27, 2020_
* Add `SwerveBridge` and `SnowSwapBridge` (duplicate of `CurveBridge`) (#2707)
## v3.5.0 - _October 21, 2020_
* Update `CurveBridge` to support more varied curves (#2633)
* Export DexForwarderBridgeContract (#2656)
* Add BancorBridge and IBancorNetwork, (#2650)
* Added `MStableBridge` (#2662)
* Added `MooniswapBridge` (#2675)
* Reworked `KyberBridge` (#2683)
* Added `CreamBridge` (#2715)
* Added `ShellBridge` (#2722)
* Added `DODOBridge` (#2701)
## v3.4.0 - _July 15, 2020_
* Fix instability with DFB. (#2616)

View File

@@ -0,0 +1,122 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
import "@0x/contracts-erc20/contracts/src/LibERC20Token.sol";
import "@0x/contracts-exchange-libs/contracts/src/IWallet.sol";
import "@0x/contracts-utils/contracts/src/DeploymentConstants.sol";
import "../interfaces/IERC20Bridge.sol";
import "../interfaces/IBancorNetwork.sol";
contract BancorBridge is
IERC20Bridge,
IWallet,
DeploymentConstants
{
struct TransferState {
address bancorNetworkAddress;
address[] path;
}
/// @dev Callback for `IERC20Bridge`. Tries to buy `amount` of
/// `toTokenAddress` tokens by selling the entirety of the `fromTokenAddress`
/// token encoded in the bridge data, then transfers the bought
/// tokens to `to`.
/// @param toTokenAddress The token to buy and transfer to `to`.
/// @param from The maker (this contract).
/// @param to The recipient of the bought tokens.
/// @param amount Minimum amount of `toTokenAddress` tokens to buy.
/// @param bridgeData The abi-encoded conversion path addresses and Bancor network address
/// @return success The magic bytes if successful.
function bridgeTransferFrom(
address toTokenAddress,
address from,
address to,
uint256 amount,
bytes calldata bridgeData
)
external
returns (bytes4 success)
{
// hold variables to get around stack depth limitations
TransferState memory state;
// Decode the bridge data.
(
state.path,
state.bancorNetworkAddress
// solhint-disable indent
) = abi.decode(bridgeData, (address[], address));
// solhint-enable indent
require(state.path.length > 0, "BancorBridge/PATH_MUST_EXIST");
// Just transfer the tokens if they're the same.
if (state.path[0] == toTokenAddress) {
LibERC20Token.transfer(state.path[0], to, amount);
return BRIDGE_SUCCESS;
}
// Otherwise use Bancor to convert
require(state.path.length > 2, "BancorBridge/PATH_LENGTH_MUST_BE_GREATER_THAN_TWO");
require(state.path[state.path.length - 1] == toTokenAddress, "BancorBridge/LAST_ELEMENT_OF_PATH_MUST_MATCH_OUTPUT_TOKEN");
// // Grant an allowance to the Bancor Network to spend `fromTokenAddress` token.
uint256 fromTokenBalance = IERC20Token(state.path[0]).balanceOf(address(this));
LibERC20Token.approveIfBelow(state.path[0], state.bancorNetworkAddress, fromTokenBalance);
// Convert the tokens
uint256 boughtAmount = IBancorNetwork(state.bancorNetworkAddress).convertByPath(
state.path, // path originating with source token and terminating in destination token
fromTokenBalance, // amount of source token to trade
amount, // minimum amount of destination token expected to receive
to, // beneficiary
address(0), // affiliateAccount; no fee paid
0 // affiliateFee; no fee paid
);
emit ERC20BridgeTransfer(
state.path[0], // fromTokenAddress
toTokenAddress,
fromTokenBalance,
boughtAmount,
from,
to
);
return BRIDGE_SUCCESS;
}
/// @dev `SignatureType.Wallet` callback, so that this bridge can be the maker
/// and sign for itself in orders. Always succeeds.
/// @return magicValue Magic success bytes, always.
function isValidSignature(
bytes32,
bytes calldata
)
external
view
returns (bytes4 magicValue)
{
return LEGACY_WALLET_MAGIC_VALUE;
}
}

View File

@@ -0,0 +1,103 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
import "@0x/contracts-erc20/contracts/src/LibERC20Token.sol";
import "@0x/contracts-exchange-libs/contracts/src/IWallet.sol";
import "@0x/contracts-utils/contracts/src/DeploymentConstants.sol";
import "../interfaces/IERC20Bridge.sol";
import "../interfaces/IBalancerPool.sol";
contract CreamBridge is
IERC20Bridge,
IWallet,
DeploymentConstants
{
/// @dev Callback for `IERC20Bridge`. Tries to buy `amount` of
/// `toTokenAddress` tokens by selling the entirety of the `fromTokenAddress`
/// token encoded in the bridge data, then transfers the bought
/// tokens to `to`.
/// @param toTokenAddress The token to buy and transfer to `to`.
/// @param from The maker (this contract).
/// @param to The recipient of the bought tokens.
/// @param amount Minimum amount of `toTokenAddress` tokens to buy.
/// @param bridgeData The abi-encoded addresses of the "from" token and Balancer pool.
/// @return success The magic bytes if successful.
function bridgeTransferFrom(
address toTokenAddress,
address from,
address to,
uint256 amount,
bytes calldata bridgeData
)
external
returns (bytes4 success)
{
// Decode the bridge data.
(address fromTokenAddress, address poolAddress) = abi.decode(
bridgeData,
(address, address)
);
require(toTokenAddress != fromTokenAddress, "CreamBridge/INVALID_PAIR");
uint256 fromTokenBalance = IERC20Token(fromTokenAddress).balanceOf(address(this));
// Grant an allowance to the exchange to spend `fromTokenAddress` token.
LibERC20Token.approveIfBelow(fromTokenAddress, poolAddress, fromTokenBalance);
// Sell all of this contract's `fromTokenAddress` token balance.
(uint256 boughtAmount,) = IBalancerPool(poolAddress).swapExactAmountIn(
fromTokenAddress, // tokenIn
fromTokenBalance, // tokenAmountIn
toTokenAddress, // tokenOut
amount, // minAmountOut
uint256(-1) // maxPrice
);
// Transfer the converted `toToken`s to `to`.
LibERC20Token.transfer(toTokenAddress, to, boughtAmount);
emit ERC20BridgeTransfer(
fromTokenAddress,
toTokenAddress,
fromTokenBalance,
boughtAmount,
from,
to
);
return BRIDGE_SUCCESS;
}
/// @dev `SignatureType.Wallet` callback, so that this bridge can be the maker
/// and sign for itself in orders. Always succeeds.
/// @return magicValue Magic success bytes, always.
function isValidSignature(
bytes32,
bytes calldata
)
external
view
returns (bytes4 magicValue)
{
return LEGACY_WALLET_MAGIC_VALUE;
}
}

View File

@@ -26,7 +26,6 @@ import "@0x/contracts-exchange-libs/contracts/src/IWallet.sol";
import "@0x/contracts-utils/contracts/src/DeploymentConstants.sol";
import "../interfaces/IERC20Bridge.sol";
import "../interfaces/ICurve.sol";
import "./MixinGasToken.sol";
// solhint-disable not-rely-on-time
@@ -34,14 +33,14 @@ import "./MixinGasToken.sol";
contract CurveBridge is
IERC20Bridge,
IWallet,
DeploymentConstants,
MixinGasToken
DeploymentConstants
{
struct CurveBridgeData {
address curveAddress;
bytes4 exchangeFunctionSelector;
address fromTokenAddress;
int128 fromCoinIdx;
int128 toCoinIdx;
int128 version;
}
/// @dev Callback for `ICurve`. Tries to buy `amount` of
@@ -62,39 +61,31 @@ contract CurveBridge is
bytes calldata bridgeData
)
external
freesGasTokensFromCollector
returns (bytes4 success)
{
// Decode the bridge data to get the Curve metadata.
CurveBridgeData memory data = abi.decode(bridgeData, (CurveBridgeData));
address fromTokenAddress = ICurve(data.curveAddress).underlying_coins(data.fromCoinIdx);
require(toTokenAddress != fromTokenAddress, "CurveBridge/INVALID_PAIR");
uint256 fromTokenBalance = IERC20Token(fromTokenAddress).balanceOf(address(this));
require(toTokenAddress != data.fromTokenAddress, "CurveBridge/INVALID_PAIR");
uint256 fromTokenBalance = IERC20Token(data.fromTokenAddress).balanceOf(address(this));
// Grant an allowance to the exchange to spend `fromTokenAddress` token.
LibERC20Token.approveIfBelow(fromTokenAddress, data.curveAddress, fromTokenBalance);
LibERC20Token.approveIfBelow(data.fromTokenAddress, data.curveAddress, fromTokenBalance);
// Try to sell all of this contract's `fromTokenAddress` token balance.
if (data.version == 0) {
ICurve(data.curveAddress).exchange_underlying(
data.fromCoinIdx,
data.toCoinIdx,
// dx
fromTokenBalance,
// min dy
amount,
// expires
block.timestamp + 1
);
} else {
ICurve(data.curveAddress).exchange_underlying(
data.fromCoinIdx,
data.toCoinIdx,
// dx
fromTokenBalance,
// min dy
amount
);
{
(bool didSucceed, bytes memory resultData) =
data.curveAddress.call(abi.encodeWithSelector(
data.exchangeFunctionSelector,
data.fromCoinIdx,
data.toCoinIdx,
// dx
fromTokenBalance,
// min dy
amount
));
if (!didSucceed) {
assembly { revert(add(resultData, 32), mload(resultData)) }
}
}
uint256 toTokenBalance = IERC20Token(toTokenAddress).balanceOf(address(this));
@@ -102,7 +93,7 @@ contract CurveBridge is
LibERC20Token.transfer(toTokenAddress, to, toTokenBalance);
emit ERC20BridgeTransfer(
fromTokenAddress,
data.fromTokenAddress,
toTokenAddress,
fromTokenBalance,
toTokenBalance,

View File

@@ -0,0 +1,147 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
import "@0x/contracts-erc20/contracts/src/LibERC20Token.sol";
import "@0x/contracts-exchange-libs/contracts/src/IWallet.sol";
import "@0x/contracts-utils/contracts/src/DeploymentConstants.sol";
import "../interfaces/IERC20Bridge.sol";
interface IDODOHelper {
function querySellQuoteToken(address dodo, uint256 amount) external view returns (uint256);
}
interface IDODO {
function sellBaseToken(uint256 amount, uint256 minReceiveQuote, bytes calldata data) external returns (uint256);
function buyBaseToken(uint256 amount, uint256 maxPayQuote, bytes calldata data) external returns (uint256);
}
contract DODOBridge is
IERC20Bridge,
IWallet,
DeploymentConstants
{
struct TransferState {
address fromTokenAddress;
uint256 fromTokenBalance;
address pool;
bool isSellBase;
}
/// @dev Callback for `IERC20Bridge`. Tries to buy `amount` of
/// `toTokenAddress` tokens by selling the entirety of the `fromTokenAddress`
/// token encoded in the bridge data.
/// @param toTokenAddress The token to buy and transfer to `to`.
/// @param from The maker (this contract).
/// @param to The recipient of the bought tokens.
/// @param amount Minimum amount of `toTokenAddress` tokens to buy.
/// @param bridgeData The abi-encoded path of token addresses. Last element must be toTokenAddress
/// @return success The magic bytes if successful.
function bridgeTransferFrom(
address toTokenAddress,
address from,
address to,
uint256 amount,
bytes calldata bridgeData
)
external
returns (bytes4 success)
{
TransferState memory state;
// Decode the bridge data to get the `fromTokenAddress`.
(state.fromTokenAddress, state.pool, state.isSellBase) = abi.decode(bridgeData, (address, address, bool));
require(state.pool != address(0), "DODOBridge/InvalidPool");
IDODO exchange = IDODO(state.pool);
// Get our balance of `fromTokenAddress` token.
state.fromTokenBalance = IERC20Token(state.fromTokenAddress).balanceOf(address(this));
// Grant the pool an allowance.
LibERC20Token.approveIfBelow(
state.fromTokenAddress,
address(exchange),
state.fromTokenBalance
);
uint256 boughtAmount;
if (state.isSellBase) {
boughtAmount = exchange.sellBaseToken(
// amount to sell
state.fromTokenBalance,
// min receive amount
1,
new bytes(0)
);
} else {
// Need to re-calculate the sell quote amount into buyBase
boughtAmount = IDODOHelper(_getDODOHelperAddress()).querySellQuoteToken(
address(exchange),
state.fromTokenBalance
);
exchange.buyBaseToken(
// amount to buy
boughtAmount,
// max pay amount
state.fromTokenBalance,
new bytes(0)
);
}
// Transfer funds to `to`
IERC20Token(toTokenAddress).transfer(to, boughtAmount);
emit ERC20BridgeTransfer(
// input token
state.fromTokenAddress,
// output token
toTokenAddress,
// input token amount
state.fromTokenBalance,
// output token amount
boughtAmount,
from,
to
);
return BRIDGE_SUCCESS;
}
/// @dev `SignatureType.Wallet` callback, so that this bridge can be the maker
/// and sign for itself in orders. Always succeeds.
/// @return magicValue Success bytes, always.
function isValidSignature(
bytes32,
bytes calldata
)
external
view
returns (bytes4 magicValue)
{
return LEGACY_WALLET_MAGIC_VALUE;
}
}

View File

@@ -1,6 +1,6 @@
/*
Copyright 2019 ZeroEx Intl.
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -45,6 +45,7 @@ contract KyberBridge is
uint256 fromTokenBalance;
uint256 payableAmount;
uint256 conversionRate;
bytes hint;
}
/// @dev Kyber ETH pseudo-address.
@@ -85,47 +86,35 @@ contract KyberBridge is
state.kyber = IKyberNetworkProxy(_getKyberNetworkProxyAddress());
state.weth = IEtherToken(_getWethAddress());
// Decode the bridge data to get the `fromTokenAddress`.
(state.fromTokenAddress) = abi.decode(bridgeData, (address));
(state.fromTokenAddress, state.hint) = abi.decode(bridgeData, (address, bytes));
// Query the balance of "from" tokens.
state.fromTokenBalance = IERC20Token(state.fromTokenAddress).balanceOf(address(this));
if (state.fromTokenBalance == 0) {
// Return failure if no input tokens.
return BRIDGE_FAILED;
}
// Compute the conversion rate, expressed in 18 decimals.
// The sequential notation is to get around stack limits.
state.conversionRate = KYBER_RATE_BASE;
state.conversionRate = state.conversionRate.safeMul(amount);
state.conversionRate = state.conversionRate.safeMul(
10 ** uint256(LibERC20Token.decimals(state.fromTokenAddress))
);
state.conversionRate = state.conversionRate.safeDiv(state.fromTokenBalance);
state.conversionRate = state.conversionRate.safeDiv(
10 ** uint256(LibERC20Token.decimals(toTokenAddress))
);
if (state.fromTokenAddress == toTokenAddress) {
// Just transfer the tokens if they're the same.
LibERC20Token.transfer(state.fromTokenAddress, to, state.fromTokenBalance);
return BRIDGE_SUCCESS;
} else if (state.fromTokenAddress != address(state.weth)) {
// If the input token is not WETH, grant an allowance to the exchange
// to spend them.
}
if (state.fromTokenAddress == address(state.weth)) {
// From WETH
state.fromTokenAddress = KYBER_ETH_ADDRESS;
state.payableAmount = state.fromTokenBalance;
state.weth.withdraw(state.fromTokenBalance);
} else {
LibERC20Token.approveIfBelow(
state.fromTokenAddress,
address(state.kyber),
state.fromTokenBalance
);
} else {
// If the input token is WETH, unwrap it and attach it to the call.
state.fromTokenAddress = KYBER_ETH_ADDRESS;
state.payableAmount = state.fromTokenBalance;
state.weth.withdraw(state.fromTokenBalance);
}
bool isToTokenWeth = toTokenAddress == address(state.weth);
// Try to sell all of this contract's input token balance through
// `KyberNetworkProxy.trade()`.
uint256 boughtAmount = state.kyber.trade.value(state.payableAmount)(
uint256 boughtAmount = state.kyber.tradeWithHint.value(state.payableAmount)(
// Input token.
state.fromTokenAddress,
// Sell amount.
@@ -137,11 +126,11 @@ contract KyberBridge is
isToTokenWeth ? address(uint160(address(this))) : address(uint160(to)),
// Buy as much as possible.
uint256(-1),
// Compute the minimum conversion rate, which is expressed in units with
// 18 decimal places.
state.conversionRate,
// The minimum conversion rate
1,
// No affiliate address.
address(0)
address(0),
state.hint
);
// Wrap ETH output and transfer to recipient.
if (isToTokenWeth) {
@@ -173,4 +162,5 @@ contract KyberBridge is
{
return LEGACY_WALLET_MAGIC_VALUE;
}
}

View File

@@ -0,0 +1,94 @@
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
import "@0x/contracts-erc20/contracts/src/LibERC20Token.sol";
import "@0x/contracts-exchange-libs/contracts/src/IWallet.sol";
import "@0x/contracts-utils/contracts/src/DeploymentConstants.sol";
import "../interfaces/IERC20Bridge.sol";
import "../interfaces/IMStable.sol";
contract MStableBridge is
IERC20Bridge,
IWallet,
DeploymentConstants
{
/// @dev Swaps specified tokens against the mStable mUSD contract
/// @param toTokenAddress The token to give to `to` (i.e DAI, USDC, USDT).
/// @param from The maker (this contract).
/// @param to The recipient of the bought tokens.
/// @param amount Minimum amount of `toTokenAddress` tokens to buy.
/// @param bridgeData The abi-encoded "from" token address.
/// @return success The magic bytes if successful.
// solhint-disable no-unused-vars
function bridgeTransferFrom(
address toTokenAddress,
address from,
address to,
uint256 amount,
bytes calldata bridgeData
)
external
returns (bytes4 success)
{
// Decode the bridge data to get the `fromTokenAddress`.
(address fromTokenAddress) = abi.decode(bridgeData, (address));
IMStable exchange = IMStable(_getMUsdAddress());
uint256 fromTokenBalance = IERC20Token(fromTokenAddress).balanceOf(address(this));
// Grant an allowance to the exchange to spend `fromTokenAddress` token.
LibERC20Token.approveIfBelow(fromTokenAddress, address(exchange), fromTokenBalance);
// Try to sell all of this contract's `fromTokenAddress` token balance.
uint256 boughtAmount = exchange.swap(
fromTokenAddress,
toTokenAddress,
fromTokenBalance,
to
);
emit ERC20BridgeTransfer(
fromTokenAddress,
toTokenAddress,
fromTokenBalance,
boughtAmount,
from,
to
);
return BRIDGE_SUCCESS;
}
/// @dev `SignatureType.Wallet` callback, so that this bridge can be the maker
/// and sign for itself in orders. Always succeeds.
/// @return magicValue Magic success bytes, always.
function isValidSignature(
bytes32,
bytes calldata
)
external
view
returns (bytes4 magicValue)
{
return LEGACY_WALLET_MAGIC_VALUE;
}
}

View File

@@ -0,0 +1,148 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
import "@0x/contracts-erc20/contracts/src/interfaces/IEtherToken.sol";
import "@0x/contracts-erc20/contracts/src/LibERC20Token.sol";
import "@0x/contracts-exchange-libs/contracts/src/IWallet.sol";
import "@0x/contracts-utils/contracts/src/DeploymentConstants.sol";
import "../interfaces/IERC20Bridge.sol";
import "../interfaces/IMooniswap.sol";
// solhint-disable space-after-comma
// solhint-disable not-rely-on-time
contract MooniswapBridge is
IERC20Bridge,
IWallet,
DeploymentConstants
{
struct TransferState {
IMooniswap pool;
uint256 fromTokenBalance;
IEtherToken weth;
uint256 boughtAmount;
address fromTokenAddress;
address toTokenAddress;
}
// solhint-disable no-empty-blocks
/// @dev Payable fallback to receive ETH from uniswap.
function ()
external
payable
{}
/// @dev Callback for `IERC20Bridge`. Tries to buy `amount` of
/// `toTokenAddress` tokens by selling the entirety of the `fromTokenAddress`
/// token encoded in the bridge data.
/// @param toTokenAddress The token to buy and transfer to `to`.
/// @param from The maker (this contract).
/// @param to The recipient of the bought tokens.
/// @param amount Minimum amount of `toTokenAddress` tokens to buy.
/// @param bridgeData The abi-encoded path of token addresses. Last element must be toTokenAddress
/// @return success The magic bytes if successful.
function bridgeTransferFrom(
address toTokenAddress,
address from,
address to,
uint256 amount,
bytes calldata bridgeData
)
external
returns (bytes4 success)
{
// State memory object to avoid stack overflows.
TransferState memory state;
// Decode the bridge data to get the `fromTokenAddress`.
address fromTokenAddress = abi.decode(bridgeData, (address));
// Get the weth contract.
state.weth = IEtherToken(_getWethAddress());
// Get our balance of `fromTokenAddress` token.
state.fromTokenBalance = IERC20Token(fromTokenAddress).balanceOf(address(this));
state.fromTokenAddress = fromTokenAddress == address(state.weth) ? address(0) : fromTokenAddress;
state.toTokenAddress = toTokenAddress == address(state.weth) ? address(0) : toTokenAddress;
state.pool = IMooniswap(
IMooniswapRegistry(_getMooniswapAddress()).pools(
state.fromTokenAddress,
state.toTokenAddress
)
);
// withdraw WETH to ETH
if (state.fromTokenAddress == address(0)) {
state.weth.withdraw(state.fromTokenBalance);
} else {
// Grant the pool an allowance.
LibERC20Token.approveIfBelow(
state.fromTokenAddress,
address(state.pool),
state.fromTokenBalance
);
}
uint256 ethValue = state.fromTokenAddress == address(0) ? state.fromTokenBalance : 0;
state.boughtAmount = state.pool.swap.value(ethValue)(
state.fromTokenAddress,
state.toTokenAddress,
state.fromTokenBalance,
amount,
address(0)
);
// Deposit to WETH
if (state.toTokenAddress == address(0)) {
state.weth.deposit.value(state.boughtAmount)();
}
// Transfer funds to `to`
LibERC20Token.transfer(toTokenAddress, to, state.boughtAmount);
emit ERC20BridgeTransfer(
// input token
fromTokenAddress,
// output token
toTokenAddress,
// input token amount
state.fromTokenBalance,
// output token amount
state.boughtAmount,
from,
to
);
return BRIDGE_SUCCESS;
}
/// @dev `SignatureType.Wallet` callback, so that this bridge can be the maker
/// and sign for itself in orders. Always succeeds.
/// @return magicValue Success bytes, always.
function isValidSignature(
bytes32,
bytes calldata
)
external
view
returns (bytes4 magicValue)
{
return LEGACY_WALLET_MAGIC_VALUE;
}
}

View File

@@ -0,0 +1,96 @@
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
import "@0x/contracts-erc20/contracts/src/LibERC20Token.sol";
import "@0x/contracts-exchange-libs/contracts/src/IWallet.sol";
import "@0x/contracts-utils/contracts/src/DeploymentConstants.sol";
import "../interfaces/IERC20Bridge.sol";
import "../interfaces/IShell.sol";
contract ShellBridge is
IERC20Bridge,
IWallet,
DeploymentConstants
{
/// @dev Swaps specified tokens against the Shell contract
/// @param toTokenAddress The token to give to `to`.
/// @param from The maker (this contract).
/// @param to The recipient of the bought tokens.
/// @param amount Minimum amount of `toTokenAddress` tokens to buy.
/// @param bridgeData The abi-encoded "from" token address.
/// @return success The magic bytes if successful.
// solhint-disable no-unused-vars
function bridgeTransferFrom(
address toTokenAddress,
address from,
address to,
uint256 amount,
bytes calldata bridgeData
)
external
returns (bytes4 success)
{
// Decode the bridge data to get the `fromTokenAddress`.
(address fromTokenAddress) = abi.decode(bridgeData, (address));
uint256 fromTokenBalance = IERC20Token(fromTokenAddress).balanceOf(address(this));
IShell exchange = IShell(_getShellAddress());
// Grant an allowance to the exchange to spend `fromTokenAddress` token.
LibERC20Token.approveIfBelow(fromTokenAddress, address(exchange), fromTokenBalance);
// Try to sell all of this contract's `fromTokenAddress` token balance.
uint256 boughtAmount = exchange.originSwap(
fromTokenAddress,
toTokenAddress,
fromTokenBalance,
amount, // min amount
block.timestamp + 1
);
LibERC20Token.transfer(toTokenAddress, to, boughtAmount);
emit ERC20BridgeTransfer(
fromTokenAddress,
toTokenAddress,
fromTokenBalance,
boughtAmount,
from,
to
);
return BRIDGE_SUCCESS;
}
/// @dev `SignatureType.Wallet` callback, so that this bridge can be the maker
/// and sign for itself in orders. Always succeeds.
/// @return magicValue Magic success bytes, always.
function isValidSignature(
bytes32,
bytes calldata
)
external
view
returns (bytes4 magicValue)
{
return LEGACY_WALLET_MAGIC_VALUE;
}
}

View File

@@ -0,0 +1,119 @@
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
import "@0x/contracts-erc20/contracts/src/LibERC20Token.sol";
import "@0x/contracts-exchange-libs/contracts/src/IWallet.sol";
import "@0x/contracts-utils/contracts/src/DeploymentConstants.sol";
import "../interfaces/IERC20Bridge.sol";
import "../interfaces/ICurve.sol";
// solhint-disable not-rely-on-time
// solhint-disable space-after-comma
contract SnowSwapBridge is
IERC20Bridge,
IWallet,
DeploymentConstants
{
struct SnowSwapBridgeData {
address curveAddress;
bytes4 exchangeFunctionSelector;
address fromTokenAddress;
int128 fromCoinIdx;
int128 toCoinIdx;
}
/// @dev Callback for `ICurve`. Tries to buy `amount` of
/// `toTokenAddress` tokens by selling the entirety of the opposing asset
/// (DAI, USDC) to the Curve contract, then transfers the bought
/// tokens to `to`.
/// @param toTokenAddress The token to give to `to` (i.e DAI, USDC, USDT).
/// @param from The maker (this contract).
/// @param to The recipient of the bought tokens.
/// @param amount Minimum amount of `toTokenAddress` tokens to buy.
/// @param bridgeData The abi-encoeded "from" token address.
/// @return success The magic bytes if successful.
function bridgeTransferFrom(
address toTokenAddress,
address from,
address to,
uint256 amount,
bytes calldata bridgeData
)
external
returns (bytes4 success)
{
// Decode the bridge data to get the SnowSwap metadata.
SnowSwapBridgeData memory data = abi.decode(bridgeData, (SnowSwapBridgeData));
require(toTokenAddress != data.fromTokenAddress, "SnowSwapBridge/INVALID_PAIR");
uint256 fromTokenBalance = IERC20Token(data.fromTokenAddress).balanceOf(address(this));
// Grant an allowance to the exchange to spend `fromTokenAddress` token.
LibERC20Token.approveIfBelow(data.fromTokenAddress, data.curveAddress, fromTokenBalance);
// Try to sell all of this contract's `fromTokenAddress` token balance.
{
(bool didSucceed, bytes memory resultData) =
data.curveAddress.call(abi.encodeWithSelector(
data.exchangeFunctionSelector,
data.fromCoinIdx,
data.toCoinIdx,
// dx
fromTokenBalance,
// min dy
amount
));
if (!didSucceed) {
assembly { revert(add(resultData, 32), mload(resultData)) }
}
}
uint256 toTokenBalance = IERC20Token(toTokenAddress).balanceOf(address(this));
// Transfer the converted `toToken`s to `to`.
LibERC20Token.transfer(toTokenAddress, to, toTokenBalance);
emit ERC20BridgeTransfer(
data.fromTokenAddress,
toTokenAddress,
fromTokenBalance,
toTokenBalance,
from,
to
);
return BRIDGE_SUCCESS;
}
/// @dev `SignatureType.Wallet` callback, so that this bridge can be the maker
/// and sign for itself in orders. Always succeeds.
/// @return magicValue Magic success bytes, always.
function isValidSignature(
bytes32,
bytes calldata
)
external
view
returns (bytes4 magicValue)
{
return LEGACY_WALLET_MAGIC_VALUE;
}
}

View File

@@ -0,0 +1,136 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
import "@0x/contracts-erc20/contracts/src/interfaces/IEtherToken.sol";
import "@0x/contracts-erc20/contracts/src/LibERC20Token.sol";
import "@0x/contracts-exchange-libs/contracts/src/IWallet.sol";
import "@0x/contracts-utils/contracts/src/LibAddressArray.sol";
import "@0x/contracts-utils/contracts/src/DeploymentConstants.sol";
import "../interfaces/IUniswapV2Router01.sol";
import "../interfaces/IERC20Bridge.sol";
// solhint-disable space-after-comma
// solhint-disable not-rely-on-time
contract SushiSwapBridge is
IERC20Bridge,
IWallet,
DeploymentConstants
{
struct TransferState {
address[] path;
address router;
uint256 fromTokenBalance;
}
/// @dev Callback for `IERC20Bridge`. Tries to buy `amount` of
/// `toTokenAddress` tokens by selling the entirety of the `fromTokenAddress`
/// token encoded in the bridge data.
/// @param toTokenAddress The token to buy and transfer to `to`.
/// @param from The maker (this contract).
/// @param to The recipient of the bought tokens.
/// @param amount Minimum amount of `toTokenAddress` tokens to buy.
/// @param bridgeData The abi-encoded path of token addresses. Last element must be toTokenAddress
/// @return success The magic bytes if successful.
function bridgeTransferFrom(
address toTokenAddress,
address from,
address to,
uint256 amount,
bytes calldata bridgeData
)
external
returns (bytes4 success)
{
// hold variables to get around stack depth limitations
TransferState memory state;
// Decode the bridge data to get the `fromTokenAddress`.
// solhint-disable indent
(state.path, state.router) = abi.decode(bridgeData, (address[], address));
// solhint-enable indent
require(state.path.length >= 2, "SushiSwapBridge/PATH_LENGTH_MUST_BE_AT_LEAST_TWO");
require(state.path[state.path.length - 1] == toTokenAddress, "SushiSwapBridge/LAST_ELEMENT_OF_PATH_MUST_MATCH_OUTPUT_TOKEN");
// Just transfer the tokens if they're the same.
if (state.path[0] == toTokenAddress) {
LibERC20Token.transfer(state.path[0], to, amount);
return BRIDGE_SUCCESS;
}
// Get our balance of `fromTokenAddress` token.
state.fromTokenBalance = IERC20Token(state.path[0]).balanceOf(address(this));
// Grant the SushiSwap router an allowance.
LibERC20Token.approveIfBelow(
state.path[0],
state.router,
state.fromTokenBalance
);
// Buy as much `toTokenAddress` token with `fromTokenAddress` token
// and transfer it to `to`.
IUniswapV2Router01 router = IUniswapV2Router01(state.router);
uint[] memory amounts = router.swapExactTokensForTokens(
// Sell all tokens we hold.
state.fromTokenBalance,
// Minimum buy amount.
amount,
// Convert `fromTokenAddress` to `toTokenAddress`.
state.path,
// Recipient is `to`.
to,
// Expires after this block.
block.timestamp
);
emit ERC20BridgeTransfer(
// input token
state.path[0],
// output token
toTokenAddress,
// input token amount
state.fromTokenBalance,
// output token amount
amounts[amounts.length - 1],
from,
to
);
return BRIDGE_SUCCESS;
}
/// @dev `SignatureType.Wallet` callback, so that this bridge can be the maker
/// and sign for itself in orders. Always succeeds.
/// @return magicValue Success bytes, always.
function isValidSignature(
bytes32,
bytes calldata
)
external
view
returns (bytes4 magicValue)
{
return LEGACY_WALLET_MAGIC_VALUE;
}
}

View File

@@ -0,0 +1,119 @@
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
import "@0x/contracts-erc20/contracts/src/LibERC20Token.sol";
import "@0x/contracts-exchange-libs/contracts/src/IWallet.sol";
import "@0x/contracts-utils/contracts/src/DeploymentConstants.sol";
import "../interfaces/IERC20Bridge.sol";
import "../interfaces/ICurve.sol";
// solhint-disable not-rely-on-time
// solhint-disable space-after-comma
contract SwerveBridge is
IERC20Bridge,
IWallet,
DeploymentConstants
{
struct SwerveBridgeData {
address curveAddress;
bytes4 exchangeFunctionSelector;
address fromTokenAddress;
int128 fromCoinIdx;
int128 toCoinIdx;
}
/// @dev Callback for `ICurve`. Tries to buy `amount` of
/// `toTokenAddress` tokens by selling the entirety of the opposing asset
/// (DAI, USDC) to the Curve contract, then transfers the bought
/// tokens to `to`.
/// @param toTokenAddress The token to give to `to` (i.e DAI, USDC, USDT).
/// @param from The maker (this contract).
/// @param to The recipient of the bought tokens.
/// @param amount Minimum amount of `toTokenAddress` tokens to buy.
/// @param bridgeData The abi-encoeded "from" token address.
/// @return success The magic bytes if successful.
function bridgeTransferFrom(
address toTokenAddress,
address from,
address to,
uint256 amount,
bytes calldata bridgeData
)
external
returns (bytes4 success)
{
// Decode the bridge data to get the SwerveBridgeData metadata.
SwerveBridgeData memory data = abi.decode(bridgeData, (SwerveBridgeData));
require(toTokenAddress != data.fromTokenAddress, "SwerveBridge/INVALID_PAIR");
uint256 fromTokenBalance = IERC20Token(data.fromTokenAddress).balanceOf(address(this));
// Grant an allowance to the exchange to spend `fromTokenAddress` token.
LibERC20Token.approveIfBelow(data.fromTokenAddress, data.curveAddress, fromTokenBalance);
// Try to sell all of this contract's `fromTokenAddress` token balance.
{
(bool didSucceed, bytes memory resultData) =
data.curveAddress.call(abi.encodeWithSelector(
data.exchangeFunctionSelector,
data.fromCoinIdx,
data.toCoinIdx,
// dx
fromTokenBalance,
// min dy
amount
));
if (!didSucceed) {
assembly { revert(add(resultData, 32), mload(resultData)) }
}
}
uint256 toTokenBalance = IERC20Token(toTokenAddress).balanceOf(address(this));
// Transfer the converted `toToken`s to `to`.
LibERC20Token.transfer(toTokenAddress, to, toTokenBalance);
emit ERC20BridgeTransfer(
data.fromTokenAddress,
toTokenAddress,
fromTokenBalance,
toTokenBalance,
from,
to
);
return BRIDGE_SUCCESS;
}
/// @dev `SignatureType.Wallet` callback, so that this bridge can be the maker
/// and sign for itself in orders. Always succeeds.
/// @return magicValue Magic success bytes, always.
function isValidSignature(
bytes32,
bytes calldata
)
external
view
returns (bytes4 magicValue)
{
return LEGACY_WALLET_MAGIC_VALUE;
}
}

View File

@@ -0,0 +1,38 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.9;
contract IContractRegistry {
function addressOf(
bytes32 contractName
) external returns(address);
}
contract IBancorNetwork {
function convertByPath(
address[] calldata _path,
uint256 _amount,
uint256 _minReturn,
address _beneficiary,
address _affiliateAccount,
uint256 _affiliateFee
) external payable returns (uint256);
}

View File

@@ -22,22 +22,6 @@ pragma solidity ^0.5.9;
// solhint-disable func-name-mixedcase
interface ICurve {
/// @dev Sell `sellAmount` of `fromToken` token and receive `toToken` token.
/// This function exists on early versions of Curve (USDC/DAI)
/// @param i The token index being sold.
/// @param j The token index being bought.
/// @param sellAmount The amount of token being bought.
/// @param minBuyAmount The minimum buy amount of the token being bought.
/// @param deadline The time in seconds when this operation should expire.
function exchange_underlying(
int128 i,
int128 j,
uint256 sellAmount,
uint256 minBuyAmount,
uint256 deadline
)
external;
/// @dev Sell `sellAmount` of `fromToken` token and receive `toToken` token.
/// This function exists on later versions of Curve (USDC/DAI/USDT)
/// @param i The token index being sold.

View File

@@ -42,5 +42,31 @@ interface IKyberNetworkProxy {
)
external
payable
returns(uint256 boughtAmount);
returns (uint256 boughtAmount);
/// @dev Sells `sellTokenAddress` tokens for `buyTokenAddress` tokens
/// using a hint for the reserve.
/// @param sellTokenAddress Token to sell.
/// @param sellAmount Amount of tokens to sell.
/// @param buyTokenAddress Token to buy.
/// @param recipientAddress Address to send bought tokens to.
/// @param maxBuyTokenAmount A limit on the amount of tokens to buy.
/// @param minConversionRate The minimal conversion rate. If actual rate
/// is lower, trade is canceled.
/// @param walletId The wallet ID to send part of the fees
/// @param hint The hint for the selective inclusion (or exclusion) of reserves
/// @return boughtAmount Amount of tokens bought.
function tradeWithHint(
address sellTokenAddress,
uint256 sellAmount,
address buyTokenAddress,
address payable recipientAddress,
uint256 maxBuyTokenAmount,
uint256 minConversionRate,
address payable walletId,
bytes calldata hint
)
external
payable
returns (uint256 boughtAmount);
}

View File

@@ -16,22 +16,17 @@
*/
pragma solidity 0.6.4;
pragma solidity ^0.5.9;
contract V6Contract {
interface IMStable {
uint256 private _privateNumber;
constructor(uint256 privateNumber) public {
_privateNumber = privateNumber;
}
fallback() external {
revert('nope');
}
receive() payable external {
// no-op
}
function swap(
address _input,
address _output,
uint256 _quantity,
address _recipient
)
external
returns (uint256 output);
}

View File

@@ -19,16 +19,22 @@
pragma solidity ^0.5.9;
interface IKyberNetworkProxy {
interface IMooniswapRegistry {
function kyberNetwork() external view returns (address);
function kyberHintHandler() external view returns (address);
function getExpectedRateAfterFee(
address src,
address dest,
uint256 srcQty,
uint256 platformFeeBps,
bytes calldata hint
) external view returns (uint256 expectedRate);
function pools(address token1, address token2) external view returns(address);
}
interface IMooniswap {
function swap(
address fromToken,
address destToken,
uint256 amount,
uint256 minReturn,
address referral
)
external
payable
returns(uint256 returnAmount);
}

View File

@@ -19,19 +19,16 @@
pragma solidity ^0.5.9;
interface IKyberStorage {
interface IShell {
function getReserveId(
address reserve
function originSwap(
address from,
address to,
uint256 fromAmount,
uint256 minTargetAmount,
uint256 deadline
)
external
view
returns (bytes32 reserveId);
function getReserveIdsPerTokenSrc(
address token
)
external
view
returns (bytes32[] memory reserveIds);
returns (uint256 toAmount);
}

View File

@@ -0,0 +1,247 @@
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
import "@0x/contracts-utils/contracts/src/LibSafeMath.sol";
import "@0x/contracts-utils/contracts/src/LibAddressArray.sol";
import "../src/bridges/BancorBridge.sol";
import "../src/interfaces/IBancorNetwork.sol";
contract TestEventsRaiser {
event TokenTransfer(
address token,
address from,
address to,
uint256 amount
);
event TokenApprove(
address spender,
uint256 allowance
);
event ConvertByPathInput(
uint amountIn,
uint amountOutMin,
address toTokenAddress,
address to,
address feeRecipient,
uint256 feeAmount
);
function raiseTokenTransfer(
address from,
address to,
uint256 amount
)
external
{
emit TokenTransfer(
msg.sender,
from,
to,
amount
);
}
function raiseTokenApprove(address spender, uint256 allowance) external {
emit TokenApprove(spender, allowance);
}
function raiseConvertByPathInput(
uint amountIn,
uint amountOutMin,
address toTokenAddress,
address to,
address feeRecipient,
uint256 feeAmount
) external
{
emit ConvertByPathInput(
amountIn,
amountOutMin,
toTokenAddress,
to,
feeRecipient,
feeAmount
);
}
}
/// @dev A minimalist ERC20 token.
contract TestToken {
using LibSafeMath for uint256;
mapping (address => uint256) public balances;
string private _nextRevertReason;
/// @dev Set the balance for `owner`.
function setBalance(address owner, uint256 balance)
external
payable
{
balances[owner] = balance;
}
/// @dev Just emits a TokenTransfer event on the caller
function transfer(address to, uint256 amount)
external
returns (bool)
{
TestEventsRaiser(msg.sender).raiseTokenTransfer(msg.sender, to, amount);
return true;
}
/// @dev Just emits a TokenApprove event on the caller
function approve(address spender, uint256 allowance)
external
returns (bool)
{
TestEventsRaiser(msg.sender).raiseTokenApprove(spender, allowance);
return true;
}
function allowance(address, address) external view returns (uint256) {
return 0;
}
/// @dev Retrieve the balance for `owner`.
function balanceOf(address owner)
external
view
returns (uint256)
{
return balances[owner];
}
}
/// @dev Mock the BancorNetwork contract
contract TestBancorNetwork is
IBancorNetwork
{
string private _nextRevertReason;
/// @dev Set the revert reason for `swapExactTokensForTokens`.
function setRevertReason(string calldata reason)
external
{
_nextRevertReason = reason;
}
function convertByPath(
address[] calldata _path,
uint256 _amount,
uint256 _minReturn,
address _beneficiary,
address _affiliateAccount,
uint256 _affiliateFee
) external payable returns (uint256)
{
_revertIfReasonExists();
TestEventsRaiser(msg.sender).raiseConvertByPathInput(
// tokens sold
_amount,
// tokens bought
_minReturn,
// output token
_path[_path.length - 1],
// recipient
_beneficiary,
// fee recipient
_affiliateAccount,
// fee amount
_affiliateFee
);
}
function _revertIfReasonExists()
private
view
{
if (bytes(_nextRevertReason).length != 0) {
revert(_nextRevertReason);
}
}
}
/// @dev BancorBridge overridden to mock tokens and BancorNetwork
contract TestBancorBridge is
BancorBridge,
TestEventsRaiser
{
// Token address to TestToken instance.
mapping (address => TestToken) private _testTokens;
// TestRouter instance.
TestBancorNetwork private _testNetwork;
constructor() public {
_testNetwork = new TestBancorNetwork();
}
function setNetworkRevertReason(string calldata revertReason)
external
{
_testNetwork.setRevertReason(revertReason);
}
/// @dev Sets the balance of this contract for an existing token.
function setTokenBalance(address tokenAddress, uint256 balance)
external
{
TestToken token = _testTokens[tokenAddress];
token.setBalance(address(this), balance);
}
/// @dev Create a new token
/// @param tokenAddress The token address. If zero, one will be created.
function createToken(
address tokenAddress
)
external
returns (TestToken token)
{
token = TestToken(tokenAddress);
if (tokenAddress == address(0)) {
token = new TestToken();
}
_testTokens[address(token)] = token;
return token;
}
function getNetworkAddress()
external
view
returns (address)
{
return address(_testNetwork);
}
}

View File

@@ -201,6 +201,33 @@ contract TestKyberBridge is
return _nextFillAmount;
}
function tradeWithHint(
address sellTokenAddress,
uint256 sellAmount,
address buyTokenAddress,
address payable recipientAddress,
uint256 maxBuyTokenAmount,
uint256 minConversionRate,
address payable walletId,
bytes calldata hint
)
external
payable
returns (uint256 boughtAmount)
{
emit KyberBridgeTrade(
msg.value,
sellTokenAddress,
sellAmount,
buyTokenAddress,
recipientAddress,
maxBuyTokenAmount,
minConversionRate,
walletId
);
return _nextFillAmount;
}
function createToken(uint8 decimals)
external
returns (address tokenAddress)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-asset-proxy",
"version": "3.4.0",
"version": "3.6.1",
"engines": {
"node": ">=6.12"
},
@@ -38,31 +38,31 @@
"docs:json": "typedoc --excludePrivate --excludeExternals --excludeProtected --ignoreCompilerErrors --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES"
},
"config": {
"abis": "./test/generated-artifacts/@(BalancerBridge|ChaiBridge|CurveBridge|DexForwarderBridge|DydxBridge|ERC1155Proxy|ERC20BridgeProxy|ERC20Proxy|ERC721Proxy|Eth2DaiBridge|IAssetData|IAssetProxy|IAssetProxyDispatcher|IAuthorizable|IBalancerPool|IChai|ICurve|IDydx|IDydxBridge|IERC20Bridge|IEth2Dai|IGasToken|IKyberNetworkProxy|IUniswapExchange|IUniswapExchangeFactory|IUniswapV2Router01|KyberBridge|MixinAssetProxyDispatcher|MixinAuthorizable|MixinGasToken|MultiAssetProxy|Ownable|StaticCallProxy|TestChaiBridge|TestDexForwarderBridge|TestDydxBridge|TestERC20Bridge|TestEth2DaiBridge|TestKyberBridge|TestStaticCallTarget|TestUniswapBridge|TestUniswapV2Bridge|UniswapBridge|UniswapV2Bridge).json",
"abis": "./test/generated-artifacts/@(BalancerBridge|BancorBridge|ChaiBridge|CreamBridge|CurveBridge|DODOBridge|DexForwarderBridge|DydxBridge|ERC1155Proxy|ERC20BridgeProxy|ERC20Proxy|ERC721Proxy|Eth2DaiBridge|IAssetData|IAssetProxy|IAssetProxyDispatcher|IAuthorizable|IBalancerPool|IBancorNetwork|IChai|ICurve|IDydx|IDydxBridge|IERC20Bridge|IEth2Dai|IGasToken|IKyberNetworkProxy|IMStable|IMooniswap|IShell|IUniswapExchange|IUniswapExchangeFactory|IUniswapV2Router01|KyberBridge|MStableBridge|MixinAssetProxyDispatcher|MixinAuthorizable|MixinGasToken|MooniswapBridge|MultiAssetProxy|Ownable|ShellBridge|SnowSwapBridge|StaticCallProxy|SushiSwapBridge|SwerveBridge|TestBancorBridge|TestChaiBridge|TestDexForwarderBridge|TestDydxBridge|TestERC20Bridge|TestEth2DaiBridge|TestKyberBridge|TestStaticCallTarget|TestUniswapBridge|TestUniswapV2Bridge|UniswapBridge|UniswapV2Bridge).json",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
"url": "https://github.com/0xProject/protocol.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
"url": "https://github.com/0xProject/protocol/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md",
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
"devDependencies": {
"@0x/abi-gen": "^5.3.1",
"@0x/contract-wrappers": "^13.8.0",
"@0x/contracts-gen": "^2.0.10",
"@0x/contracts-test-utils": "^5.3.4",
"@0x/contracts-utils": "^4.5.1",
"@0x/dev-utils": "^3.3.0",
"@0x/sol-compiler": "^4.1.1",
"@0x/ts-doc-gen": "^0.0.22",
"@0x/tslint-config": "^4.1.0",
"@0x/abi-gen": "^5.4.3",
"@0x/contract-wrappers": "^13.9.2",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "*",
"@types/node": "12.12.54",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
@@ -75,21 +75,21 @@
"solhint": "^1.4.1",
"truffle": "^5.0.32",
"tslint": "5.11.0",
"typedoc": "^0.15.0",
"typedoc": "~0.16.11",
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.3",
"@0x/contracts-erc1155": "^2.1.7",
"@0x/contracts-erc20": "^3.2.1",
"@0x/contracts-erc721": "^3.1.7",
"@0x/contracts-exchange-libs": "^4.3.7",
"@0x/order-utils": "^10.3.0",
"@0x/types": "^3.2.0",
"@0x/typescript-typings": "^5.1.1",
"@0x/utils": "^5.5.1",
"@0x/web3-wrapper": "^7.2.0",
"ethereum-types": "^3.2.0",
"@0x/base-contract": "^6.2.7",
"@0x/contracts-erc1155": "^2.1.10",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-erc721": "^3.1.10",
"@0x/contracts-exchange-libs": "^4.3.10",
"@0x/order-utils": "^10.4.2",
"@0x/types": "^3.2.4",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"@0x/web3-wrapper": "^7.2.4",
"ethereum-types": "^3.3.3",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -6,9 +6,12 @@
import { ContractArtifact } from 'ethereum-types';
import * as BalancerBridge from '../generated-artifacts/BalancerBridge.json';
import * as BancorBridge from '../generated-artifacts/BancorBridge.json';
import * as ChaiBridge from '../generated-artifacts/ChaiBridge.json';
import * as CreamBridge from '../generated-artifacts/CreamBridge.json';
import * as CurveBridge from '../generated-artifacts/CurveBridge.json';
import * as DexForwarderBridge from '../generated-artifacts/DexForwarderBridge.json';
import * as DODOBridge from '../generated-artifacts/DODOBridge.json';
import * as DydxBridge from '../generated-artifacts/DydxBridge.json';
import * as ERC1155Proxy from '../generated-artifacts/ERC1155Proxy.json';
import * as ERC20BridgeProxy from '../generated-artifacts/ERC20BridgeProxy.json';
@@ -20,6 +23,7 @@ import * as IAssetProxy from '../generated-artifacts/IAssetProxy.json';
import * as IAssetProxyDispatcher from '../generated-artifacts/IAssetProxyDispatcher.json';
import * as IAuthorizable from '../generated-artifacts/IAuthorizable.json';
import * as IBalancerPool from '../generated-artifacts/IBalancerPool.json';
import * as IBancorNetwork from '../generated-artifacts/IBancorNetwork.json';
import * as IChai from '../generated-artifacts/IChai.json';
import * as ICurve from '../generated-artifacts/ICurve.json';
import * as IDydx from '../generated-artifacts/IDydx.json';
@@ -28,6 +32,9 @@ import * as IERC20Bridge from '../generated-artifacts/IERC20Bridge.json';
import * as IEth2Dai from '../generated-artifacts/IEth2Dai.json';
import * as IGasToken from '../generated-artifacts/IGasToken.json';
import * as IKyberNetworkProxy from '../generated-artifacts/IKyberNetworkProxy.json';
import * as IMooniswap from '../generated-artifacts/IMooniswap.json';
import * as IMStable from '../generated-artifacts/IMStable.json';
import * as IShell from '../generated-artifacts/IShell.json';
import * as IUniswapExchange from '../generated-artifacts/IUniswapExchange.json';
import * as IUniswapExchangeFactory from '../generated-artifacts/IUniswapExchangeFactory.json';
import * as IUniswapV2Router01 from '../generated-artifacts/IUniswapV2Router01.json';
@@ -35,9 +42,16 @@ import * as KyberBridge from '../generated-artifacts/KyberBridge.json';
import * as MixinAssetProxyDispatcher from '../generated-artifacts/MixinAssetProxyDispatcher.json';
import * as MixinAuthorizable from '../generated-artifacts/MixinAuthorizable.json';
import * as MixinGasToken from '../generated-artifacts/MixinGasToken.json';
import * as MooniswapBridge from '../generated-artifacts/MooniswapBridge.json';
import * as MStableBridge from '../generated-artifacts/MStableBridge.json';
import * as MultiAssetProxy from '../generated-artifacts/MultiAssetProxy.json';
import * as Ownable from '../generated-artifacts/Ownable.json';
import * as ShellBridge from '../generated-artifacts/ShellBridge.json';
import * as SnowSwapBridge from '../generated-artifacts/SnowSwapBridge.json';
import * as StaticCallProxy from '../generated-artifacts/StaticCallProxy.json';
import * as SushiSwapBridge from '../generated-artifacts/SushiSwapBridge.json';
import * as SwerveBridge from '../generated-artifacts/SwerveBridge.json';
import * as TestBancorBridge from '../generated-artifacts/TestBancorBridge.json';
import * as TestChaiBridge from '../generated-artifacts/TestChaiBridge.json';
import * as TestDexForwarderBridge from '../generated-artifacts/TestDexForwarderBridge.json';
import * as TestDydxBridge from '../generated-artifacts/TestDydxBridge.json';
@@ -60,13 +74,22 @@ export const artifacts = {
MultiAssetProxy: MultiAssetProxy as ContractArtifact,
StaticCallProxy: StaticCallProxy as ContractArtifact,
BalancerBridge: BalancerBridge as ContractArtifact,
BancorBridge: BancorBridge as ContractArtifact,
ChaiBridge: ChaiBridge as ContractArtifact,
CreamBridge: CreamBridge as ContractArtifact,
CurveBridge: CurveBridge as ContractArtifact,
DODOBridge: DODOBridge as ContractArtifact,
DexForwarderBridge: DexForwarderBridge as ContractArtifact,
DydxBridge: DydxBridge as ContractArtifact,
Eth2DaiBridge: Eth2DaiBridge as ContractArtifact,
KyberBridge: KyberBridge as ContractArtifact,
MStableBridge: MStableBridge as ContractArtifact,
MixinGasToken: MixinGasToken as ContractArtifact,
MooniswapBridge: MooniswapBridge as ContractArtifact,
ShellBridge: ShellBridge as ContractArtifact,
SnowSwapBridge: SnowSwapBridge as ContractArtifact,
SushiSwapBridge: SushiSwapBridge as ContractArtifact,
SwerveBridge: SwerveBridge as ContractArtifact,
UniswapBridge: UniswapBridge as ContractArtifact,
UniswapV2Bridge: UniswapV2Bridge as ContractArtifact,
IAssetData: IAssetData as ContractArtifact,
@@ -74,6 +97,7 @@ export const artifacts = {
IAssetProxyDispatcher: IAssetProxyDispatcher as ContractArtifact,
IAuthorizable: IAuthorizable as ContractArtifact,
IBalancerPool: IBalancerPool as ContractArtifact,
IBancorNetwork: IBancorNetwork as ContractArtifact,
IChai: IChai as ContractArtifact,
ICurve: ICurve as ContractArtifact,
IDydx: IDydx as ContractArtifact,
@@ -82,9 +106,13 @@ export const artifacts = {
IEth2Dai: IEth2Dai as ContractArtifact,
IGasToken: IGasToken as ContractArtifact,
IKyberNetworkProxy: IKyberNetworkProxy as ContractArtifact,
IMStable: IMStable as ContractArtifact,
IMooniswap: IMooniswap as ContractArtifact,
IShell: IShell as ContractArtifact,
IUniswapExchange: IUniswapExchange as ContractArtifact,
IUniswapExchangeFactory: IUniswapExchangeFactory as ContractArtifact,
IUniswapV2Router01: IUniswapV2Router01 as ContractArtifact,
TestBancorBridge: TestBancorBridge as ContractArtifact,
TestChaiBridge: TestChaiBridge as ContractArtifact,
TestDexForwarderBridge: TestDexForwarderBridge as ContractArtifact,
TestDydxBridge: TestDydxBridge as ContractArtifact,

View File

@@ -18,6 +18,7 @@ export {
TestDydxBridgeContract,
TestStaticCallTargetContract,
UniswapBridgeContract,
DexForwarderBridgeContract,
} from './wrappers';
export { ERC20Wrapper } from './erc20_wrapper';

View File

@@ -4,8 +4,11 @@
* -----------------------------------------------------------------------------
*/
export * from '../generated-wrappers/balancer_bridge';
export * from '../generated-wrappers/bancor_bridge';
export * from '../generated-wrappers/chai_bridge';
export * from '../generated-wrappers/cream_bridge';
export * from '../generated-wrappers/curve_bridge';
export * from '../generated-wrappers/d_o_d_o_bridge';
export * from '../generated-wrappers/dex_forwarder_bridge';
export * from '../generated-wrappers/dydx_bridge';
export * from '../generated-wrappers/erc1155_proxy';
@@ -18,6 +21,7 @@ export * from '../generated-wrappers/i_asset_proxy';
export * from '../generated-wrappers/i_asset_proxy_dispatcher';
export * from '../generated-wrappers/i_authorizable';
export * from '../generated-wrappers/i_balancer_pool';
export * from '../generated-wrappers/i_bancor_network';
export * from '../generated-wrappers/i_chai';
export * from '../generated-wrappers/i_curve';
export * from '../generated-wrappers/i_dydx';
@@ -26,16 +30,26 @@ export * from '../generated-wrappers/i_erc20_bridge';
export * from '../generated-wrappers/i_eth2_dai';
export * from '../generated-wrappers/i_gas_token';
export * from '../generated-wrappers/i_kyber_network_proxy';
export * from '../generated-wrappers/i_m_stable';
export * from '../generated-wrappers/i_mooniswap';
export * from '../generated-wrappers/i_shell';
export * from '../generated-wrappers/i_uniswap_exchange';
export * from '../generated-wrappers/i_uniswap_exchange_factory';
export * from '../generated-wrappers/i_uniswap_v2_router01';
export * from '../generated-wrappers/kyber_bridge';
export * from '../generated-wrappers/m_stable_bridge';
export * from '../generated-wrappers/mixin_asset_proxy_dispatcher';
export * from '../generated-wrappers/mixin_authorizable';
export * from '../generated-wrappers/mixin_gas_token';
export * from '../generated-wrappers/mooniswap_bridge';
export * from '../generated-wrappers/multi_asset_proxy';
export * from '../generated-wrappers/ownable';
export * from '../generated-wrappers/shell_bridge';
export * from '../generated-wrappers/snow_swap_bridge';
export * from '../generated-wrappers/static_call_proxy';
export * from '../generated-wrappers/sushi_swap_bridge';
export * from '../generated-wrappers/swerve_bridge';
export * from '../generated-wrappers/test_bancor_bridge';
export * from '../generated-wrappers/test_chai_bridge';
export * from '../generated-wrappers/test_dex_forwarder_bridge';
export * from '../generated-wrappers/test_dydx_bridge';

View File

@@ -6,9 +6,12 @@
import { ContractArtifact } from 'ethereum-types';
import * as BalancerBridge from '../test/generated-artifacts/BalancerBridge.json';
import * as BancorBridge from '../test/generated-artifacts/BancorBridge.json';
import * as ChaiBridge from '../test/generated-artifacts/ChaiBridge.json';
import * as CreamBridge from '../test/generated-artifacts/CreamBridge.json';
import * as CurveBridge from '../test/generated-artifacts/CurveBridge.json';
import * as DexForwarderBridge from '../test/generated-artifacts/DexForwarderBridge.json';
import * as DODOBridge from '../test/generated-artifacts/DODOBridge.json';
import * as DydxBridge from '../test/generated-artifacts/DydxBridge.json';
import * as ERC1155Proxy from '../test/generated-artifacts/ERC1155Proxy.json';
import * as ERC20BridgeProxy from '../test/generated-artifacts/ERC20BridgeProxy.json';
@@ -20,6 +23,7 @@ import * as IAssetProxy from '../test/generated-artifacts/IAssetProxy.json';
import * as IAssetProxyDispatcher from '../test/generated-artifacts/IAssetProxyDispatcher.json';
import * as IAuthorizable from '../test/generated-artifacts/IAuthorizable.json';
import * as IBalancerPool from '../test/generated-artifacts/IBalancerPool.json';
import * as IBancorNetwork from '../test/generated-artifacts/IBancorNetwork.json';
import * as IChai from '../test/generated-artifacts/IChai.json';
import * as ICurve from '../test/generated-artifacts/ICurve.json';
import * as IDydx from '../test/generated-artifacts/IDydx.json';
@@ -28,6 +32,9 @@ import * as IERC20Bridge from '../test/generated-artifacts/IERC20Bridge.json';
import * as IEth2Dai from '../test/generated-artifacts/IEth2Dai.json';
import * as IGasToken from '../test/generated-artifacts/IGasToken.json';
import * as IKyberNetworkProxy from '../test/generated-artifacts/IKyberNetworkProxy.json';
import * as IMooniswap from '../test/generated-artifacts/IMooniswap.json';
import * as IMStable from '../test/generated-artifacts/IMStable.json';
import * as IShell from '../test/generated-artifacts/IShell.json';
import * as IUniswapExchange from '../test/generated-artifacts/IUniswapExchange.json';
import * as IUniswapExchangeFactory from '../test/generated-artifacts/IUniswapExchangeFactory.json';
import * as IUniswapV2Router01 from '../test/generated-artifacts/IUniswapV2Router01.json';
@@ -35,9 +42,16 @@ import * as KyberBridge from '../test/generated-artifacts/KyberBridge.json';
import * as MixinAssetProxyDispatcher from '../test/generated-artifacts/MixinAssetProxyDispatcher.json';
import * as MixinAuthorizable from '../test/generated-artifacts/MixinAuthorizable.json';
import * as MixinGasToken from '../test/generated-artifacts/MixinGasToken.json';
import * as MooniswapBridge from '../test/generated-artifacts/MooniswapBridge.json';
import * as MStableBridge from '../test/generated-artifacts/MStableBridge.json';
import * as MultiAssetProxy from '../test/generated-artifacts/MultiAssetProxy.json';
import * as Ownable from '../test/generated-artifacts/Ownable.json';
import * as ShellBridge from '../test/generated-artifacts/ShellBridge.json';
import * as SnowSwapBridge from '../test/generated-artifacts/SnowSwapBridge.json';
import * as StaticCallProxy from '../test/generated-artifacts/StaticCallProxy.json';
import * as SushiSwapBridge from '../test/generated-artifacts/SushiSwapBridge.json';
import * as SwerveBridge from '../test/generated-artifacts/SwerveBridge.json';
import * as TestBancorBridge from '../test/generated-artifacts/TestBancorBridge.json';
import * as TestChaiBridge from '../test/generated-artifacts/TestChaiBridge.json';
import * as TestDexForwarderBridge from '../test/generated-artifacts/TestDexForwarderBridge.json';
import * as TestDydxBridge from '../test/generated-artifacts/TestDydxBridge.json';
@@ -60,13 +74,22 @@ export const artifacts = {
MultiAssetProxy: MultiAssetProxy as ContractArtifact,
StaticCallProxy: StaticCallProxy as ContractArtifact,
BalancerBridge: BalancerBridge as ContractArtifact,
BancorBridge: BancorBridge as ContractArtifact,
ChaiBridge: ChaiBridge as ContractArtifact,
CreamBridge: CreamBridge as ContractArtifact,
CurveBridge: CurveBridge as ContractArtifact,
DODOBridge: DODOBridge as ContractArtifact,
DexForwarderBridge: DexForwarderBridge as ContractArtifact,
DydxBridge: DydxBridge as ContractArtifact,
Eth2DaiBridge: Eth2DaiBridge as ContractArtifact,
KyberBridge: KyberBridge as ContractArtifact,
MStableBridge: MStableBridge as ContractArtifact,
MixinGasToken: MixinGasToken as ContractArtifact,
MooniswapBridge: MooniswapBridge as ContractArtifact,
ShellBridge: ShellBridge as ContractArtifact,
SnowSwapBridge: SnowSwapBridge as ContractArtifact,
SushiSwapBridge: SushiSwapBridge as ContractArtifact,
SwerveBridge: SwerveBridge as ContractArtifact,
UniswapBridge: UniswapBridge as ContractArtifact,
UniswapV2Bridge: UniswapV2Bridge as ContractArtifact,
IAssetData: IAssetData as ContractArtifact,
@@ -74,6 +97,7 @@ export const artifacts = {
IAssetProxyDispatcher: IAssetProxyDispatcher as ContractArtifact,
IAuthorizable: IAuthorizable as ContractArtifact,
IBalancerPool: IBalancerPool as ContractArtifact,
IBancorNetwork: IBancorNetwork as ContractArtifact,
IChai: IChai as ContractArtifact,
ICurve: ICurve as ContractArtifact,
IDydx: IDydx as ContractArtifact,
@@ -82,9 +106,13 @@ export const artifacts = {
IEth2Dai: IEth2Dai as ContractArtifact,
IGasToken: IGasToken as ContractArtifact,
IKyberNetworkProxy: IKyberNetworkProxy as ContractArtifact,
IMStable: IMStable as ContractArtifact,
IMooniswap: IMooniswap as ContractArtifact,
IShell: IShell as ContractArtifact,
IUniswapExchange: IUniswapExchange as ContractArtifact,
IUniswapExchangeFactory: IUniswapExchangeFactory as ContractArtifact,
IUniswapV2Router01: IUniswapV2Router01 as ContractArtifact,
TestBancorBridge: TestBancorBridge as ContractArtifact,
TestChaiBridge: TestChaiBridge as ContractArtifact,
TestDexForwarderBridge: TestDexForwarderBridge as ContractArtifact,
TestDydxBridge: TestDydxBridge as ContractArtifact,

View File

@@ -0,0 +1,205 @@
import {
blockchainTests,
constants,
expect,
filterLogsToArguments,
getRandomInteger,
randomAddress,
} from '@0x/contracts-test-utils';
import { AssetProxyId } from '@0x/types';
import { AbiEncoder, BigNumber, hexUtils } from '@0x/utils';
import { DecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
import { artifacts } from './artifacts';
import { TestBancorBridgeContract } from './generated-wrappers/test_bancor_bridge';
import {
TestBancorBridgeConvertByPathInputEventArgs as ConvertByPathArgs,
TestBancorBridgeEvents as ContractEvents,
TestBancorBridgeTokenApproveEventArgs as TokenApproveArgs,
TestBancorBridgeTokenTransferEventArgs as TokenTransferArgs,
} from './wrappers';
blockchainTests.resets('Bancor unit tests', env => {
const FROM_TOKEN_DECIMALS = 6;
const TO_TOKEN_DECIMALS = 18;
const FROM_TOKEN_BASE = new BigNumber(10).pow(FROM_TOKEN_DECIMALS);
const TO_TOKEN_BASE = new BigNumber(10).pow(TO_TOKEN_DECIMALS);
let testContract: TestBancorBridgeContract;
before(async () => {
testContract = await TestBancorBridgeContract.deployFrom0xArtifactAsync(
artifacts.TestBancorBridge,
env.provider,
env.txDefaults,
artifacts,
);
});
describe('isValidSignature()', () => {
it('returns success bytes', async () => {
const LEGACY_WALLET_MAGIC_VALUE = '0xb0671381';
const result = await testContract
.isValidSignature(hexUtils.random(), hexUtils.random(_.random(0, 32)))
.callAsync();
expect(result).to.eq(LEGACY_WALLET_MAGIC_VALUE);
});
});
describe('bridgeTransferFrom()', () => {
interface TransferFromOpts {
tokenAddressesPath: string[];
toAddress: string;
// Amount to pass into `bridgeTransferFrom()`
amount: BigNumber;
// Token balance of the bridge.
fromTokenBalance: BigNumber;
// Router reverts with this reason
routerRevertReason: string;
}
interface TransferFromResult {
opts: TransferFromOpts;
result: string;
logs: DecodedLogs;
blocktime: number;
}
function createTransferFromOpts(opts?: Partial<TransferFromOpts>): TransferFromOpts {
const amount = getRandomInteger(1, TO_TOKEN_BASE.times(100));
return {
tokenAddressesPath: Array(3).fill(constants.NULL_ADDRESS),
amount,
toAddress: randomAddress(),
fromTokenBalance: getRandomInteger(1, FROM_TOKEN_BASE.times(100)),
routerRevertReason: '',
...opts,
};
}
const bridgeDataEncoder = AbiEncoder.create('(address[], address)');
async function transferFromAsync(opts?: Partial<TransferFromOpts>): Promise<TransferFromResult> {
const _opts = createTransferFromOpts(opts);
for (let i = 0; i < _opts.tokenAddressesPath.length; i++) {
const createFromTokenFn = testContract.createToken(_opts.tokenAddressesPath[i]);
_opts.tokenAddressesPath[i] = await createFromTokenFn.callAsync();
await createFromTokenFn.awaitTransactionSuccessAsync();
}
// Set the token balance for the token we're converting from.
await testContract
.setTokenBalance(_opts.tokenAddressesPath[0], _opts.fromTokenBalance)
.awaitTransactionSuccessAsync();
// Set revert reason for the router.
await testContract.setNetworkRevertReason(_opts.routerRevertReason).awaitTransactionSuccessAsync();
// Call bridgeTransferFrom().
const bridgeTransferFromFn = testContract.bridgeTransferFrom(
// Output token
_opts.tokenAddressesPath[_opts.tokenAddressesPath.length - 1],
// Random maker address.
randomAddress(),
// Recipient address.
_opts.toAddress,
// Transfer amount.
_opts.amount,
// ABI-encode the input token address as the bridge data.
bridgeDataEncoder.encode([
_opts.tokenAddressesPath,
await testContract.getNetworkAddress().callAsync(),
]),
);
const result = await bridgeTransferFromFn.callAsync();
const receipt = await bridgeTransferFromFn.awaitTransactionSuccessAsync();
return {
opts: _opts,
result,
logs: (receipt.logs as any) as DecodedLogs,
blocktime: await env.web3Wrapper.getBlockTimestampAsync(receipt.blockNumber),
};
}
it('returns magic bytes on success', async () => {
const { result } = await transferFromAsync();
expect(result).to.eq(AssetProxyId.ERC20Bridge);
});
it('performs transfer when both tokens are the same', async () => {
const createTokenFn = testContract.createToken(constants.NULL_ADDRESS);
const tokenAddress = await createTokenFn.callAsync();
await createTokenFn.awaitTransactionSuccessAsync();
const { opts, result, logs } = await transferFromAsync({
tokenAddressesPath: [tokenAddress, tokenAddress],
});
expect(result).to.eq(AssetProxyId.ERC20Bridge, 'asset proxy id');
const transfers = filterLogsToArguments<TokenTransferArgs>(logs, ContractEvents.TokenTransfer);
expect(transfers.length).to.eq(1);
expect(transfers[0].token).to.eq(tokenAddress, 'input token address');
expect(transfers[0].from).to.eq(testContract.address);
expect(transfers[0].to).to.eq(opts.toAddress, 'recipient address');
expect(transfers[0].amount).to.bignumber.eq(opts.amount, 'amount');
});
describe('token -> token', async () => {
it('calls BancorNetwork.convertByPath()', async () => {
const { opts, result, logs } = await transferFromAsync();
expect(result).to.eq(AssetProxyId.ERC20Bridge, 'asset proxy id');
const transfers = filterLogsToArguments<ConvertByPathArgs>(logs, ContractEvents.ConvertByPathInput);
expect(transfers.length).to.eq(1);
expect(transfers[0].toTokenAddress).to.eq(
opts.tokenAddressesPath[opts.tokenAddressesPath.length - 1],
'output token address',
);
expect(transfers[0].to).to.eq(opts.toAddress, 'recipient address');
expect(transfers[0].amountIn).to.bignumber.eq(opts.fromTokenBalance, 'input token amount');
expect(transfers[0].amountOutMin).to.bignumber.eq(opts.amount, 'output token amount');
expect(transfers[0].feeRecipient).to.eq(constants.NULL_ADDRESS);
expect(transfers[0].feeAmount).to.bignumber.eq(new BigNumber(0));
});
it('sets allowance for "from" token', async () => {
const { logs } = await transferFromAsync();
const approvals = filterLogsToArguments<TokenApproveArgs>(logs, ContractEvents.TokenApprove);
const networkAddress = await testContract.getNetworkAddress().callAsync();
expect(approvals.length).to.eq(1);
expect(approvals[0].spender).to.eq(networkAddress);
expect(approvals[0].allowance).to.bignumber.eq(constants.MAX_UINT256);
});
it('fails if the router fails', async () => {
const revertReason = 'FOOBAR';
const tx = transferFromAsync({
routerRevertReason: revertReason,
});
return expect(tx).to.eventually.be.rejectedWith(revertReason);
});
});
describe('token -> token -> token', async () => {
it('calls BancorNetwork.convertByPath()', async () => {
const { opts, result, logs } = await transferFromAsync({
tokenAddressesPath: Array(5).fill(constants.NULL_ADDRESS),
});
expect(result).to.eq(AssetProxyId.ERC20Bridge, 'asset proxy id');
const transfers = filterLogsToArguments<ConvertByPathArgs>(logs, ContractEvents.ConvertByPathInput);
expect(transfers.length).to.eq(1);
expect(transfers[0].toTokenAddress).to.eq(
opts.tokenAddressesPath[opts.tokenAddressesPath.length - 1],
'output token address',
);
expect(transfers[0].to).to.eq(opts.toAddress, 'recipient address');
expect(transfers[0].amountIn).to.bignumber.eq(opts.fromTokenBalance, 'input token amount');
expect(transfers[0].amountOutMin).to.bignumber.eq(opts.amount, 'output token amount');
expect(transfers[0].feeRecipient).to.eq(constants.NULL_ADDRESS);
expect(transfers[0].feeAmount).to.bignumber.eq(new BigNumber(0));
});
});
});
});

View File

@@ -16,7 +16,8 @@ import { artifacts } from './artifacts';
import { TestKyberBridgeContract, TestKyberBridgeEvents } from './wrappers';
blockchainTests.resets('KyberBridge unit tests', env => {
// TODO(dorothy-zbornak): Tests need to be updated.
blockchainTests.resets.skip('KyberBridge unit tests', env => {
const KYBER_ETH_ADDRESS = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee';
const FROM_TOKEN_DECIMALS = 6;
const TO_TOKEN_DECIMALS = 18;
@@ -115,7 +116,7 @@ blockchainTests.resets('KyberBridge unit tests', env => {
// Transfer amount.
_opts.amount,
// ABI-encode the input token address as the bridge data.
hexUtils.leftPad(_opts.fromTokenAddress),
hexUtils.concat(hexUtils.leftPad(_opts.fromTokenAddress), hexUtils.leftPad(32), hexUtils.leftPad(0)),
);
const result = await bridgeTransferFromFn.callAsync();
const { logs } = await bridgeTransferFromFn.awaitTransactionSuccessAsync();

View File

@@ -4,8 +4,11 @@
* -----------------------------------------------------------------------------
*/
export * from '../test/generated-wrappers/balancer_bridge';
export * from '../test/generated-wrappers/bancor_bridge';
export * from '../test/generated-wrappers/chai_bridge';
export * from '../test/generated-wrappers/cream_bridge';
export * from '../test/generated-wrappers/curve_bridge';
export * from '../test/generated-wrappers/d_o_d_o_bridge';
export * from '../test/generated-wrappers/dex_forwarder_bridge';
export * from '../test/generated-wrappers/dydx_bridge';
export * from '../test/generated-wrappers/erc1155_proxy';
@@ -18,6 +21,7 @@ export * from '../test/generated-wrappers/i_asset_proxy';
export * from '../test/generated-wrappers/i_asset_proxy_dispatcher';
export * from '../test/generated-wrappers/i_authorizable';
export * from '../test/generated-wrappers/i_balancer_pool';
export * from '../test/generated-wrappers/i_bancor_network';
export * from '../test/generated-wrappers/i_chai';
export * from '../test/generated-wrappers/i_curve';
export * from '../test/generated-wrappers/i_dydx';
@@ -26,16 +30,26 @@ export * from '../test/generated-wrappers/i_erc20_bridge';
export * from '../test/generated-wrappers/i_eth2_dai';
export * from '../test/generated-wrappers/i_gas_token';
export * from '../test/generated-wrappers/i_kyber_network_proxy';
export * from '../test/generated-wrappers/i_m_stable';
export * from '../test/generated-wrappers/i_mooniswap';
export * from '../test/generated-wrappers/i_shell';
export * from '../test/generated-wrappers/i_uniswap_exchange';
export * from '../test/generated-wrappers/i_uniswap_exchange_factory';
export * from '../test/generated-wrappers/i_uniswap_v2_router01';
export * from '../test/generated-wrappers/kyber_bridge';
export * from '../test/generated-wrappers/m_stable_bridge';
export * from '../test/generated-wrappers/mixin_asset_proxy_dispatcher';
export * from '../test/generated-wrappers/mixin_authorizable';
export * from '../test/generated-wrappers/mixin_gas_token';
export * from '../test/generated-wrappers/mooniswap_bridge';
export * from '../test/generated-wrappers/multi_asset_proxy';
export * from '../test/generated-wrappers/ownable';
export * from '../test/generated-wrappers/shell_bridge';
export * from '../test/generated-wrappers/snow_swap_bridge';
export * from '../test/generated-wrappers/static_call_proxy';
export * from '../test/generated-wrappers/sushi_swap_bridge';
export * from '../test/generated-wrappers/swerve_bridge';
export * from '../test/generated-wrappers/test_bancor_bridge';
export * from '../test/generated-wrappers/test_chai_bridge';
export * from '../test/generated-wrappers/test_dex_forwarder_bridge';
export * from '../test/generated-wrappers/test_dydx_bridge';

View File

@@ -4,8 +4,11 @@
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
"files": [
"generated-artifacts/BalancerBridge.json",
"generated-artifacts/BancorBridge.json",
"generated-artifacts/ChaiBridge.json",
"generated-artifacts/CreamBridge.json",
"generated-artifacts/CurveBridge.json",
"generated-artifacts/DODOBridge.json",
"generated-artifacts/DexForwarderBridge.json",
"generated-artifacts/DydxBridge.json",
"generated-artifacts/ERC1155Proxy.json",
@@ -18,6 +21,7 @@
"generated-artifacts/IAssetProxyDispatcher.json",
"generated-artifacts/IAuthorizable.json",
"generated-artifacts/IBalancerPool.json",
"generated-artifacts/IBancorNetwork.json",
"generated-artifacts/IChai.json",
"generated-artifacts/ICurve.json",
"generated-artifacts/IDydx.json",
@@ -26,16 +30,26 @@
"generated-artifacts/IEth2Dai.json",
"generated-artifacts/IGasToken.json",
"generated-artifacts/IKyberNetworkProxy.json",
"generated-artifacts/IMStable.json",
"generated-artifacts/IMooniswap.json",
"generated-artifacts/IShell.json",
"generated-artifacts/IUniswapExchange.json",
"generated-artifacts/IUniswapExchangeFactory.json",
"generated-artifacts/IUniswapV2Router01.json",
"generated-artifacts/KyberBridge.json",
"generated-artifacts/MStableBridge.json",
"generated-artifacts/MixinAssetProxyDispatcher.json",
"generated-artifacts/MixinAuthorizable.json",
"generated-artifacts/MixinGasToken.json",
"generated-artifacts/MooniswapBridge.json",
"generated-artifacts/MultiAssetProxy.json",
"generated-artifacts/Ownable.json",
"generated-artifacts/ShellBridge.json",
"generated-artifacts/SnowSwapBridge.json",
"generated-artifacts/StaticCallProxy.json",
"generated-artifacts/SushiSwapBridge.json",
"generated-artifacts/SwerveBridge.json",
"generated-artifacts/TestBancorBridge.json",
"generated-artifacts/TestChaiBridge.json",
"generated-artifacts/TestDexForwarderBridge.json",
"generated-artifacts/TestDydxBridge.json",
@@ -48,8 +62,11 @@
"generated-artifacts/UniswapBridge.json",
"generated-artifacts/UniswapV2Bridge.json",
"test/generated-artifacts/BalancerBridge.json",
"test/generated-artifacts/BancorBridge.json",
"test/generated-artifacts/ChaiBridge.json",
"test/generated-artifacts/CreamBridge.json",
"test/generated-artifacts/CurveBridge.json",
"test/generated-artifacts/DODOBridge.json",
"test/generated-artifacts/DexForwarderBridge.json",
"test/generated-artifacts/DydxBridge.json",
"test/generated-artifacts/ERC1155Proxy.json",
@@ -62,6 +79,7 @@
"test/generated-artifacts/IAssetProxyDispatcher.json",
"test/generated-artifacts/IAuthorizable.json",
"test/generated-artifacts/IBalancerPool.json",
"test/generated-artifacts/IBancorNetwork.json",
"test/generated-artifacts/IChai.json",
"test/generated-artifacts/ICurve.json",
"test/generated-artifacts/IDydx.json",
@@ -70,16 +88,26 @@
"test/generated-artifacts/IEth2Dai.json",
"test/generated-artifacts/IGasToken.json",
"test/generated-artifacts/IKyberNetworkProxy.json",
"test/generated-artifacts/IMStable.json",
"test/generated-artifacts/IMooniswap.json",
"test/generated-artifacts/IShell.json",
"test/generated-artifacts/IUniswapExchange.json",
"test/generated-artifacts/IUniswapExchangeFactory.json",
"test/generated-artifacts/IUniswapV2Router01.json",
"test/generated-artifacts/KyberBridge.json",
"test/generated-artifacts/MStableBridge.json",
"test/generated-artifacts/MixinAssetProxyDispatcher.json",
"test/generated-artifacts/MixinAuthorizable.json",
"test/generated-artifacts/MixinGasToken.json",
"test/generated-artifacts/MooniswapBridge.json",
"test/generated-artifacts/MultiAssetProxy.json",
"test/generated-artifacts/Ownable.json",
"test/generated-artifacts/ShellBridge.json",
"test/generated-artifacts/SnowSwapBridge.json",
"test/generated-artifacts/StaticCallProxy.json",
"test/generated-artifacts/SushiSwapBridge.json",
"test/generated-artifacts/SwerveBridge.json",
"test/generated-artifacts/TestBancorBridge.json",
"test/generated-artifacts/TestChaiBridge.json",
"test/generated-artifacts/TestDexForwarderBridge.json",
"test/generated-artifacts/TestDydxBridge.json",

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1603851023,
"version": "1.1.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "1.1.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "1.1.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1594788383,
"version": "1.1.6",

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.1.9 - _October 28, 2020_
* Dependencies updated
## v1.1.8 - _October 27, 2020_
* Dependencies updated
## v1.1.7 - _October 21, 2020_
* Dependencies updated
## v1.1.6 - _July 15, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-broker",
"version": "1.1.6",
"version": "1.1.9",
"engines": {
"node": ">=6.12"
},
@@ -43,31 +43,31 @@
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
"url": "https://github.com/0xProject/protocol.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
"url": "https://github.com/0xProject/protocol/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.3.1",
"@0x/contracts-asset-proxy": "^3.4.0",
"@0x/contracts-erc20": "^3.2.1",
"@0x/contracts-erc721": "^3.1.7",
"@0x/contracts-exchange": "^3.2.7",
"@0x/contracts-exchange-libs": "^4.3.7",
"@0x/contracts-gen": "^2.0.10",
"@0x/contracts-test-utils": "^5.3.4",
"@0x/contracts-utils": "^4.5.1",
"@0x/sol-compiler": "^4.1.1",
"@0x/ts-doc-gen": "^0.0.22",
"@0x/tslint-config": "^4.1.0",
"@0x/types": "^3.2.0",
"@0x/web3-wrapper": "^7.2.0",
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-erc721": "^3.1.10",
"@0x/contracts-exchange": "^3.2.10",
"@0x/contracts-exchange-libs": "^4.3.10",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/web3-wrapper": "^7.2.4",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "*",
"@types/node": "12.12.54",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
@@ -80,15 +80,15 @@
"solhint": "^1.4.1",
"truffle": "^5.0.32",
"tslint": "5.11.0",
"typedoc": "^0.15.0",
"typedoc": "~0.16.11",
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.3",
"@0x/order-utils": "^10.3.0",
"@0x/typescript-typings": "^5.1.1",
"@0x/utils": "^5.5.1",
"ethereum-types": "^3.2.0"
"@0x/base-contract": "^6.2.7",
"@0x/order-utils": "^10.4.2",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"ethereum-types": "^3.3.3"
},
"publishConfig": {
"access": "public"

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1603851023,
"version": "3.1.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "3.1.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "3.1.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1594788383,
"version": "3.1.7",

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.1.10 - _October 28, 2020_
* Dependencies updated
## v3.1.9 - _October 27, 2020_
* Dependencies updated
## v3.1.8 - _October 21, 2020_
* Dependencies updated
## v3.1.7 - _July 15, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-coordinator",
"version": "3.1.7",
"version": "3.1.10",
"engines": {
"node": ">=6.12"
},
@@ -44,30 +44,28 @@
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
"url": "https://github.com/0xProject/protocol.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
"url": "https://github.com/0xProject/protocol/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.3.1",
"@0x/contracts-asset-proxy": "^3.4.0",
"@0x/contracts-dev-utils": "^1.3.5",
"@0x/contracts-erc20": "^3.2.1",
"@0x/contracts-exchange": "^3.2.7",
"@0x/contracts-gen": "^2.0.10",
"@0x/contracts-test-utils": "^5.3.4",
"@0x/dev-utils": "^3.3.0",
"@0x/order-utils": "^10.3.0",
"@0x/sol-compiler": "^4.1.1",
"@0x/ts-doc-gen": "^0.0.22",
"@0x/tslint-config": "^4.1.0",
"@0x/web3-wrapper": "^7.2.0",
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-dev-utils": "^1.3.8",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-gen": "2.0.13",
"@0x/dev-utils": "^3.3.4",
"@0x/order-utils": "^10.4.2",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/web3-wrapper": "^7.2.4",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "*",
"@types/node": "12.12.54",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
@@ -80,19 +78,21 @@
"solhint": "^1.4.1",
"truffle": "^5.0.32",
"tslint": "5.11.0",
"typedoc": "^0.15.0",
"typedoc": "~0.16.11",
"typescript": "3.0.1"
},
"dependencies": {
"@0x/assert": "^3.0.9",
"@0x/base-contract": "^6.2.3",
"@0x/contract-addresses": "^4.11.0",
"@0x/contracts-utils": "^4.5.1",
"@0x/json-schemas": "^5.1.0",
"@0x/types": "^3.2.0",
"@0x/typescript-typings": "^5.1.1",
"@0x/utils": "^5.5.1",
"ethereum-types": "^3.2.0",
"@0x/assert": "^3.0.13",
"@0x/base-contract": "^6.2.7",
"@0x/contract-addresses": "^5.0.1",
"@0x/contracts-exchange": "^3.2.10",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/json-schemas": "^5.2.3",
"@0x/types": "^3.2.4",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"ethereum-types": "^3.3.3",
"http-status-codes": "^1.3.2"
},
"publishConfig": {

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1603851023,
"version": "1.3.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "1.3.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "1.3.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1594788383,
"version": "1.3.5",

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.3.8 - _October 28, 2020_
* Dependencies updated
## v1.3.7 - _October 27, 2020_
* Dependencies updated
## v1.3.6 - _October 21, 2020_
* Dependencies updated
## v1.3.5 - _July 15, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-dev-utils",
"version": "1.3.5",
"version": "1.3.8",
"engines": {
"node": ">=6.12"
},
@@ -33,38 +33,38 @@
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
"url": "https://github.com/0xProject/protocol.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
"url": "https://github.com/0xProject/protocol/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/dev-utils/README.md",
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/dev-utils",
"devDependencies": {
"@0x/abi-gen": "^5.3.1",
"@0x/assert": "^3.0.9",
"@0x/contracts-asset-proxy": "^3.4.0",
"@0x/contracts-erc20": "^3.2.1",
"@0x/contracts-gen": "^2.0.10",
"@0x/contracts-test-utils": "^5.3.4",
"@0x/sol-compiler": "^4.1.1",
"@0x/ts-doc-gen": "^0.0.22",
"@0x/tslint-config": "^4.1.0",
"@0x/types": "^3.2.0",
"@0x/utils": "^5.5.1",
"@types/node": "*",
"ethereum-types": "^3.2.0",
"@0x/abi-gen": "^5.4.3",
"@0x/assert": "^3.0.13",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/utils": "^5.6.3",
"ethereum-types": "^3.3.3",
"ethers": "~4.0.4",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solhint": "^1.4.1",
"truffle": "^5.0.32",
"tslint": "5.11.0",
"typedoc": "^0.15.0",
"typedoc": "~0.16.11",
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.3"
"@0x/base-contract": "^6.2.7",
"@types/node": "12.12.54"
},
"publishConfig": {
"access": "public"

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1603851023,
"version": "2.1.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "2.1.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "2.1.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1594788383,
"version": "2.1.7",

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.10 - _October 28, 2020_
* Dependencies updated
## v2.1.9 - _October 27, 2020_
* Dependencies updated
## v2.1.8 - _October 21, 2020_
* Dependencies updated
## v2.1.7 - _July 15, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc1155",
"version": "2.1.7",
"version": "2.1.10",
"engines": {
"node": ">=6.12"
},
@@ -44,31 +44,31 @@
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
"url": "https://github.com/0xProject/protocol.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
"url": "https://github.com/0xProject/protocol/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
"devDependencies": {
"@0x/abi-gen": "^5.3.1",
"@0x/contracts-gen": "^2.0.10",
"@0x/contracts-utils": "^4.5.1",
"@0x/dev-utils": "^3.3.0",
"@0x/sol-compiler": "^4.1.1",
"@0x/ts-doc-gen": "^0.0.22",
"@0x/tslint-config": "^4.1.0",
"@0x/types": "^3.2.0",
"@0x/typescript-typings": "^5.1.1",
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/typescript-typings": "^5.1.5",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "*",
"@types/node": "12.12.54",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"ethereum-types": "^3.2.0",
"ethereum-types": "^3.3.3",
"make-promises-safe": "^1.1.0",
"mocha": "^6.2.0",
"npm-run-all": "^4.1.2",
@@ -76,14 +76,14 @@
"solhint": "^1.4.1",
"truffle": "^5.0.32",
"tslint": "5.11.0",
"typedoc": "^0.15.0",
"typedoc": "~0.16.11",
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.3",
"@0x/contracts-test-utils": "^5.3.4",
"@0x/utils": "^5.5.1",
"@0x/web3-wrapper": "^7.2.0",
"@0x/base-contract": "^6.2.7",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/utils": "^5.6.3",
"@0x/web3-wrapper": "^7.2.4",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,10 +0,0 @@
# Blacklist all files
.*
*
# Whitelist lib
!lib/**/*
# Whitelist Solidity contracts
!contracts/src/**/*
# Blacklist tests in lib
/lib/test/*
# Package specific ignore

View File

@@ -1,201 +0,0 @@
[
{
"version": "1.7.0",
"changes": [
{
"note": "Pass in `DevUtils` address to required functions",
"pr": 2629
},
{
"note": "Use new Kyber Katalyst functions",
"pr": 2629
}
],
"timestamp": 1594788383
},
{
"version": "1.6.0",
"changes": [
{
"note": "Pass in `DevUtils` address as a constructor parameter",
"pr": 2531
},
{
"note": "Sample `Curve` for buy amounts",
"pr": 2551
},
{
"note": "Added `sampleBuysFromKyberNetwork`",
"pr": 2551
},
{
"note": "Use `searchBestRate` in Kyber samples. Return 0 when Uniswap/Eth2Dai reserve",
"pr": 2575
},
{
"note": "Add UniswapV2",
"pr": 2595
},
{
"note": "Sample from MultiBridge",
"pr": 2593
}
],
"timestamp": 1592969527
},
{
"timestamp": 1583220306,
"version": "1.5.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.5.0",
"changes": [
{
"note": "Add generic liquidity provider sampling",
"pr": 2487
},
{
"note": "Use liquidity provider registry in sampler",
"pr": 2499
}
],
"timestamp": 1582837861
},
{
"timestamp": 1582677073,
"version": "1.4.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1582623685,
"version": "1.4.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.4.0",
"changes": [
{
"note": "Added Curve contract sampling",
"pr": 2483
}
],
"timestamp": 1581748629
},
{
"version": "1.3.0",
"changes": [
{
"note": "Catch reverts to `DevUtils` calls",
"pr": 2476
},
{
"note": "Remove wrapper functions and introduce `batchCall()`",
"pr": 2477
}
],
"timestamp": 1581204851
},
{
"timestamp": 1580988106,
"version": "1.2.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.2.0",
"changes": [
{
"note": "Make source IDs static on all networks, not inherited from `DeploymentConstants`.",
"pr": 2459
}
],
"timestamp": 1580811564
},
{
"version": "1.1.0",
"changes": [
{
"note": "Add batch functions to query quotes",
"pr": 2427
},
{
"note": "Early exit if a DEX sample fails",
"pr": 2427
}
],
"timestamp": 1579682890
},
{
"version": "1.0.3",
"changes": [
{
"note": "Add gas limits to external quote calls.",
"pr": 2405
}
],
"timestamp": 1578272714
},
{
"version": "1.0.2",
"changes": [
{
"note": "Do not query empty/unsigned orders. Swallow revets on DEX quotes.",
"pr": 2395
}
],
"timestamp": 1576540892
},
{
"timestamp": 1575931811,
"version": "1.0.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.0",
"changes": [
{
"note": "Created package.",
"pr": 2344
}
],
"timestamp": 1575296764
},
{
"version": "1.0.0-beta.2",
"changes": [
{
"note": "Dependencies updated"
}
],
"timestamp": 1575290197
},
{
"version": "1.0.0-beta.1",
"changes": [
{
"note": "Created package.",
"pr": 2344
}
]
}
]

View File

@@ -1,83 +0,0 @@
<!--
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
Edit the package's CHANGELOG.json file only.
-->
CHANGELOG
## v1.7.0 - _July 15, 2020_
* Pass in `DevUtils` address to required functions (#2629)
* Use new Kyber Katalyst functions (#2629)
## v1.6.0 - _June 24, 2020_
* Pass in `DevUtils` address as a constructor parameter (#2531)
* Sample `Curve` for buy amounts (#2551)
* Added `sampleBuysFromKyberNetwork` (#2551)
* Use `searchBestRate` in Kyber samples. Return 0 when Uniswap/Eth2Dai reserve (#2575)
* Add UniswapV2 (#2595)
* Sample from MultiBridge (#2593)
## v1.5.1 - _March 3, 2020_
* Dependencies updated
## v1.5.0 - _February 27, 2020_
* Add generic liquidity provider sampling (#2487)
* Use liquidity provider registry in sampler (#2499)
## v1.4.2 - _February 26, 2020_
* Dependencies updated
## v1.4.1 - _February 25, 2020_
* Dependencies updated
## v1.4.0 - _February 15, 2020_
* Added Curve contract sampling (#2483)
## v1.3.0 - _February 8, 2020_
* Catch reverts to `DevUtils` calls (#2476)
* Remove wrapper functions and introduce `batchCall()` (#2477)
## v1.2.1 - _February 6, 2020_
* Dependencies updated
## v1.2.0 - _February 4, 2020_
* Make source IDs static on all networks, not inherited from `DeploymentConstants`. (#2459)
## v1.1.0 - _January 22, 2020_
* Add batch functions to query quotes (#2427)
* Early exit if a DEX sample fails (#2427)
## v1.0.3 - _January 6, 2020_
* Add gas limits to external quote calls. (#2405)
## v1.0.2 - _December 17, 2019_
* Do not query empty/unsigned orders. Swallow revets on DEX quotes. (#2395)
## v1.0.1 - _December 9, 2019_
* Dependencies updated
## v1.0.0 - _December 2, 2019_
* Created package. (#2344)
## v1.0.0-beta.2 - _December 2, 2019_
* Dependencies updated
## v1.0.0-beta.1 - _Invalid date_
* Created package. (#2344)

View File

@@ -1 +0,0 @@
[]

View File

@@ -1,67 +0,0 @@
## ERC20BridgeSampler
This package contains contracts used in DEX aggregation.
This is an MVP implementation, which agnostically samples DEXes for off-chain sorting and order generation. It is entirely read-only and never not touches any funds.
## Installation
**Install**
```bash
npm install @0x/contracts-erc20-bridge-sampler --save
```
## Contributing
We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install Dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/contracts-erc20-bridge-sampler yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/contracts-erc20-bridge-sampler yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

View File

@@ -1,45 +0,0 @@
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
interface IDevUtils {
/// @dev Fetches all order-relevant information needed to validate if the supplied order is fillable.
/// @param order The order structure.
/// @param signature Signature provided by maker that proves the order's authenticity.
/// `0x01` can always be provided if the signature does not need to be validated.
/// @return The orderInfo (hash, status, and `takerAssetAmount` already filled for the given order),
/// fillableTakerAssetAmount (amount of the order's `takerAssetAmount` that is fillable given all on-chain state),
/// and isValidSignature (validity of the provided signature).
/// NOTE: If the `takerAssetData` encodes data for multiple assets, `fillableTakerAssetAmount` will represent a "scaled"
/// amount, meaning it must be multiplied by all the individual asset amounts within the `takerAssetData` to get the final
/// amount of each asset that can be filled.
function getOrderRelevantState(LibOrder.Order calldata order, bytes calldata signature)
external
view
returns (
LibOrder.OrderInfo memory orderInfo,
uint256 fillableTakerAssetAmount,
bool isValidSignature
);
}

View File

@@ -1,293 +0,0 @@
/*
Copyright 2019 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.9;
pragma experimental ABIEncoderV2;
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
interface IERC20BridgeSampler {
struct FakeBuyOptions {
uint256 targetSlippageBps;
uint256 maxIterations;
}
/// @dev Call multiple public functions on this contract in a single transaction.
/// @param callDatas ABI-encoded call data for each function call.
/// @return callResults ABI-encoded results data for each call.
function batchCall(bytes[] calldata callDatas)
external
view
returns (bytes[] memory callResults);
/// @dev Queries the fillable taker asset amounts of native orders.
/// @param orders Native orders to query.
/// @param orderSignatures Signatures for each respective order in `orders`.
/// @param devUtilsAddress Address to the DevUtils contract.
/// @return orderFillableTakerAssetAmounts How much taker asset can be filled
/// by each order in `orders`.
function getOrderFillableTakerAssetAmounts(
LibOrder.Order[] calldata orders,
bytes[] calldata orderSignatures,
address devUtilsAddress
)
external
view
returns (uint256[] memory orderFillableTakerAssetAmounts);
/// @dev Queries the fillable maker asset amounts of native orders.
/// @param orders Native orders to query.
/// @param orderSignatures Signatures for each respective order in `orders`.
/// @param devUtilsAddress Address to the DevUtils contract.
/// @return orderFillableMakerAssetAmounts How much maker asset can be filled
/// by each order in `orders`.
function getOrderFillableMakerAssetAmounts(
LibOrder.Order[] calldata orders,
bytes[] calldata orderSignatures,
address devUtilsAddress
)
external
view
returns (uint256[] memory orderFillableMakerAssetAmounts);
/// @dev Sample sell quotes from Kyber.
/// @param takerToken Address of the taker token (what to sell).
/// @param makerToken Address of the maker token (what to buy).
/// @param takerTokenAmounts Taker token sell amount for each sample.
/// @return makerTokenAmounts Maker amounts bought at each taker token
/// amount.
function sampleSellsFromKyberNetwork(
address takerToken,
address makerToken,
uint256[] calldata takerTokenAmounts
)
external
view
returns (uint256[] memory makerTokenAmounts);
/// @dev Sample buy quotes from Kyber.
/// @param takerToken Address of the taker token (what to sell).
/// @param makerToken Address of the maker token (what to buy).
/// @param makerTokenAmounts Maker token buy amount for each sample.
/// @param opts `FakeBuyOptions` specifying target slippage and max iterations.
/// @return takerTokenAmounts Taker amounts sold at each maker token
/// amount.
function sampleBuysFromKyberNetwork(
address takerToken,
address makerToken,
uint256[] calldata makerTokenAmounts,
FakeBuyOptions calldata opts
)
external
view
returns (uint256[] memory takerTokenAmounts);
/// @dev Sample sell quotes from Eth2Dai/Oasis.
/// @param takerToken Address of the taker token (what to sell).
/// @param makerToken Address of the maker token (what to buy).
/// @param takerTokenAmounts Taker token sell amount for each sample.
/// @return makerTokenAmounts Maker amounts bought at each taker token
/// amount.
function sampleSellsFromEth2Dai(
address takerToken,
address makerToken,
uint256[] calldata takerTokenAmounts
)
external
view
returns (uint256[] memory makerTokenAmounts);
/// @dev Sample sell quotes from Uniswap.
/// @param takerToken Address of the taker token (what to sell).
/// @param makerToken Address of the maker token (what to buy).
/// @param takerTokenAmounts Taker token sell amount for each sample.
/// @return makerTokenAmounts Maker amounts bought at each taker token
/// amount.
function sampleSellsFromUniswap(
address takerToken,
address makerToken,
uint256[] calldata takerTokenAmounts
)
external
view
returns (uint256[] memory makerTokenAmounts);
/// @dev Sample buy quotes from Uniswap.
/// @param takerToken Address of the taker token (what to sell).
/// @param makerToken Address of the maker token (what to buy).
/// @param makerTokenAmounts Maker token buy amount for each sample.
/// @return takerTokenAmounts Taker amounts sold at each maker token
/// amount.
function sampleBuysFromUniswap(
address takerToken,
address makerToken,
uint256[] calldata makerTokenAmounts
)
external
view
returns (uint256[] memory takerTokenAmounts);
/// @dev Sample buy quotes from Eth2Dai/Oasis.
/// @param takerToken Address of the taker token (what to sell).
/// @param makerToken Address of the maker token (what to buy).
/// @param makerTokenAmounts Maker token buy amount for each sample.
/// @return takerTokenAmounts Taker amounts sold at each maker token
/// amount.
function sampleBuysFromEth2Dai(
address takerToken,
address makerToken,
uint256[] calldata makerTokenAmounts
)
external
view
returns (uint256[] memory takerTokenAmounts);
/// @dev Sample sell quotes from Curve.
/// @param curveAddress Address of the Curve contract.
/// @param fromTokenIdx Index of the taker token (what to sell).
/// @param toTokenIdx Index of the maker token (what to buy).
/// @param takerTokenAmounts Taker token sell amount for each sample.
/// @return makerTokenAmounts Maker amounts bought at each taker token
/// amount.
function sampleSellsFromCurve(
address curveAddress,
int128 fromTokenIdx,
int128 toTokenIdx,
uint256[] calldata takerTokenAmounts
)
external
view
returns (uint256[] memory makerTokenAmounts);
/// @dev Sample buy quotes from Curve.
/// @param curveAddress Address of the Curve contract.
/// @param fromTokenIdx Index of the taker token (what to sell).
/// @param toTokenIdx Index of the maker token (what to buy).
/// @param makerTokenAmounts Maker token buy amount for each sample.
/// @return takerTokenAmounts Taker amounts sold at each maker token
/// amount.
function sampleBuysFromCurve(
address curveAddress,
int128 fromTokenIdx,
int128 toTokenIdx,
uint256[] calldata makerTokenAmounts
)
external
view
returns (uint256[] memory takerTokenAmounts);
/// @dev Sample sell quotes from an arbitrary on-chain liquidity provider.
/// @param registryAddress Address of the liquidity provider registry contract.
/// @param takerToken Address of the taker token (what to sell).
/// @param makerToken Address of the maker token (what to buy).
/// @param takerTokenAmounts Taker token sell amount for each sample.
/// @return makerTokenAmounts Maker amounts bought at each taker token
/// amount.
function sampleSellsFromLiquidityProviderRegistry(
address registryAddress,
address takerToken,
address makerToken,
uint256[] calldata takerTokenAmounts
)
external
view
returns (uint256[] memory makerTokenAmounts);
/// @dev Sample sell quotes from MultiBridge.
/// @param multibridge Address of the MultiBridge contract.
/// @param takerToken Address of the taker token (what to sell).
/// @param intermediateToken The address of the intermediate token to
/// use in an indirect route.
/// @param makerToken Address of the maker token (what to buy).
/// @param takerTokenAmounts Taker token sell amount for each sample.
/// @return makerTokenAmounts Maker amounts bought at each taker token
/// amount.
function sampleSellsFromMultiBridge(
address multibridge,
address takerToken,
address intermediateToken,
address makerToken,
uint256[] calldata takerTokenAmounts
)
external
view
returns (uint256[] memory makerTokenAmounts);
/// @dev Sample buy quotes from an arbitrary on-chain liquidity provider.
/// @param registryAddress Address of the liquidity provider registry contract.
/// @param takerToken Address of the taker token (what to sell).
/// @param makerToken Address of the maker token (what to buy).
/// @param makerTokenAmounts Maker token buy amount for each sample.
/// @param opts `FakeBuyOptions` specifying target slippage and max iterations.
/// @return takerTokenAmounts Taker amounts sold at each maker token
/// amount.
function sampleBuysFromLiquidityProviderRegistry(
address registryAddress,
address takerToken,
address makerToken,
uint256[] calldata makerTokenAmounts,
FakeBuyOptions calldata opts
)
external
view
returns (uint256[] memory takerTokenAmounts);
/// @dev Returns the address of a liquidity provider for the given market
/// (takerToken, makerToken), from a registry of liquidity providers.
/// Returns address(0) if no such provider exists in the registry.
/// @param takerToken Taker asset managed by liquidity provider.
/// @param makerToken Maker asset managed by liquidity provider.
/// @return providerAddress Address of the liquidity provider.
function getLiquidityProviderFromRegistry(
address registryAddress,
address takerToken,
address makerToken
)
external
view
returns (address providerAddress);
/// @dev Sample sell quotes from UniswapV2.
/// @param path Token route.
/// @param takerTokenAmounts Taker token sell amount for each sample.
/// @return makerTokenAmounts Maker amounts bought at each taker token
/// amount.
function sampleSellsFromUniswapV2(
address[] calldata path,
uint256[] calldata takerTokenAmounts
)
external
view
returns (uint256[] memory makerTokenAmounts);
/// @dev Sample buy quotes from UniswapV2.
/// @param path Token route.
/// @param makerTokenAmounts Maker token buy amount for each sample.
/// @return takerTokenAmounts Taker amounts sold at each maker token
/// amount.
function sampleBuysFromUniswapV2(
address[] calldata path,
uint256[] calldata makerTokenAmounts
)
external
view
returns (uint256[] memory takerTokenAmounts);
}

View File

@@ -1,93 +0,0 @@
{
"name": "@0x/contracts-erc20-bridge-sampler",
"version": "1.7.0",
"engines": {
"node": ">=6.12"
},
"description": "Sampler contracts for the 0x asset-swapper",
"main": "lib/src/index.js",
"directories": {
"test": "test"
},
"scripts": {
"build": "yarn pre_build && tsc -b",
"build:ci": "yarn build",
"pre_build": "run-s compile contracts:gen generate_contract_wrappers contracts:copy",
"test": "yarn run_mocha",
"rebuild_and_test": "run-s build test",
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
"test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
"test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
"compile": "sol-compiler",
"watch": "sol-compiler -w",
"clean": "shx rm -rf lib test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-wrappers/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
"coverage:report:lcov": "istanbul report lcov",
"test:circleci": "yarn test",
"contracts:gen": "contracts-gen generate",
"contracts:copy": "contracts-gen copy",
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol",
"compile:truffle": "truffle compile"
},
"config": {
"publicInterfaceContracts": "ERC20BridgeSampler,IERC20BridgeSampler,ILiquidityProvider,ILiquidityProviderRegistry,DummyLiquidityProviderRegistry,DummyLiquidityProvider",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
"abis": "./test/generated-artifacts/@(DummyLiquidityProvider|DummyLiquidityProviderRegistry|ERC20BridgeSampler|ICurve|IDevUtils|IERC20BridgeSampler|IEth2Dai|IKyberHintHandler|IKyberNetwork|IKyberNetworkProxy|IKyberStorage|ILiquidityProvider|ILiquidityProviderRegistry|IMultiBridge|IUniswapExchangeQuotes|IUniswapV2Router01|TestERC20BridgeSampler).json"
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md",
"devDependencies": {
"@0x/abi-gen": "^5.3.1",
"@0x/contracts-asset-proxy": "^3.4.0",
"@0x/contracts-erc20": "^3.2.1",
"@0x/contracts-exchange": "^3.2.7",
"@0x/contracts-exchange-libs": "^4.3.7",
"@0x/contracts-gen": "^2.0.10",
"@0x/contracts-test-utils": "^5.3.4",
"@0x/contracts-utils": "^4.5.1",
"@0x/dev-utils": "^3.3.0",
"@0x/sol-compiler": "^4.1.1",
"@0x/tslint-config": "^4.1.0",
"@0x/web3-wrapper": "^7.2.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "*",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"make-promises-safe": "^1.1.0",
"mocha": "^6.2.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solhint": "^1.4.1",
"truffle": "^5.0.32",
"tslint": "5.11.0",
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.3",
"@0x/types": "^3.2.0",
"@0x/typescript-typings": "^5.1.1",
"@0x/utils": "^5.5.1",
"ethereum-types": "^3.2.0",
"lodash": "^4.17.11"
},
"publishConfig": {
"access": "public"
},
"gitHead": "4f91bfd907996b2f4dd383778b50c479c2602b56"
}

View File

@@ -1,2 +0,0 @@
export * from './wrappers';
export * from './artifacts';

View File

@@ -1,43 +0,0 @@
/*
* -----------------------------------------------------------------------------
* Warning: This file is auto-generated by contracts-gen. Don't edit manually.
* -----------------------------------------------------------------------------
*/
import { ContractArtifact } from 'ethereum-types';
import * as DummyLiquidityProvider from '../test/generated-artifacts/DummyLiquidityProvider.json';
import * as DummyLiquidityProviderRegistry from '../test/generated-artifacts/DummyLiquidityProviderRegistry.json';
import * as ERC20BridgeSampler from '../test/generated-artifacts/ERC20BridgeSampler.json';
import * as ICurve from '../test/generated-artifacts/ICurve.json';
import * as IDevUtils from '../test/generated-artifacts/IDevUtils.json';
import * as IERC20BridgeSampler from '../test/generated-artifacts/IERC20BridgeSampler.json';
import * as IEth2Dai from '../test/generated-artifacts/IEth2Dai.json';
import * as IKyberHintHandler from '../test/generated-artifacts/IKyberHintHandler.json';
import * as IKyberNetwork from '../test/generated-artifacts/IKyberNetwork.json';
import * as IKyberNetworkProxy from '../test/generated-artifacts/IKyberNetworkProxy.json';
import * as IKyberStorage from '../test/generated-artifacts/IKyberStorage.json';
import * as ILiquidityProvider from '../test/generated-artifacts/ILiquidityProvider.json';
import * as ILiquidityProviderRegistry from '../test/generated-artifacts/ILiquidityProviderRegistry.json';
import * as IMultiBridge from '../test/generated-artifacts/IMultiBridge.json';
import * as IUniswapExchangeQuotes from '../test/generated-artifacts/IUniswapExchangeQuotes.json';
import * as IUniswapV2Router01 from '../test/generated-artifacts/IUniswapV2Router01.json';
import * as TestERC20BridgeSampler from '../test/generated-artifacts/TestERC20BridgeSampler.json';
export const artifacts = {
DummyLiquidityProvider: DummyLiquidityProvider as ContractArtifact,
DummyLiquidityProviderRegistry: DummyLiquidityProviderRegistry as ContractArtifact,
ERC20BridgeSampler: ERC20BridgeSampler as ContractArtifact,
ICurve: ICurve as ContractArtifact,
IDevUtils: IDevUtils as ContractArtifact,
IERC20BridgeSampler: IERC20BridgeSampler as ContractArtifact,
IEth2Dai: IEth2Dai as ContractArtifact,
IKyberHintHandler: IKyberHintHandler as ContractArtifact,
IKyberNetwork: IKyberNetwork as ContractArtifact,
IKyberNetworkProxy: IKyberNetworkProxy as ContractArtifact,
IKyberStorage: IKyberStorage as ContractArtifact,
ILiquidityProvider: ILiquidityProvider as ContractArtifact,
ILiquidityProviderRegistry: ILiquidityProviderRegistry as ContractArtifact,
IMultiBridge: IMultiBridge as ContractArtifact,
IUniswapExchangeQuotes: IUniswapExchangeQuotes as ContractArtifact,
IUniswapV2Router01: IUniswapV2Router01 as ContractArtifact,
TestERC20BridgeSampler: TestERC20BridgeSampler as ContractArtifact,
};

View File

@@ -1,22 +0,0 @@
/*
* -----------------------------------------------------------------------------
* Warning: This file is auto-generated by contracts-gen. Don't edit manually.
* -----------------------------------------------------------------------------
*/
export * from '../test/generated-wrappers/dummy_liquidity_provider';
export * from '../test/generated-wrappers/dummy_liquidity_provider_registry';
export * from '../test/generated-wrappers/erc20_bridge_sampler';
export * from '../test/generated-wrappers/i_curve';
export * from '../test/generated-wrappers/i_dev_utils';
export * from '../test/generated-wrappers/i_erc20_bridge_sampler';
export * from '../test/generated-wrappers/i_eth2_dai';
export * from '../test/generated-wrappers/i_kyber_hint_handler';
export * from '../test/generated-wrappers/i_kyber_network';
export * from '../test/generated-wrappers/i_kyber_network_proxy';
export * from '../test/generated-wrappers/i_kyber_storage';
export * from '../test/generated-wrappers/i_liquidity_provider';
export * from '../test/generated-wrappers/i_liquidity_provider_registry';
export * from '../test/generated-wrappers/i_multi_bridge';
export * from '../test/generated-wrappers/i_uniswap_exchange_quotes';
export * from '../test/generated-wrappers/i_uniswap_v2_router01';
export * from '../test/generated-wrappers/test_erc20_bridge_sampler';

View File

@@ -1,96 +0,0 @@
/**
* Use this file to configure your truffle project. It's seeded with some
* common settings for different networks and features like migrations,
* compilation and testing. Uncomment the ones you need or modify
* them to suit your project as necessary.
*
* More information about configuration can be found at:
*
* truffleframework.com/docs/advanced/configuration
*
* To deploy via Infura you'll need a wallet provider (like truffle-hdwallet-provider)
* to sign your transactions before they're sent to a remote public node. Infura accounts
* are available for free at: infura.io/register.
*
* You'll also need a mnemonic - the twelve word phrase the wallet uses to generate
* public/private key pairs. If you're publishing your code to GitHub make sure you load this
* phrase from a file you've .gitignored so it doesn't accidentally become public.
*
*/
// const HDWalletProvider = require('truffle-hdwallet-provider');
// const infuraKey = "fj4jll3k.....";
//
// const fs = require('fs');
// const mnemonic = fs.readFileSync(".secret").toString().trim();
module.exports = {
/**
* Networks define how you connect to your ethereum client and let you set the
* defaults web3 uses to send transactions. If you don't specify one truffle
* will spin up a development blockchain for you on port 9545 when you
* run `develop` or `test`. You can ask a truffle command to use a specific
* network from the command line, e.g
*
* $ truffle test --network <network-name>
*/
networks: {
// Useful for testing. The `development` name is special - truffle uses it by default
// if it's defined here and no other network is specified at the command line.
// You should run a client (like ganache-cli, geth or parity) in a separate terminal
// tab if you use this network and you must also set the `host`, `port` and `network_id`
// options below to some value.
//
// development: {
// host: "127.0.0.1", // Localhost (default: none)
// port: 8545, // Standard Ethereum port (default: none)
// network_id: "*", // Any network (default: none)
// },
// Another network with more advanced options...
// advanced: {
// port: 8777, // Custom port
// network_id: 1342, // Custom network
// gas: 8500000, // Gas sent with each transaction (default: ~6700000)
// gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei)
// from: <address>, // Account to send txs from (default: accounts[0])
// websockets: true // Enable EventEmitter interface for web3 (default: false)
// },
// Useful for deploying to a public network.
// NB: It's important to wrap the provider as a function.
// ropsten: {
// provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`),
// network_id: 3, // Ropsten's id
// gas: 5500000, // Ropsten has a lower block limit than mainnet
// confirmations: 2, // # of confs to wait between deployments. (default: 0)
// timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
// skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
// },
// Useful for private networks
// private: {
// provider: () => new HDWalletProvider(mnemonic, `https://network.io`),
// network_id: 2111, // This network is yours, in the cloud.
// production: true // Treats this network as if it was a public net. (default: false)
// }
},
// Set default mocha options here, use special reporters etc.
mocha: {
// timeout: 100000
},
// Configure your compilers
compilers: {
solc: {
version: '0.5.9',
settings: {
evmVersion: 'istanbul',
optimizer: {
enabled: true,
runs: 1000000,
details: { yul: true, deduplicate: true, cse: true, constantOptimizer: true },
},
},
},
},
};

View File

@@ -1,31 +0,0 @@
{
"extends": "../../tsconfig",
"compilerOptions": { "outDir": "lib", "rootDir": ".", "resolveJsonModule": true },
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
"files": [
"generated-artifacts/DummyLiquidityProvider.json",
"generated-artifacts/DummyLiquidityProviderRegistry.json",
"generated-artifacts/ERC20BridgeSampler.json",
"generated-artifacts/IERC20BridgeSampler.json",
"generated-artifacts/ILiquidityProvider.json",
"generated-artifacts/ILiquidityProviderRegistry.json",
"test/generated-artifacts/DummyLiquidityProvider.json",
"test/generated-artifacts/DummyLiquidityProviderRegistry.json",
"test/generated-artifacts/ERC20BridgeSampler.json",
"test/generated-artifacts/ICurve.json",
"test/generated-artifacts/IDevUtils.json",
"test/generated-artifacts/IERC20BridgeSampler.json",
"test/generated-artifacts/IEth2Dai.json",
"test/generated-artifacts/IKyberHintHandler.json",
"test/generated-artifacts/IKyberNetwork.json",
"test/generated-artifacts/IKyberNetworkProxy.json",
"test/generated-artifacts/IKyberStorage.json",
"test/generated-artifacts/ILiquidityProvider.json",
"test/generated-artifacts/ILiquidityProviderRegistry.json",
"test/generated-artifacts/IMultiBridge.json",
"test/generated-artifacts/IUniswapExchangeQuotes.json",
"test/generated-artifacts/IUniswapV2Router01.json",
"test/generated-artifacts/TestERC20BridgeSampler.json"
],
"exclude": ["./deploy/solc/solc_bin"]
}

View File

@@ -1,10 +0,0 @@
{
"extends": ["@0x/tslint-config"],
"rules": {
"custom-no-magic-numbers": false,
"max-file-line-count": false
},
"linterOptions": {
"exclude": ["src/artifacts.ts", "test/artifacts.ts"]
}
}

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1603851023,
"version": "3.2.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "3.2.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "3.2.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1594788383,
"version": "3.2.1",

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.2.4 - _October 28, 2020_
* Dependencies updated
## v3.2.3 - _October 27, 2020_
* Dependencies updated
## v3.2.2 - _October 21, 2020_
* Dependencies updated
## v3.2.1 - _July 15, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc20",
"version": "3.2.1",
"version": "3.2.4",
"engines": {
"node": ">=6.12"
},
@@ -43,34 +43,34 @@
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
"url": "https://github.com/0xProject/protocol.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
"url": "https://github.com/0xProject/protocol/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
"devDependencies": {
"@0x/abi-gen": "^5.3.1",
"@0x/contracts-gen": "^2.0.10",
"@0x/contracts-test-utils": "^5.3.4",
"@0x/contracts-utils": "^4.5.1",
"@0x/dev-utils": "^3.3.0",
"@0x/sol-compiler": "^4.1.1",
"@0x/ts-doc-gen": "^0.0.22",
"@0x/tslint-config": "^4.1.0",
"@0x/types": "^3.2.0",
"@0x/typescript-typings": "^5.1.1",
"@0x/utils": "^5.5.1",
"@0x/web3-wrapper": "^7.2.0",
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"@0x/web3-wrapper": "^7.2.4",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "*",
"@types/node": "12.12.54",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"ethereum-types": "^3.2.0",
"ethereum-types": "^3.3.3",
"lodash": "^4.17.11",
"make-promises-safe": "^1.1.0",
"mocha": "^6.2.0",
@@ -78,11 +78,11 @@
"shx": "^0.2.2",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typedoc": "^0.15.0",
"typedoc": "~0.16.11",
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.3"
"@0x/base-contract": "^6.2.7"
},
"publishConfig": {
"access": "public"

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1603851023,
"version": "3.1.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "3.1.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "3.1.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1594788383,
"version": "3.1.7",

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.1.10 - _October 28, 2020_
* Dependencies updated
## v3.1.9 - _October 27, 2020_
* Dependencies updated
## v3.1.8 - _October 21, 2020_
* Dependencies updated
## v3.1.7 - _July 15, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc721",
"version": "3.1.7",
"version": "3.1.10",
"engines": {
"node": ">=6.12"
},
@@ -44,34 +44,34 @@
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
"url": "https://github.com/0xProject/protocol.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
"url": "https://github.com/0xProject/protocol/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
"devDependencies": {
"@0x/abi-gen": "^5.3.1",
"@0x/contracts-gen": "^2.0.10",
"@0x/contracts-test-utils": "^5.3.4",
"@0x/contracts-utils": "^4.5.1",
"@0x/dev-utils": "^3.3.0",
"@0x/sol-compiler": "^4.1.1",
"@0x/ts-doc-gen": "^0.0.22",
"@0x/tslint-config": "^4.1.0",
"@0x/types": "^3.2.0",
"@0x/typescript-typings": "^5.1.1",
"@0x/utils": "^5.5.1",
"@0x/web3-wrapper": "^7.2.0",
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"@0x/web3-wrapper": "^7.2.4",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "*",
"@types/node": "12.12.54",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"ethereum-types": "^3.2.0",
"ethereum-types": "^3.3.3",
"lodash": "^4.17.11",
"make-promises-safe": "^1.1.0",
"mocha": "^6.2.0",
@@ -80,11 +80,11 @@
"solhint": "^1.4.1",
"truffle": "^5.0.32",
"tslint": "5.11.0",
"typedoc": "^0.15.0",
"typedoc": "~0.16.11",
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.3"
"@0x/base-contract": "^6.2.7"
},
"publishConfig": {
"access": "public"

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1603851023,
"version": "4.2.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "4.2.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "4.2.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1594788383,
"version": "4.2.7",

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.2.10 - _October 28, 2020_
* Dependencies updated
## v4.2.9 - _October 27, 2020_
* Dependencies updated
## v4.2.8 - _October 21, 2020_
* Dependencies updated
## v4.2.7 - _July 15, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange-forwarder",
"version": "4.2.7",
"version": "4.2.10",
"engines": {
"node": ">=6.12"
},
@@ -44,36 +44,36 @@
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
"url": "https://github.com/0xProject/protocol.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
"url": "https://github.com/0xProject/protocol/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.3.1",
"@0x/contracts-asset-proxy": "^3.4.0",
"@0x/contracts-dev-utils": "^1.3.5",
"@0x/contracts-erc1155": "^2.1.7",
"@0x/contracts-erc20": "^3.2.1",
"@0x/contracts-erc721": "^3.1.7",
"@0x/contracts-exchange": "^3.2.7",
"@0x/contracts-exchange-libs": "^4.3.7",
"@0x/contracts-gen": "^2.0.10",
"@0x/contracts-test-utils": "^5.3.4",
"@0x/contracts-utils": "^4.5.1",
"@0x/dev-utils": "^3.3.0",
"@0x/order-utils": "^10.3.0",
"@0x/sol-compiler": "^4.1.1",
"@0x/ts-doc-gen": "^0.0.22",
"@0x/tslint-config": "^4.1.0",
"@0x/types": "^3.2.0",
"@0x/utils": "^5.5.1",
"@0x/web3-wrapper": "^7.2.0",
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-dev-utils": "^1.3.8",
"@0x/contracts-erc1155": "^2.1.10",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-erc721": "^3.1.10",
"@0x/contracts-exchange": "^3.2.10",
"@0x/contracts-exchange-libs": "^4.3.10",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/order-utils": "^10.4.2",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/utils": "^5.6.3",
"@0x/web3-wrapper": "^7.2.4",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "*",
"@types/node": "12.12.54",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
@@ -86,13 +86,13 @@
"solhint": "^1.4.1",
"truffle": "^5.0.32",
"tslint": "5.11.0",
"typedoc": "^0.15.0",
"typedoc": "~0.16.11",
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.3",
"@0x/typescript-typings": "^5.1.1",
"ethereum-types": "^3.2.0"
"@0x/base-contract": "^6.2.7",
"@0x/typescript-typings": "^5.1.5",
"ethereum-types": "^3.3.3"
},
"publishConfig": {
"access": "public"

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1603851023,
"version": "4.3.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "4.3.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "4.3.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1594788383,
"version": "4.3.7",

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.3.10 - _October 28, 2020_
* Dependencies updated
## v4.3.9 - _October 27, 2020_
* Dependencies updated
## v4.3.8 - _October 21, 2020_
* Dependencies updated
## v4.3.7 - _July 15, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange-libs",
"version": "4.3.7",
"version": "4.3.10",
"engines": {
"node": ">=6.12"
},
@@ -44,25 +44,25 @@
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
"url": "https://github.com/0xProject/protocol.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
"url": "https://github.com/0xProject/protocol/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/libs/README.md",
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/libs",
"devDependencies": {
"@0x/abi-gen": "^5.3.1",
"@0x/contracts-gen": "^2.0.10",
"@0x/dev-utils": "^3.3.0",
"@0x/sol-compiler": "^4.1.1",
"@0x/subproviders": "^6.1.1",
"@0x/ts-doc-gen": "^0.0.22",
"@0x/tslint-config": "^4.1.0",
"@0x/web3-wrapper": "^7.2.0",
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-gen": "2.0.13",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/subproviders": "^6.1.5",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/web3-wrapper": "^7.2.4",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "*",
"@types/node": "12.12.54",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
@@ -76,18 +76,18 @@
"solhint": "^1.4.1",
"truffle": "^5.0.32",
"tslint": "5.11.0",
"typedoc": "^0.15.0",
"typedoc": "~0.16.11",
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.3",
"@0x/contracts-test-utils": "^5.3.4",
"@0x/contracts-utils": "^4.5.1",
"@0x/order-utils": "^10.3.0",
"@0x/types": "^3.2.0",
"@0x/typescript-typings": "^5.1.1",
"@0x/utils": "^5.5.1",
"ethereum-types": "^3.2.0"
"@0x/base-contract": "^6.2.7",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/order-utils": "^10.4.2",
"@0x/types": "^3.2.4",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"ethereum-types": "^3.3.3"
},
"publishConfig": {
"access": "public"

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1603851023,
"version": "3.2.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "3.2.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "3.2.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1594788383,
"version": "3.2.7",

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.2.10 - _October 28, 2020_
* Dependencies updated
## v3.2.9 - _October 27, 2020_
* Dependencies updated
## v3.2.8 - _October 21, 2020_
* Dependencies updated
## v3.2.7 - _July 15, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange",
"version": "3.2.7",
"version": "3.2.10",
"engines": {
"node": ">=6.12"
},
@@ -44,37 +44,37 @@
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
"url": "https://github.com/0xProject/protocol.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
"url": "https://github.com/0xProject/protocol/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md",
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
"devDependencies": {
"@0x/abi-gen": "^5.3.1",
"@0x/contracts-asset-proxy": "^3.4.0",
"@0x/contracts-exchange-libs": "^4.3.7",
"@0x/contracts-gen": "^2.0.10",
"@0x/contracts-multisig": "^4.1.7",
"@0x/contracts-staking": "^2.0.14",
"@0x/contracts-test-utils": "^5.3.4",
"@0x/contracts-utils": "^4.5.1",
"@0x/dev-utils": "^3.3.0",
"@0x/sol-compiler": "^4.1.1",
"@0x/ts-doc-gen": "^0.0.22",
"@0x/tslint-config": "^4.1.0",
"@0x/types": "^3.2.0",
"@0x/typescript-typings": "^5.1.1",
"@0x/web3-wrapper": "^7.2.0",
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-exchange-libs": "^4.3.10",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-multisig": "^4.1.10",
"@0x/contracts-staking": "^2.0.17",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/typescript-typings": "^5.1.5",
"@0x/web3-wrapper": "^7.2.4",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "*",
"@types/node": "12.12.54",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"ethereum-types": "^3.2.0",
"ethereum-types": "^3.3.3",
"ethereumjs-util": "^5.1.1",
"js-combinatorics": "^0.5.3",
"make-promises-safe": "^1.1.0",
@@ -84,17 +84,17 @@
"solhint": "^1.4.1",
"truffle": "^5.0.32",
"tslint": "5.11.0",
"typedoc": "^0.15.0",
"typedoc": "~0.16.11",
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.3",
"@0x/contracts-dev-utils": "^1.3.5",
"@0x/contracts-erc1155": "^2.1.7",
"@0x/contracts-erc20": "^3.2.1",
"@0x/contracts-erc721": "^3.1.7",
"@0x/order-utils": "^10.3.0",
"@0x/utils": "^5.5.1",
"@0x/base-contract": "^6.2.7",
"@0x/contracts-dev-utils": "^1.3.8",
"@0x/contracts-erc1155": "^2.1.10",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-erc721": "^3.1.10",
"@0x/order-utils": "^10.4.2",
"@0x/utils": "^5.6.3",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -286,11 +286,11 @@ describe('AssetProxyDispatcher', () => {
});
const encodedAssetData = encodeERC20AssetData(erc20TokenA.address);
const amount = new BigNumber(1);
const nestedError = new StringRevertError(RevertReason.TransferFailed).encode();
const nestedError = new StringRevertError(RevertReason.TransferFailed);
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
orderHash,
encodedAssetData,
nestedError,
nestedError.encode(),
);
const tx = assetProxyDispatcher
.dispatchTransferFrom(orderHash, encodedAssetData, makerAddress, takerAddress, amount)
@@ -309,11 +309,11 @@ describe('AssetProxyDispatcher', () => {
from: makerAddress,
});
const transferIndexAsBytes32 = '0x0000000000000000000000000000000000000000000000000000000000000001';
const nestedError = new StringRevertError(RevertReason.TransferFailed).encode();
const nestedError = new StringRevertError(RevertReason.TransferFailed);
const expectedError = new ExchangeRevertErrors.AssetProxyTransferError(
transferIndexAsBytes32,
assetDataB,
nestedError,
nestedError.encode(),
);
const tx = assetProxyDispatcher
.simulateDispatchTransferFromCalls(

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1603851023,
"version": "6.2.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "6.2.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "6.2.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1594788383,
"version": "6.2.1",

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v6.2.4 - _October 28, 2020_
* Dependencies updated
## v6.2.3 - _October 27, 2020_
* Dependencies updated
## v6.2.2 - _October 21, 2020_
* Dependencies updated
## v6.2.1 - _July 15, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-extensions",
"version": "6.2.1",
"version": "6.2.4",
"engines": {
"node": ">=6.12"
},
@@ -11,6 +11,7 @@
},
"scripts": {
"build": "yarn pre_build && tsc -b",
"build:ts": "tsc -b",
"build:ci": "yarn build",
"pre_build": "run-s compile contracts:gen generate_contract_wrappers contracts:copy",
"test": "yarn run_mocha",
@@ -43,35 +44,34 @@
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
"url": "https://github.com/0xProject/protocol.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
"url": "https://github.com/0xProject/protocol/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.3.1",
"@0x/contracts-asset-proxy": "^3.4.0",
"@0x/contracts-dev-utils": "^1.3.5",
"@0x/contracts-erc20": "^3.2.1",
"@0x/contracts-erc721": "^3.1.7",
"@0x/contracts-exchange": "^3.2.7",
"@0x/contracts-exchange-libs": "^4.3.7",
"@0x/contracts-gen": "^2.0.10",
"@0x/contracts-test-utils": "^5.3.4",
"@0x/contracts-utils": "^4.5.1",
"@0x/dev-utils": "^3.3.0",
"@0x/order-utils": "^10.3.0",
"@0x/sol-compiler": "^4.1.1",
"@0x/ts-doc-gen": "^0.0.22",
"@0x/tslint-config": "^4.1.0",
"@0x/types": "^3.2.0",
"@0x/utils": "^5.5.1",
"@0x/web3-wrapper": "^7.2.0",
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-dev-utils": "^1.3.8",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-erc721": "^3.1.10",
"@0x/contracts-exchange": "^3.2.10",
"@0x/contracts-exchange-libs": "^4.3.10",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/order-utils": "^10.4.2",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/utils": "^5.6.3",
"@0x/web3-wrapper": "^7.2.4",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "*",
"@types/node": "12.12.54",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
@@ -86,13 +86,14 @@
"solhint": "^1.4.1",
"truffle": "^5.0.32",
"tslint": "5.11.0",
"typedoc": "^0.15.0",
"typedoc": "~0.16.11",
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.3",
"@0x/typescript-typings": "^5.1.1",
"ethereum-types": "^3.2.0"
"@0x/base-contract": "^6.2.7",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/typescript-typings": "^5.1.5",
"ethereum-types": "^3.3.3"
},
"publishConfig": {
"access": "public"

View File

@@ -1,4 +1,45 @@
[
{
"timestamp": 1603851023,
"version": "2.7.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "2.7.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603487270,
"version": "2.7.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "2.7.0",
"changes": [
{
"note": "Update curveBridge tests",
"pr": 2633
},
{
"note": "Add EP RFQT + MTX tests",
"pr": 2692
}
],
"timestamp": 1603265572
},
{
"version": "2.6.0",
"changes": [

View File

@@ -5,6 +5,23 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.7.3 - _October 28, 2020_
* Dependencies updated
## v2.7.2 - _October 27, 2020_
* Dependencies updated
## v2.7.1 - _October 23, 2020_
* Dependencies updated
## v2.7.0 - _October 21, 2020_
* Update curveBridge tests (#2633)
* Add EP RFQT + MTX tests (#2692)
## v2.6.0 - _July 15, 2020_
* Add `BalancerBridge` mainnet tests (#2613)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-integrations",
"version": "2.6.0",
"version": "2.7.3",
"engines": {
"node": ">=6.12"
},
@@ -43,37 +43,36 @@
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
"url": "https://github.com/0xProject/protocol.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
"url": "https://github.com/0xProject/protocol/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.3.1",
"@0x/contract-addresses": "^4.11.0",
"@0x/contract-wrappers": "^13.8.0",
"@0x/contracts-broker": "^1.1.6",
"@0x/contracts-coordinator": "^3.1.7",
"@0x/contracts-dev-utils": "^1.3.5",
"@0x/contracts-erc20-bridge-sampler": "^1.7.0",
"@0x/contracts-exchange-forwarder": "^4.2.7",
"@0x/contracts-exchange-libs": "^4.3.7",
"@0x/contracts-extensions": "^6.2.1",
"@0x/contracts-gen": "^2.0.10",
"@0x/contracts-utils": "^4.5.1",
"@0x/abi-gen": "^5.4.3",
"@0x/contract-addresses": "^5.0.1",
"@0x/contract-wrappers": "^13.9.2",
"@0x/contracts-broker": "^1.1.9",
"@0x/contracts-coordinator": "^3.1.10",
"@0x/contracts-dev-utils": "^1.3.8",
"@0x/contracts-exchange-forwarder": "^4.2.10",
"@0x/contracts-exchange-libs": "^4.3.10",
"@0x/contracts-extensions": "^6.2.4",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-utils": "^4.5.4",
"@0x/coordinator-server": "^1.0.5",
"@0x/dev-utils": "^3.3.0",
"@0x/migrations": "^6.4.0",
"@0x/order-utils": "^10.3.0",
"@0x/sol-compiler": "^4.1.1",
"@0x/tslint-config": "^4.1.0",
"@0x/web3-wrapper": "^7.2.0",
"@0x/dev-utils": "^3.3.4",
"@0x/migrations": "^6.4.4",
"@0x/order-utils": "^10.4.2",
"@0x/sol-compiler": "^4.2.3",
"@0x/tslint-config": "^4.1.3",
"@0x/web3-wrapper": "^7.2.4",
"@azure/core-asynciterator-polyfill": "^1.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "*",
"@types/node": "12.12.54",
"@types/seedrandom": "^2.4.28",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
@@ -92,20 +91,22 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/asset-swapper": "^4.6.0",
"@0x/base-contract": "^6.2.3",
"@0x/contracts-asset-proxy": "^3.4.0",
"@0x/contracts-erc1155": "^2.1.7",
"@0x/contracts-erc20": "^3.2.1",
"@0x/contracts-erc721": "^3.1.7",
"@0x/contracts-exchange": "^3.2.7",
"@0x/contracts-multisig": "^4.1.7",
"@0x/contracts-staking": "^2.0.14",
"@0x/contracts-test-utils": "^5.3.4",
"@0x/types": "^3.2.0",
"@0x/typescript-typings": "^5.1.1",
"@0x/utils": "^5.5.1",
"ethereum-types": "^3.2.0",
"@0x/asset-swapper": "^4.8.1",
"@0x/base-contract": "^6.2.7",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-erc1155": "^2.1.10",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-erc721": "^3.1.10",
"@0x/contracts-exchange": "^3.2.10",
"@0x/contracts-multisig": "^4.1.10",
"@0x/contracts-staking": "^2.0.17",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-zero-ex": "^0.5.1",
"@0x/subproviders": "^6.1.5",
"@0x/types": "^3.2.4",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"ethereum-types": "^3.3.3",
"ethereumjs-util": "^6.2.0",
"lodash": "^4.17.11"
},

View File

@@ -4,107 +4,128 @@ import { ERC20TokenContract } from '@0x/contracts-erc20';
import { blockchainTests, constants, describe, toBaseUnitAmount } from '@0x/contracts-test-utils';
import { AbiEncoder } from '@0x/utils';
blockchainTests.fork.resets('Mainnet curve bridge tests', env => {
const USDC_WALLET = '0x3dfd23a6c5e8bbcfc9581d2e864a68feb6a076d3';
const DAI_WALLET = '0x6cc5f688a315f3dc28a7781717a9a798a59fda7b';
const WBTC_WALLET = '0x56178a0d5F301bAf6CF3e1Cd53d9863437345Bf9';
blockchainTests.configure({
fork: {
unlockedAccounts: [USDC_WALLET, DAI_WALLET, WBTC_WALLET],
},
});
blockchainTests.fork('Mainnet curve bridge tests', env => {
let testContract: CurveBridgeContract;
const receiver = '0x986ccf5234d9cfbb25246f1a5bfa51f4ccfcb308';
const usdcWallet = '0xF977814e90dA44bFA03b6295A0616a897441aceC';
const usdcAddress = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48';
const daiWallet = '0x6cc5f688a315f3dc28a7781717a9a798a59fda7b';
const daiAddress = '0x6B175474E89094C44Da98b954EedeAC495271d0F';
const curveAddressUsdcDai = '0x2e60CF74d81ac34eB21eEff58Db4D385920ef419';
const curveAddressUsdcDaiUsdt = '0x52EA46506B9CC5Ef470C5bf89f17Dc28bB35D85C';
const daiTokenIdx = 0;
const usdcTokenIdx = 1;
const RECEIVER = '0x986ccf5234d9cfbb25246f1a5bfa51f4ccfcb308';
const bridgeDataEncoder = AbiEncoder.create([
{ name: 'curveAddress', type: 'address' },
{ name: 'exchangeFunctionSelector', type: 'bytes4' },
{ name: 'fromTokenAddress', type: 'address' },
{ name: 'fromTokenIdx', type: 'int128' },
{ name: 'toTokenIdx', type: 'int128' },
{ name: 'version', type: 'int128' },
]);
before(async () => {
testContract = await CurveBridgeContract.deployFrom0xArtifactAsync(
assetProxyArtifacts.CurveBridge,
env.provider,
{ ...env.txDefaults, from: daiWallet },
{ ...env.txDefaults },
{},
);
});
describe('bridgeTransferFrom()', () => {
describe('Version 0', () => {
const version = 0;
describe('exchange_underlying()', () => {
const USDC_ADDRESS = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48';
const DAI_ADDRESS = '0x6B175474E89094C44Da98b954EedeAC495271d0F';
const DAI_TOKEN_IDX = 0;
const USDC_TOKEN_IDX = 1;
const EXCHANGE_UNDERLYING_SELECTOR = '0xa6417ed6';
const CURVE_ADDRESS = '0xa2b47e3d5c44877cca798226b7b8118f9bfb7a56';
it('succeeds exchanges DAI for USDC', async () => {
const bridgeData = bridgeDataEncoder.encode([curveAddressUsdcDai, daiTokenIdx, usdcTokenIdx, version]);
const bridgeData = bridgeDataEncoder.encode([
CURVE_ADDRESS,
EXCHANGE_UNDERLYING_SELECTOR,
DAI_ADDRESS,
DAI_TOKEN_IDX,
USDC_TOKEN_IDX,
]);
// Fund the Bridge
const dai = new ERC20TokenContract(daiAddress, env.provider, { ...env.txDefaults, from: daiWallet });
const dai = new ERC20TokenContract(DAI_ADDRESS, env.provider, { ...env.txDefaults, from: DAI_WALLET });
await dai
.transfer(testContract.address, toBaseUnitAmount(1))
.awaitTransactionSuccessAsync({ from: daiWallet }, { shouldValidate: false });
.awaitTransactionSuccessAsync({}, { shouldValidate: false });
// Exchange via Curve
await testContract
.bridgeTransferFrom(
usdcAddress,
USDC_ADDRESS,
constants.NULL_ADDRESS,
receiver,
RECEIVER,
constants.ZERO_AMOUNT,
bridgeData,
)
.awaitTransactionSuccessAsync({ from: daiWallet, gasPrice: 1 }, { shouldValidate: false });
.awaitTransactionSuccessAsync({}, { shouldValidate: false });
});
it('succeeds exchanges USDC for DAI', async () => {
const bridgeData = bridgeDataEncoder.encode([curveAddressUsdcDai, usdcTokenIdx, daiTokenIdx, version]);
const bridgeData = bridgeDataEncoder.encode([
CURVE_ADDRESS,
EXCHANGE_UNDERLYING_SELECTOR,
USDC_ADDRESS,
USDC_TOKEN_IDX,
DAI_TOKEN_IDX,
]);
// Fund the Bridge
const usdc = new ERC20TokenContract(usdcAddress, env.provider, { ...env.txDefaults, from: usdcWallet });
const usdc = new ERC20TokenContract(USDC_ADDRESS, env.provider, {
...env.txDefaults,
from: USDC_WALLET,
});
await usdc
.transfer(testContract.address, toBaseUnitAmount(1, 6))
.awaitTransactionSuccessAsync({ from: usdcWallet }, { shouldValidate: false });
.awaitTransactionSuccessAsync({}, { shouldValidate: false });
// Exchange via Curve
await testContract
.bridgeTransferFrom(daiAddress, constants.NULL_ADDRESS, receiver, constants.ZERO_AMOUNT, bridgeData)
.awaitTransactionSuccessAsync({ from: usdcWallet, gasPrice: 1 }, { shouldValidate: false });
.bridgeTransferFrom(
DAI_ADDRESS,
constants.NULL_ADDRESS,
RECEIVER,
constants.ZERO_AMOUNT,
bridgeData,
)
.awaitTransactionSuccessAsync({}, { shouldValidate: false });
});
});
describe('Version 1', () => {
const version = 1;
it('succeeds exchanges DAI for USDC', async () => {
describe('exchange()', () => {
const WBTC_ADDRESS = '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599';
const RENBTC_ADDRESS = '0xeb4c2781e4eba804ce9a9803c67d0893436bb27d';
const RENBTC_TOKEN_IDX = 0;
const WBTC_TOKEN_IDX = 1;
const EXCHANGE_SELECTOR = '0x3df02124';
const CURVE_ADDRESS = '0x7fc77b5c7614e1533320ea6ddc2eb61fa00a9714';
it('succeeds exchanges WBTC for renBTC', async () => {
const bridgeData = bridgeDataEncoder.encode([
curveAddressUsdcDaiUsdt,
daiTokenIdx,
usdcTokenIdx,
version,
CURVE_ADDRESS,
EXCHANGE_SELECTOR,
WBTC_ADDRESS,
WBTC_TOKEN_IDX,
RENBTC_TOKEN_IDX,
]);
// Fund the Bridge
const dai = new ERC20TokenContract(daiAddress, env.provider, { ...env.txDefaults, from: daiWallet });
await dai
.transfer(testContract.address, toBaseUnitAmount(1))
.awaitTransactionSuccessAsync({ from: daiWallet }, { shouldValidate: false });
const wbtc = new ERC20TokenContract(WBTC_ADDRESS, env.provider, {
...env.txDefaults,
from: WBTC_WALLET,
});
await wbtc
.transfer(testContract.address, toBaseUnitAmount(1, 8))
.awaitTransactionSuccessAsync({}, { shouldValidate: false });
// Exchange via Curve
await testContract
.bridgeTransferFrom(
usdcAddress,
RENBTC_ADDRESS,
constants.NULL_ADDRESS,
receiver,
RECEIVER,
constants.ZERO_AMOUNT,
bridgeData,
)
.awaitTransactionSuccessAsync({ from: daiWallet, gasPrice: 1 }, { shouldValidate: false });
});
it('succeeds exchanges USDC for DAI', async () => {
const bridgeData = bridgeDataEncoder.encode([
curveAddressUsdcDaiUsdt,
usdcTokenIdx,
daiTokenIdx,
version,
]);
// Fund the Bridge
const usdc = new ERC20TokenContract(usdcAddress, env.provider, { ...env.txDefaults, from: usdcWallet });
await usdc
.transfer(testContract.address, toBaseUnitAmount(1, 6))
.awaitTransactionSuccessAsync({ from: usdcWallet }, { shouldValidate: false });
// Exchange via Curve
await testContract
.bridgeTransferFrom(daiAddress, constants.NULL_ADDRESS, receiver, constants.ZERO_AMOUNT, bridgeData)
.awaitTransactionSuccessAsync({ from: usdcWallet, gasPrice: 1 }, { shouldValidate: false });
.awaitTransactionSuccessAsync({ gas: 6e6 }, { shouldValidate: false });
});
});
});

View File

@@ -0,0 +1,426 @@
import { ContractAddresses } from '@0x/contract-addresses';
import { artifacts as erc20Artifacts, DummyERC20TokenContract } from '@0x/contracts-erc20';
import { IExchangeContract } from '@0x/contracts-exchange';
import { blockchainTests, constants, expect, getRandomPortion, verifyEventsFromLogs } from '@0x/contracts-test-utils';
import {
artifacts as exchangeProxyArtifacts,
IZeroExContract,
LogMetadataTransformerContract,
signCallData,
} from '@0x/contracts-zero-ex';
import { migrateOnceAsync } from '@0x/migrations';
import {
assetDataUtils,
encodeFillQuoteTransformerData,
encodePayTakerTransformerData,
ETH_TOKEN_ADDRESS,
FillQuoteTransformerSide,
findTransformerNonce,
signatureUtils,
SignedExchangeProxyMetaTransaction,
} from '@0x/order-utils';
import { AssetProxyId, Order, SignedOrder } from '@0x/types';
import { BigNumber, hexUtils, ZeroExRevertErrors } from '@0x/utils';
import * as ethjs from 'ethereumjs-util';
const { MAX_UINT256, NULL_ADDRESS, NULL_BYTES, NULL_BYTES32, ZERO_AMOUNT } = constants;
blockchainTests.resets('exchange proxy - meta-transactions', env => {
const quoteSignerKey = hexUtils.random();
const quoteSigner = hexUtils.toHex(ethjs.privateToAddress(ethjs.toBuffer(quoteSignerKey)));
let owner: string;
let relayer: string;
let maker: string;
let taker: string;
let flashWalletAddress: string;
let zeroEx: IZeroExContract;
let exchange: IExchangeContract;
let inputToken: DummyERC20TokenContract;
let outputToken: DummyERC20TokenContract;
let feeToken: DummyERC20TokenContract;
let addresses: ContractAddresses;
let protocolFee: BigNumber;
let metadataTransformer: LogMetadataTransformerContract;
const GAS_PRICE = new BigNumber('1e9');
const MAKER_BALANCE = new BigNumber('100e18');
const TAKER_BALANCE = new BigNumber('100e18');
const TAKER_FEE_BALANCE = new BigNumber('100e18');
before(async () => {
[, relayer, maker, taker] = await env.getAccountAddressesAsync();
addresses = await migrateOnceAsync(env.provider);
zeroEx = new IZeroExContract(addresses.exchangeProxy, env.provider, env.txDefaults, {
LogMetadataTransformer: LogMetadataTransformerContract.ABI(),
DummyERC20Token: DummyERC20TokenContract.ABI(),
});
exchange = new IExchangeContract(addresses.exchange, env.provider, env.txDefaults);
[inputToken, outputToken, feeToken] = await Promise.all(
[...new Array(3)].map(i =>
DummyERC20TokenContract.deployFrom0xArtifactAsync(
erc20Artifacts.DummyERC20Token,
env.provider,
env.txDefaults,
{},
`DummyToken-${i}`,
`TOK${i}`,
new BigNumber(18),
BigNumber.max(MAKER_BALANCE, TAKER_BALANCE),
),
),
);
// LogMetadataTransformer is not deployed in migrations.
metadataTransformer = await LogMetadataTransformerContract.deployFrom0xArtifactAsync(
exchangeProxyArtifacts.LogMetadataTransformer,
env.provider,
{
...env.txDefaults,
from: addresses.exchangeProxyTransformerDeployer,
},
{},
);
owner = await zeroEx.owner().callAsync();
protocolFee = await exchange.protocolFeeMultiplier().callAsync();
flashWalletAddress = await zeroEx.getTransformWallet().callAsync();
const erc20Proxy = await exchange.getAssetProxy(AssetProxyId.ERC20).callAsync();
const allowanceTarget = await zeroEx.getAllowanceTarget().callAsync();
await outputToken.mint(MAKER_BALANCE).awaitTransactionSuccessAsync({ from: maker });
await inputToken.mint(TAKER_BALANCE).awaitTransactionSuccessAsync({ from: taker });
await feeToken.mint(TAKER_FEE_BALANCE).awaitTransactionSuccessAsync({ from: taker });
await outputToken.approve(erc20Proxy, MAX_UINT256).awaitTransactionSuccessAsync({ from: maker });
await inputToken.approve(allowanceTarget, MAX_UINT256).awaitTransactionSuccessAsync({ from: taker });
await feeToken.approve(allowanceTarget, MAX_UINT256).awaitTransactionSuccessAsync({ from: taker });
await zeroEx.setQuoteSigner(quoteSigner).awaitTransactionSuccessAsync({ from: owner });
});
interface Transformation {
deploymentNonce: number;
data: string;
}
interface SwapInfo {
inputTokenAddress: string;
outputTokenAddress: string;
inputTokenAmount: BigNumber;
minOutputTokenAmount: BigNumber;
transformations: Transformation[];
orders: SignedOrder[];
}
async function generateSwapAsync(orderFields: Partial<Order> = {}, isRfqt: boolean = false): Promise<SwapInfo> {
const order = await signatureUtils.ecSignTypedDataOrderAsync(
env.provider,
{
chainId: 1337,
exchangeAddress: exchange.address,
expirationTimeSeconds: new BigNumber(Date.now()),
salt: new BigNumber(hexUtils.random()),
feeRecipientAddress: NULL_ADDRESS,
senderAddress: NULL_ADDRESS,
takerAddress: isRfqt ? flashWalletAddress : NULL_ADDRESS,
makerAddress: maker,
makerAssetData: assetDataUtils.encodeERC20AssetData(outputToken.address),
takerAssetData: assetDataUtils.encodeERC20AssetData(inputToken.address),
makerFeeAssetData: NULL_BYTES,
takerFeeAssetData: NULL_BYTES,
takerAssetAmount: getRandomPortion(TAKER_BALANCE),
makerAssetAmount: getRandomPortion(MAKER_BALANCE),
makerFee: ZERO_AMOUNT,
takerFee: ZERO_AMOUNT,
...orderFields,
},
maker,
);
const transformations = [
{
deploymentNonce: findTransformerNonce(
addresses.transformers.fillQuoteTransformer,
addresses.exchangeProxyTransformerDeployer,
),
data: encodeFillQuoteTransformerData({
orders: [order],
signatures: [order.signature],
buyToken: outputToken.address,
sellToken: inputToken.address,
fillAmount: order.takerAssetAmount,
maxOrderFillAmounts: [],
refundReceiver: hexUtils.leftPad(2, 20), // Send refund to sender.
rfqtTakerAddress: isRfqt ? taker : NULL_ADDRESS,
side: FillQuoteTransformerSide.Sell,
}),
},
{
deploymentNonce: findTransformerNonce(
addresses.transformers.payTakerTransformer,
addresses.exchangeProxyTransformerDeployer,
),
data: encodePayTakerTransformerData({
tokens: [inputToken.address, outputToken.address, ETH_TOKEN_ADDRESS],
amounts: [MAX_UINT256, MAX_UINT256, MAX_UINT256],
}),
},
{
deploymentNonce: findTransformerNonce(
metadataTransformer.address,
addresses.exchangeProxyTransformerDeployer,
),
data: NULL_BYTES,
},
];
return {
transformations,
orders: [order],
inputTokenAddress: inputToken.address,
outputTokenAddress: outputToken.address,
inputTokenAmount: order.takerAssetAmount,
minOutputTokenAmount: order.makerAssetAmount,
};
}
function getSwapData(swap: SwapInfo): string {
return zeroEx
.transformERC20(
swap.inputTokenAddress,
swap.outputTokenAddress,
swap.inputTokenAmount,
swap.minOutputTokenAmount,
swap.transformations,
)
.getABIEncodedTransactionData();
}
function getSignedSwapData(swap: SwapInfo, signerKey?: string): string {
return signCallData(
zeroEx
.transformERC20(
swap.inputTokenAddress,
swap.outputTokenAddress,
swap.inputTokenAmount,
swap.minOutputTokenAmount,
swap.transformations,
)
.getABIEncodedTransactionData(),
signerKey ? signerKey : quoteSignerKey,
);
}
async function createMetaTransactionAsync(
data: string,
value: BigNumber,
fee?: BigNumber | number,
): Promise<SignedExchangeProxyMetaTransaction> {
return signatureUtils.ecSignTypedDataExchangeProxyMetaTransactionAsync(
env.provider,
{
value,
signer: taker,
sender: relayer,
minGasPrice: GAS_PRICE,
maxGasPrice: GAS_PRICE,
expirationTimeSeconds: new BigNumber(Math.floor(Date.now() / 1000) + 60),
salt: new BigNumber(hexUtils.random()),
callData: data,
feeToken: feeToken.address,
feeAmount: fee !== undefined ? new BigNumber(fee) : getRandomPortion(TAKER_FEE_BALANCE),
domain: {
chainId: 1,
name: 'ZeroEx',
version: '1.0.0',
verifyingContract: zeroEx.address,
},
},
taker,
);
}
it('can call `transformERC20()` with signed calldata and no relayer fee', async () => {
const swap = await generateSwapAsync();
const callDataHash = hexUtils.hash(getSwapData(swap));
const signedSwapData = getSignedSwapData(swap);
const _protocolFee = protocolFee.times(GAS_PRICE).times(swap.orders.length + 1); // Pay a little more fee than needed.
const mtx = await createMetaTransactionAsync(signedSwapData, _protocolFee, 0);
const relayerEthBalanceBefore = await env.web3Wrapper.getBalanceInWeiAsync(relayer);
const receipt = await zeroEx
.executeMetaTransaction(mtx, mtx.signature)
.awaitTransactionSuccessAsync({ from: relayer, value: mtx.value, gasPrice: GAS_PRICE });
const relayerEthRefund = relayerEthBalanceBefore
.minus(await env.web3Wrapper.getBalanceInWeiAsync(relayer))
.minus(GAS_PRICE.times(receipt.gasUsed));
// Ensure the relayer got back the unused protocol fees.
expect(relayerEthRefund).to.bignumber.eq(protocolFee.times(GAS_PRICE));
// Ensure the relayer got paid no mtx fees.
expect(await feeToken.balanceOf(relayer).callAsync()).to.bignumber.eq(0);
// Ensure the taker got output tokens.
expect(await outputToken.balanceOf(taker).callAsync()).to.bignumber.eq(swap.minOutputTokenAmount);
// Ensure the maker got input tokens.
expect(await inputToken.balanceOf(maker).callAsync()).to.bignumber.eq(swap.inputTokenAmount);
// Check events.
verifyEventsFromLogs(
receipt.logs,
[
{
taker,
callDataHash,
sender: zeroEx.address,
data: NULL_BYTES,
},
],
'TransformerMetadata',
);
});
it('can call `transformERC20()` with signed calldata and a relayer fee', async () => {
const swap = await generateSwapAsync();
const callDataHash = hexUtils.hash(getSwapData(swap));
const signedSwapData = getSignedSwapData(swap);
const _protocolFee = protocolFee.times(GAS_PRICE).times(swap.orders.length + 1); // Pay a little more fee than needed.
const mtx = await createMetaTransactionAsync(signedSwapData, _protocolFee);
const relayerEthBalanceBefore = await env.web3Wrapper.getBalanceInWeiAsync(relayer);
const receipt = await zeroEx
.executeMetaTransaction(mtx, mtx.signature)
.awaitTransactionSuccessAsync({ from: relayer, value: mtx.value, gasPrice: GAS_PRICE });
const relayerEthRefund = relayerEthBalanceBefore
.minus(await env.web3Wrapper.getBalanceInWeiAsync(relayer))
.minus(GAS_PRICE.times(receipt.gasUsed));
// Ensure the relayer got back the unused protocol fees.
expect(relayerEthRefund).to.bignumber.eq(protocolFee.times(GAS_PRICE));
// Ensure the relayer got paid mtx fees.
expect(await feeToken.balanceOf(relayer).callAsync()).to.bignumber.eq(mtx.feeAmount);
// Ensure the taker got output tokens.
expect(await outputToken.balanceOf(taker).callAsync()).to.bignumber.eq(swap.minOutputTokenAmount);
// Ensure the maker got input tokens.
expect(await inputToken.balanceOf(maker).callAsync()).to.bignumber.eq(swap.inputTokenAmount);
// Check events.
verifyEventsFromLogs(
receipt.logs,
[
{
taker,
callDataHash,
sender: zeroEx.address,
data: NULL_BYTES,
},
],
'TransformerMetadata',
);
});
it('can call `transformERC20()` with wrongly signed calldata and a relayer fee', async () => {
const swap = await generateSwapAsync();
const signedSwapData = getSignedSwapData(swap, hexUtils.random());
const _protocolFee = protocolFee.times(GAS_PRICE).times(swap.orders.length + 1); // Pay a little more fee than needed.
const mtx = await createMetaTransactionAsync(signedSwapData, _protocolFee);
const relayerEthBalanceBefore = await env.web3Wrapper.getBalanceInWeiAsync(relayer);
const receipt = await zeroEx
.executeMetaTransaction(mtx, mtx.signature)
.awaitTransactionSuccessAsync({ from: relayer, value: mtx.value, gasPrice: GAS_PRICE });
const relayerEthRefund = relayerEthBalanceBefore
.minus(await env.web3Wrapper.getBalanceInWeiAsync(relayer))
.minus(GAS_PRICE.times(receipt.gasUsed));
// Ensure the relayer got back the unused protocol fees.
expect(relayerEthRefund).to.bignumber.eq(protocolFee.times(GAS_PRICE));
// Ensure the relayer got paid mtx fees.
expect(await feeToken.balanceOf(relayer).callAsync()).to.bignumber.eq(mtx.feeAmount);
// Ensure the taker got output tokens.
expect(await outputToken.balanceOf(taker).callAsync()).to.bignumber.eq(swap.minOutputTokenAmount);
// Ensure the maker got input tokens.
expect(await inputToken.balanceOf(maker).callAsync()).to.bignumber.eq(swap.inputTokenAmount);
// Check events.
verifyEventsFromLogs(
receipt.logs,
[
{
taker,
// Only signed calldata should have a nonzero hash.
callDataHash: NULL_BYTES32,
sender: zeroEx.address,
data: NULL_BYTES,
},
],
'TransformerMetadata',
);
});
it('`transformERC20()` can fill RFQT order if calldata is signed', async () => {
const swap = await generateSwapAsync({}, true);
const callDataHash = hexUtils.hash(getSwapData(swap));
const signedSwapData = getSignedSwapData(swap);
const _protocolFee = protocolFee.times(GAS_PRICE).times(swap.orders.length + 1); // Pay a little more fee than needed.
const mtx = await createMetaTransactionAsync(signedSwapData, _protocolFee, 0);
const relayerEthBalanceBefore = await env.web3Wrapper.getBalanceInWeiAsync(relayer);
const receipt = await zeroEx
.executeMetaTransaction(mtx, mtx.signature)
.awaitTransactionSuccessAsync({ from: relayer, value: mtx.value, gasPrice: GAS_PRICE });
const relayerEthRefund = relayerEthBalanceBefore
.minus(await env.web3Wrapper.getBalanceInWeiAsync(relayer))
.minus(GAS_PRICE.times(receipt.gasUsed));
// Ensure the relayer got back the unused protocol fees.
expect(relayerEthRefund).to.bignumber.eq(protocolFee.times(GAS_PRICE));
// Ensure the relayer got paid no mtx fees.
expect(await feeToken.balanceOf(relayer).callAsync()).to.bignumber.eq(0);
// Ensure the taker got output tokens.
expect(await outputToken.balanceOf(taker).callAsync()).to.bignumber.eq(swap.minOutputTokenAmount);
// Ensure the maker got input tokens.
expect(await inputToken.balanceOf(maker).callAsync()).to.bignumber.eq(swap.inputTokenAmount);
// Check events.
verifyEventsFromLogs(
receipt.logs,
[
{
taker,
callDataHash,
sender: zeroEx.address,
data: NULL_BYTES,
},
],
'TransformerMetadata',
);
});
it('`transformERC20()` can fill RFQT order if calldata is not signed but no quote signer configured', async () => {
const swap = await generateSwapAsync({}, true);
const callData = getSwapData(swap);
const callDataHash = hexUtils.hash(callData);
const _protocolFee = protocolFee.times(GAS_PRICE).times(swap.orders.length + 1); // Pay a little more fee than needed.
const mtx = await createMetaTransactionAsync(callData, _protocolFee, 0);
const relayerEthBalanceBefore = await env.web3Wrapper.getBalanceInWeiAsync(relayer);
await zeroEx.setQuoteSigner(NULL_ADDRESS).awaitTransactionSuccessAsync({ from: owner });
const receipt = await zeroEx
.executeMetaTransaction(mtx, mtx.signature)
.awaitTransactionSuccessAsync({ from: relayer, value: mtx.value, gasPrice: GAS_PRICE });
const relayerEthRefund = relayerEthBalanceBefore
.minus(await env.web3Wrapper.getBalanceInWeiAsync(relayer))
.minus(GAS_PRICE.times(receipt.gasUsed));
// Ensure the relayer got back the unused protocol fees.
expect(relayerEthRefund).to.bignumber.eq(protocolFee.times(GAS_PRICE));
// Ensure the relayer got paid no mtx fees.
expect(await feeToken.balanceOf(relayer).callAsync()).to.bignumber.eq(0);
// Ensure the taker got output tokens.
expect(await outputToken.balanceOf(taker).callAsync()).to.bignumber.eq(swap.minOutputTokenAmount);
// Ensure the maker got input tokens.
expect(await inputToken.balanceOf(maker).callAsync()).to.bignumber.eq(swap.inputTokenAmount);
// Check events.
verifyEventsFromLogs(
receipt.logs,
[
{
taker,
callDataHash,
sender: zeroEx.address,
data: NULL_BYTES,
},
],
'TransformerMetadata',
);
});
it('`transformERC20()` cannot fill RFQT order if calldata is not signed', async () => {
const swap = await generateSwapAsync({}, true);
const callData = getSwapData(swap);
const _protocolFee = protocolFee.times(GAS_PRICE).times(swap.orders.length + 1); // Pay a little more fee than needed.
const mtx = await createMetaTransactionAsync(callData, _protocolFee, 0);
const tx = zeroEx
.executeMetaTransaction(mtx, mtx.signature)
.awaitTransactionSuccessAsync({ from: relayer, value: mtx.value, gasPrice: GAS_PRICE });
return expect(tx).to.revertWith(new ZeroExRevertErrors.MetaTransactions.MetaTransactionCallFailedError());
});
});

View File

@@ -9,7 +9,7 @@ import { DummyERC20TokenContract } from '@0x/contracts-erc20';
import { LibMathRevertErrors } from '@0x/contracts-exchange-libs';
import { blockchainTests, constants, describe, expect, toBaseUnitAmount } from '@0x/contracts-test-utils';
import { SignedOrder } from '@0x/order-utils';
import { BigNumber, RevertError } from '@0x/utils';
import { BigNumber, decodeThrownErrorAsRevertError, StringRevertError } from '@0x/utils';
import { DecodedLogArgs, LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
@@ -276,9 +276,9 @@ blockchainTests.resets('Exchange fills dydx orders', env => {
try {
await txPromise.catch();
} catch (e) {
assetProxyError = RevertError.decode(e.values.errorData);
assetProxyError = decodeThrownErrorAsRevertError(e).values.errorData;
}
expect(assetProxyError).to.deep.equal(expectedAssetProxyError);
expect(assetProxyError).to.deep.equal(new StringRevertError(expectedAssetProxyError.encode()));
});
});
});

View File

@@ -97,7 +97,7 @@ export function MakerMixin<TBase extends Constructor>(Base: TBase): TBase & Cons
const [makerToken, makerFeeToken, takerToken, takerFeeToken] = Pseudorandom.sampleSize(
this.actor.deployment.tokens.erc20,
4, // tslint:disable-line:custom-no-magic-numbers
);
)!;
// Maker and taker set balances/allowances to guarantee that the fill succeeds.
// Amounts are chosen to be within each actor's balance (divided by 8, in case
@@ -146,7 +146,7 @@ export function MakerMixin<TBase extends Constructor>(Base: TBase): TBase & Cons
const [leftMakerToken, leftTakerToken, makerFeeToken, takerFeeToken] = Pseudorandom.sampleSize(
this.actor.deployment.tokens.erc20,
4, // tslint:disable-line:custom-no-magic-numbers
);
)!;
const rightMakerToken = leftTakerToken;
const rightTakerToken = leftMakerToken;

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1603851023,
"version": "4.1.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "4.1.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "4.1.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1594788383,
"version": "4.1.7",

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.1.10 - _October 28, 2020_
* Dependencies updated
## v4.1.9 - _October 27, 2020_
* Dependencies updated
## v4.1.8 - _October 21, 2020_
* Dependencies updated
## v4.1.7 - _July 15, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-multisig",
"version": "4.1.7",
"version": "4.1.10",
"engines": {
"node": ">=6.12"
},
@@ -41,29 +41,29 @@
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
"url": "https://github.com/0xProject/protocol.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
"url": "https://github.com/0xProject/protocol/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/multisig/README.md",
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/multisig",
"devDependencies": {
"@0x/abi-gen": "^5.3.1",
"@0x/contracts-asset-proxy": "^3.4.0",
"@0x/contracts-erc20": "^3.2.1",
"@0x/contracts-gen": "^2.0.10",
"@0x/contracts-test-utils": "^5.3.4",
"@0x/contracts-utils": "^4.5.1",
"@0x/dev-utils": "^3.3.0",
"@0x/sol-compiler": "^4.1.1",
"@0x/tslint-config": "^4.1.0",
"@0x/types": "^3.2.0",
"@0x/utils": "^5.5.1",
"@0x/web3-wrapper": "^7.2.0",
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/utils": "^5.6.3",
"@0x/web3-wrapper": "^7.2.4",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "*",
"@types/node": "12.12.54",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
@@ -78,9 +78,9 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.3",
"@0x/typescript-typings": "^5.1.1",
"ethereum-types": "^3.2.0"
"@0x/base-contract": "^6.2.7",
"@0x/typescript-typings": "^5.1.5",
"ethereum-types": "^3.3.3"
},
"publishConfig": {
"access": "public"

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1603851023,
"version": "2.0.17",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "2.0.16",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "2.0.15",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1594788383,
"version": "2.0.14",

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.0.17 - _October 28, 2020_
* Dependencies updated
## v2.0.16 - _October 27, 2020_
* Dependencies updated
## v2.0.15 - _October 21, 2020_
* Dependencies updated
## v2.0.14 - _July 15, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-staking",
"version": "2.0.14",
"version": "2.0.17",
"engines": {
"node": ">=6.12"
},
@@ -45,30 +45,30 @@
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
"url": "https://github.com/0xProject/protocol.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
"url": "https://github.com/0xProject/protocol/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
"devDependencies": {
"@0x/abi-gen": "^5.3.1",
"@0x/contracts-asset-proxy": "^3.4.0",
"@0x/contracts-dev-utils": "^1.3.5",
"@0x/contracts-erc20": "^3.2.1",
"@0x/contracts-exchange-libs": "^4.3.7",
"@0x/contracts-gen": "^2.0.10",
"@0x/contracts-utils": "^4.5.1",
"@0x/dev-utils": "^3.3.0",
"@0x/order-utils": "^10.3.0",
"@0x/sol-compiler": "^4.1.1",
"@0x/ts-doc-gen": "^0.0.22",
"@0x/tslint-config": "^4.1.0",
"@0x/types": "^3.2.0",
"@0x/web3-wrapper": "^7.2.0",
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-dev-utils": "^1.3.8",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-exchange-libs": "^4.3.10",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/order-utils": "^10.4.2",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/web3-wrapper": "^7.2.4",
"@types/lodash": "4.14.104",
"@types/node": "*",
"@types/node": "12.12.54",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
@@ -83,15 +83,15 @@
"solhint": "^1.4.1",
"truffle": "^5.0.32",
"tslint": "5.11.0",
"typedoc": "^0.15.0",
"typedoc": "~0.16.11",
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.3",
"@0x/contracts-test-utils": "^5.3.4",
"@0x/typescript-typings": "^5.1.1",
"@0x/utils": "^5.5.1",
"ethereum-types": "^3.2.0",
"@0x/base-contract": "^6.2.7",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"ethereum-types": "^3.3.3",
"ethereumjs-util": "^5.1.1"
},
"publishConfig": {

Some files were not shown because too many files have changed in this diff Show More