Commit Graph

35 Commits

Author SHA1 Message Date
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