48 Commits

Author SHA1 Message Date
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
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
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
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
Steve Klebanoff
ca2aa72e0f
Merge development 2020-07-23 15:17:35 -07:00
Steve Klebanoff
6e4e313792
Merge branch 'development' into feature/new-order-reporter-merged 2020-07-22 23:50:28 -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
mzhu25
ff9c9241d8
BalancerBridge (#2613)
* Add BalancerBridge and Sampler functions

* Update sampler artifacts/wrappers

* Add Balancer support to AssetSwapper + related refactoring

* Make use of GraphQL instead of sampler

* "fix" build and add mainnet BalancerBridge tests

* address some comments

* add balancer cache and fix DexSampler tests

* lint

* wip: tests for balancer sampler ops

* Fix market operation utils test

* balancer unit tests

* Return a buy quote of 0 if the buy amount exceeds the Balancer pool's balance

* Dynamic fee estimation

* Update contract addresses, export BalancerBridge wrapper

* Update changelogs

* Fix bugs discovered via simbot

* Fix issues in balancer_utils

* override `BigNumber.config` in configured_bignumber.ts

* Special case Balancer subops in  too

* Address some more comments

* Address Balancer performance issue

* Performance improvements

* Address comment

* Fix tests

Co-authored-by: xianny <xianny@gmail.com>
2020-07-14 19:18:50 -07:00
Steve Klebanoff
120714ecfc
linting and remove unused function 2020-07-08 15:49:42 -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
Michael Zhu
44262bf747 MultiBridge support in AssetSwapper 2020-06-11 11:14:48 -07:00
Xianny
0fbbabe208
Add Uniswap V2 support to @0x/asset-swapper (#2599)
* add uniswapV2

* update changelogs

* remove unused import

* add tests for Uniswap V2 ETH

* rename UniswapV2 and UniswapV2Eth

* use correct token address path

* update contract addresses after deploy
2020-06-11 10:23:50 -07:00
Jacob Evans
fb0311e675
feat: ERC20BridgeSampler Unlock Kyber collisions (#2575)
* feat: ERC20BridgeSampler Unlock Kyber collisions

* Updated fallback strategy

* Address comments

* Eth2Dai hop sampler

* Update packages/asset-swapper/src/utils/market_operation_utils/index.ts

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

* Set DFB expiry to 2hr

Co-authored-by: Lawrence Forman <lawrence@0xproject.com>
2020-05-07 07:56:03 +10:00
Jacob Evans
b34edcbf87
[asset-swapper] clip native fill data (#2565)
* [asset-swapper] clip native fill data

* Test for createFillPaths

* CHANGELOG
2020-04-25 08:44:48 +10:00
Jacob Evans
6063854d06
Add Curve sUSD (#2563) 2020-04-24 07:06:36 +10:00
Jacob Evans
cac6f5234f
Collapse on-chain sources into DexForwarderBridge (#2560)
* Collapse on-chain sources into DexForwarderBridge

* Fix tests. CHANGELOG
2020-04-23 13:12:46 +10:00
Jacob Evans
a458e81f8d
ERC20BridgeSampler: Additional Buy support (#2551)
* ERC20BridgeSampler: Sample Curve Buy

* Fake Buy Kyber/PLP

* Deploy mainnet

* Add Kyber rates for buy tests

* CHANGELOGs

* Provide maxIterations and targetSlippage as options

* Cleanup ERC20BridgeSampler for re-use

* Redeploy Mainnet Kovan

* Feedback fixes

* Handle OOG/revert 0s

* Redeploy Mainnet refactor
2020-04-21 13:26:12 +10:00
Jacob Evans
0e196a59d9
Always use DFB in asset-swapper (#2542)
* Always use DFB in asset-swapper

* Clean up
2020-04-09 15:52:15 +10:00
Lawrence Forman
fafaa3e69b @0x/asset-swapper: Lint and remove @0x/contracts-asset-proxy dep. 2020-04-07 12:35:18 -04:00
Lawrence Forman
d19bb3de8d @0x/asset-swapper: Run prettier 2020-04-07 12:35:18 -04:00
Lawrence Forman
da1e9c2d97 @0x/asset-swapper: Add DFB support + refactor swap quote calculation utils 2020-04-07 12:35:18 -04:00
Lawrence Forman
37597eca75 @0x/asset-swapper: Fix getPathSize() and getAdjustedPathSize() bug.
`@0x/asset-swapper`: Add `maxFallbackSlippage` option.
2020-03-10 14:25:13 -04:00
Lawrence Forman
05bf55dca8 @0x/asset-swapper: Add gasSchedule option to SwapQuoter.
`@0x/asset-swapper`: Rename `fees` `SwapQuoter` option to `feeSchedule`.
2020-03-09 22:33:33 -04:00
Lawrence Forman
cc12ad8d86 @0x/asset-swapper: Only generate fallbacks for native orders in optimal path.
`@0x/asset-swapper`: Exclude conflicting sources across both optimal and fallback paths.
2020-03-09 21:44:30 -04:00
Lawrence Forman
8179a964ea @0x/asset-swapper: Reintroduce runLimit option.
`@0x/asset-swapper`: Make native fills one single path.
`@0x/asset-swapper`: Redo the optimizer algo again to be more thorough.
`@0x/asset-swapper`: Make `getMedianSellRate()` return `1` if maker token == taker token.
2020-03-09 21:44:30 -04:00
Lawrence Forman
d0805d4bbb @0x/asset-swapper: Rebase and fix some minor bugs. 2020-03-09 21:44:29 -04:00
Lawrence Forman
6ccadcb928 @0x/asset-swapper: Refactor market op utils.
`@0x/asset-swapper`: add fallback orders.
`@0x/asset-swapper`: Remove `noConflicts` and `dustThreshold` options.
`@0x/asset-swapper`: Add `allowFallback` option.
2020-03-09 21:44:29 -04:00
Daniel Pyrathon
dbc5c0d5d8 moved unit tests to the appropriate sections 2020-03-05 16:29:34 -08:00
Daniel Pyrathon
fa886aa849 prettify and lint 2020-03-05 16:21:15 -08:00
Daniel Pyrathon
61f03b0ea2 invert maker and taker token variable 2020-03-05 16:07:10 -08:00
Daniel Pyrathon
59091896b4 Merge branch 'development' of github.com:0xProject/0x-monorepo into feature/plp-integration
# Conflicts:
#	packages/asset-swapper/package.json
#	packages/asset-swapper/src/utils/market_operation_utils/sampler.ts
#	packages/asset-swapper/src/utils/market_operation_utils/types.ts
#	packages/asset-swapper/test/market_operation_utils_test.ts
2020-03-04 14:11:17 -08:00
Daniel Pyrathon
99dc4b8e07 refactor more code 2020-03-04 08:17:01 -08:00
Daniel Pyrathon
807904bb86 addressed PR comments 2020-03-04 07:59:09 -08:00
Jacob Evans
ea1528aea6
[asset-swapper] Add latest BUSD Curve (#2506)
* [asset-swapper] Add latest BUSD Curve

* Update Compound Curve
2020-03-03 17:53:35 +11:00
Daniel Pyrathon
82de5adbe9 refactored sampler operations into a single external file 2020-03-02 10:06:43 -08:00
Daniel Pyrathon
7495ac8111 performed a rename 2020-02-28 16:54:05 -08:00
Daniel Pyrathon
9d2aef5006 Added linting and prettifying 2020-02-28 12:36:47 -08:00
Daniel Pyrathon
bcc3e5ebb0 refactor tests, and add more tests 2020-02-28 12:28:09 -08:00
Daniel Pyrathon
e5df51a83a tidy up tests, add other tests 2020-02-28 12:12:58 -08:00
Daniel Pyrathon
7181be8768 added more unit tests, reinforced existing tests, added more implementation 2020-02-28 10:02:18 -08:00
Lawrence Forman
0f1c15a6ca
Asset-Swapper: Incorporate fees into fill path optimization (#2481)
* `@0x/asset-swapper`: Incorporate fees into fill optimization.

* `@0x/asset-swapper`: Address review comments.

* `@0x/asset-swapper`: Rebase and update tests for curve.

* `@0x/asset-swapper`: Bring back a form of native order pruning.
`@0x/asset-swapper`: Bring back dust thresholds.
`@0x/asset-swapper`: Avoid calling `getMedianSellRate()` if output token is ETH.

* Update devdoc for `fees` option

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2020-02-25 14:47:33 +11:00
Jacob Evans
e05a03a842
Curve ERC20Bridge (#2480)
* Curve ERC20Bridge

* ERC20BridgeSampler Curve (#2483)

* ERC20Sampler Curve

* Use Bridge Sources for each Curve

* Support multiple versions of the Curve contract

* CHANGELOG and redeployed Curve (mainnet)

* Fix Market ops utils test

* Added Curve DAI USDC USDT TUSD

* Bump sampler gas limit default

* Decode the Curve in tests

* Disable Curve in Buy tests

* blockchainTests.fork.resets Curve and Sampler
2020-02-15 17:02:19 +11:00
Lawrence Forman
11fd4506ac @0x/asset-swapper: Fix failing asset-swapper test. 2020-02-11 12:07:48 -07:00
Lawrence Forman
0c9c68030e @0x/asset-swapper: Use batchCall() version of the ERC20BridgeSampler contract 2020-02-11 12:07:48 -07:00
Lawrence Forman
7f56091fbd
@0x/asset-swapper: Add exponential sampling, exposed by sampleDistributionBase.
`@0x/asset-swapper`: Disable ethgasstation polling in tests.
`@0x/asset-swapper`: Tweak default hyper parameters to be friendlier to big fills.
2020-01-20 13:30:57 +10:00
Lawrence Forman
0571a96cea
Fix asset-swapper bugs and misc improvements. (#2406)
* `@0x/contracts-erc20-bridge-sampler`: Add gas limits to external quote calls.
`@0x/contract-addresses`: Point `erc20BridgeSampler` to new version.

* `@0x/asset-swapper`: Ignore zero sample results from the sampler contract.
`@0x/asset-swapper`: Allow skipping Uniswap when dealing with low precision amounts with `minUniswapDecimals` option.
`@0x/asset-swapper`: Increase default `runLimit` from `1024` to `4096`.
`@0x/asset-swapper`: Increase default `numSamples` from `8` to `10`
`@0x/asset-swapper`: Fix ordering of optimized orders.
`@0x/asset-swapper`: Fix best and worst quotes being reversed sometimes.
`@0x/asset-swapper`: Fix rounding of quoted asset amounts.

* `@0x/contracts-utils`: Add kovan addresses to `DeploymentConstants`.
`@0x/contract-addresses`: Add kovan `ERC20BridgeSampler` address.

* `@0x/asset-swapper`: Change default `minUniswapDecimals` option from 8 to 7.

* `@0x/contracts-erc20-bridge-sampler`: Fix changelog.

* `@0x/asset-swapper`: Revert uniswap decimals fix.

* `@0x/asset-swapper`: Undo bridge slippage when computing best case quote.

* `@0x/asset-swapper`: Take asset data from input orders instead of output orders in quote result calculation.

* `@0x/asset-swapper`: Move `SAMPLER_CONTRACT_GAS_LIMIT` constant to `market_operation_utils/constants`.

* Compare equivalent asset data

* Fix redundant zero check

* Update CHANGELOG

* Set fee amount in fillable amounts test

Co-authored-by: Jacob Evans <dekz@dekz.net>
2020-01-03 23:21:39 -05:00
Lawrence Forman
994908549d Asset-swapper aggregator utils (#2353)
* `@0x/asset-swapper`: Add ERC20Bridge aggregator library.

* `@0x/asset-swapper`: Finish off `aggregate.ts`.

* `@0x/types`: Add `OrderWithoutDomain` type.

* `@0x/asset-swapper`: Add testing infra for sampler/aggregator.

* `@0x/types`: Add `SignedOrderWithoutDomain` type.

* `@0x/asset-swapper`: Update aggregator to take and return orders with signatures.

* `@0x/asset-swapper`: Fix broken aggregator tests.

* `@0x/asset-swapper`: Pass the sampler contract into aggregator entry points.

* `@0x/contract-artifacts`: Add `IERC20BridgeSampler` artifact.

* `@0x/contract-wrappers`: Add `IERC20BridgeSampler` wrapper.

* `@0x/asset-swapper`: Address review comments.

* fixed testing

* refactored aggregate.ts and embeded into asset-swapper

* added adjusted rates for taker and maker fees

* remove PrunedSignedOrders

* updated contract-addresses and addressed some other todos

* streamlined logic

* patched in lawrences changes

* renamed aggregator utils and removed market_utils.ts

* added ack heartbeats

* fixed bug

* patches

* added dummy order things

* Dummy with valid sig

* Tweak gas price calculation to wei

* added test coverage and fixed bugs

* fixed migrations

* Fix CHANGELOGs and types export

* Deploy latest ERC20BridgeSampler on Mainnet

* `@0x/types` Revert CHANGELOG.

* `@0x/asset-swapper`: Address review comments.
`@0x/contract-addresses`: Make kyber lowercase.

* made protocol fee multiplier async

* `@0x/asset-swapper: Fix build errors and do some code cleanup.

* use assetDataUtils where possible
2019-12-16 12:35:58 -08:00