39 Commits

Author SHA1 Message Date
Daniel Pyrathon
df055e1958
fix: Added fee parameter to Quote Requestor (#235)
* Added changes

* Fixes

* Applied PR feedback

* lint fix
2021-05-11 12:57:51 -04:00
Daniel Pyrathon
a019bb913d
only set Last Look parameter if it's explicitly set (#200)
* only set Last Look parameter if it's explicitly set

* remove expoectation of having isLastLook
2021-04-14 16:38:55 -07:00
phil-ociraptor
70ddab0231
[MKR-3] Prepare Asset Swapper for RFQM (#187)
* Prepare QuoteRequestor for RFQM

* Add unit tests for Quote Requestor changes

* Fix lint errors
2021-03-31 12:11:10 -05:00
Alex Kroeger
24397c51a8
improve logging for alt rfq request (#158)
* improve logging for alt rfq request

* clean up unsuccessful status code logic

* Fix quote requestor tests

* get rid of unnecessary promise handling

* remove unused code

* update changelog

* changed warning message for no quote

* appease prettier
2021-03-24 13:45:54 -07:00
phil-ociraptor
06b3464756
Rename {Rfqt=>Rfq} for types in Asset Swapper (#179)
* Rename {Rfqt=>Rfq} for types in Asset Swapper

* PR edit 1 - fix build errors

* PR edit 2 - rename mocked types used in tests

* PR edit 3 - fix broken test build

* PR edit 4 - rename SwapQuoterRfqOpts and add changelog entry
2021-03-23 17:21:50 -05:00
phil-ociraptor
bbaa90bd9a
Add a cancel token to manually enforce a timeout in Quote Requestor (#176)
* Add a cancel token to manually enforce a timeout in Quote Requestor

* Start setTimeout before making requests, add an extra buffer

* Run prettier

* Add comment to changelog
2021-03-22 17:08:51 -05:00
Oskar Paolini
f3ca4293bc
feat: add proxy configuration to axios instance in RFQT asset-swapper (#159)
* add proxy configuration to axios instance

* add support for additional axios instance opts

* move quoteRequestorHttpClient parameter

* fix tests, build errors

* prettier

* bump axios

* bumped mock-axios-adapter version

* downgrade axios again

* re-upgrade axios 🤦

* updated yarn.lock

* updated changelog

Co-authored-by: Alex Kroeger <alexrkroeger@gmail.com>
2021-03-03 11:38:54 -08:00
Alex Kroeger
514f9d2621
feat/alt RFQ MM implementation (#139)
* baseline adapter code [WIP]

* fixed adapter logic, quote_requester instantiation

* modified quote-requestor test to include alt implementation

* type changes, fixes to quote requestor test

* small fixes

* working tests, made alt utils more readable

* lint errors

* added alt indicative quote tests, minor fixes

* export alt MM market offering types

* altered alt market offering to have id instead of symbols

* addressed minor comments

* updated changelog

* got rid of unnecessary, large if-block, fixed the buy-sell assignment to be from the MM's perspective

* extra logging for debugging

* fixed existingOrder size

* get rid of only flag on test, get rid of extra logging

* prettier
2021-02-22 16:07:30 -08:00
Jacob Evans
3f4bb933d1
feat: v4 final (#136)
* v4 FillQuoteTransformer (#104)

* Update FQT to support v4 orders

* `@0x/contracts-zero-ex`: Tweak FQT
`@0x/contracts-zero-ex`: Drop `ERC20BridgeTransfer` event and add `PartialQuoteFill` event.

* `@0x/contracts-utils`: Add `LibSafeMathV06.downcastToUint128()`

* `@0x/protocol-utils`: Update transformer utils for V4 FQT

* `@0x/contracts-zero-ex`: Fixing FQT tests...

* `@0x/contracts-zero-ex`: rename FQT bridge event

* `@0x/contracts-zero-ex`: Un-`only` tests

* `@0x/migrations`: Update `BridgeAdapter` deployment

* `@0x/contracts-integrations`: Delete `mtx_tests`

* `@0x/protocol-utils`: Address review comments

* `@0x/contracts-zero-ex`: Address review comments

* `@0x/migrations`: Update migrations

Co-authored-by: Michael Zhu <mchl.zhu.96@gmail.com>
Co-authored-by: Lawrence Forman <me@merklejerk.com>

* v4: Asset-swapper (main branch) (#113)

* refactor quote_requestor

* WIP v4/asset-swapper: Clean up SwapQuoter and remove @0x/orderbook

* Start replacing SignedOrder everywhere

* wip: new order type

* wip

* remove order-utils from most places

* hack: Play around with VerboseX types (#119)

* hack: Play around with VerboseX types

* More hacks

* Fix up the bridgeData encodings

* Rework Orderbook return type

* feat: Don't charge a protocol fee for RFQ orders WIP (#121)

* fix simple build errors

* simplify types a little

* remove SwapQuoteCalculator: unnecessary abstraction

* Fix all ./src build errors; make types consistent

* export more types for use in 0x API; modify Orderbook interface

* stop overriding APIOrder

* feat: RFQ v4 + consolidated bridge encoders (#125)

* feat: check if taker address is contract

* Rework bridge data

* Worst case adjustments

* RFQT v4

* Future/v4 validate orders (#126)

* RFQT v4

* v4 validate native orders

* use default invalid signature

* refactor rfqt validations in swap quoter

* fix types

* fix RFQT unlisted api key

* remove priceAwareRFQFlag

* adjust maker/taker amounts

* update JSON schemas

* filter zero fillable orders

Co-authored-by: xianny <xianny@gmail.com>

* fix type export

Co-authored-by: xianny <xianny@gmail.com>

* remove order-utils as much as possible

* work on tests compile

* Comment out quote reporter test

* updated tests

* restore order-utils accidental changes

* some lints

* Remove old fill_test

* ts lint disable for now

* update quote report

* Re-enable quote report tests

* make fill data required field

* fix lint

* type guards

* force fillData as required

* fix lint

* fix naming

* exports

* adjust MultiBridge by slippage

* cleanups (checkpoint 1)

* cleanup types (checkpoint #2)

* remove unused deps

* `@0x/contract-addresses`: Deploy new FQT (#129)

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

* commit bump to republish

* DRY up the rfqt mocker

* fix: Balancer load top pools (#131)

* fix: Balancer load top 250 pools

* refetch top pools on an interval

Co-authored-by: Jacob Evans <jacob@dekz.net>
Co-authored-by: Kim Persson <kimpers@users.noreply.github.com>
Co-authored-by: Lawrence Forman <lawrence@0xproject.com>
Co-authored-by: Lawrence Forman <me@merklejerk.com>

* Update post rebase

* prettier

* Remove test helpers exported in asset-swapper

* Clean up from review comments

* prettier

* lint

* recreate rfqt mocker

* change merge and INVALID_SIGNATURE

Co-authored-by: Lawrence Forman <lawrence@0xproject.com>
Co-authored-by: Michael Zhu <mchl.zhu.96@gmail.com>
Co-authored-by: Lawrence Forman <me@merklejerk.com>
Co-authored-by: Xianny <8582774+xianny@users.noreply.github.com>
Co-authored-by: Kim Persson <kimpers@users.noreply.github.com>
2021-02-10 19:20:15 +10:00
Daniel Pyrathon
a7a905de4c
fix: Upgrade quote server and Asset Swapper types (and specify protocol ve… (#108)
* Upgrade quote server and Asset Swapper types (and specify protocol version in API requests)

* add package and lockfile

* fix tests
2021-01-13 17:07:45 -08:00
F. Eugene Aumson
05b25c6229
Ran prettier 2020-10-14 13:02:17 -04:00
Daniel Pyrathon
221de054f4 fixes a few issues with the typing 2020-10-07 19:34:12 -07:00
Daniel Pyrathon
efef5f122f added fix 2020-10-05 17:24:23 -07:00
Daniel Pyrathon
9e42dce5c4 added initial implementation 2020-10-01 14:28:36 -07:00
Daniel Pyrathon
25a3c18bfe fixed small test bug 2020-08-10 17:59:37 -07:00
Daniel Pyrathon
7cd30610f9 fixed tests 2020-08-10 16:33:42 -07:00
Daniel Pyrathon
4e030ce1e8 remove legacy taker request 2020-06-19 15:07:39 -07:00
Steve Klebanoff
2507ad274b
remove BigNumbers from expectedParams 2020-06-19 14:42:45 -07:00
F. Eugene Aumson
b8cc164af1
asset-s: rm refs to quoteExpiry for RFQT tests
Addresses review comment https://github.com/0xProject/0x-monorepo/pull/2582#discussion_r441836846
2020-06-17 17:29:35 -04:00
F. Eugene Aumson
ad868af96e
asset-swapper: use RFQT-specific response types
@0x/quote-server was recently updated to offer RFQT- and RFQM-specific
types, in addition to abstracted types.  Since everything here is RFQT
specific, usage has been changed to use those specific types.

Addresses review comments
https://github.com/0xProject/0x-monorepo/pull/2582#discussion_r437623138
and
https://github.com/0xProject/0x-monorepo/pull/2582#discussion_r437625305
2020-06-11 15:57:49 -04:00
F. Eugene Aumson
f7cd7110ea
asset-s: Remove erroneous addition of API key
It was added due to the introduction of the use of the TakerRequest type
from @0x/quote-server, as it's included in that structure.  However,
that structure is primarily used within the quote server as the output
of parameter parsing, and that parsing routine transforms the API key
HEADER from the request into the TakerRequest type.  In short, the API
key is input as a header, not a parameter.

Addresses review comment
https://github.com/0xProject/0x-monorepo/pull/2582#discussion_r437624647
2020-06-11 14:17:45 -04:00
F. Eugene Aumson
f7a414bc29
asset-s/RFQ: adapt to renamed TakerRequest fields 2020-05-26 15:24:42 -04:00
F. Eugene Aumson
e05cd1d66b
asset-s/QuoteRequestor: use TakerRequest type 2020-05-26 15:24:38 -04:00
F. Eugene Aumson
b9984b6df4
asset-swapper: fix bug: bad maker response throws
Formerly, a maker sending back a non-JSON was causing an exception to be
thrown.
2020-05-15 01:20:30 -04:00
F. Eugene Aumson
9c11835fee
asset-s: use @0x/quote-server, not local typedefs 2020-05-15 01:20:29 -04:00
F. Eugene Aumson
8a14b4afff
asset-swapper: clarify comment
This comment recently got moved from one context to another.  In the old
context, the whole comment made sense, but in the new context it needed
paring down.
2020-05-06 13:24:20 -04:00
F. Eugene Aumson
2922ebd095
asset-s/test: stop unnecessarily priming mock
Addresses review comment 93bdaba8ee (r419774170)
2020-05-05 17:17:47 -04:00
F. Eugene Aumson
38781807cd
asset-s: simplify test util usage 2020-05-05 12:53:31 -04:00
F. Eugene Aumson
c046943269
asset-s: fix bug: expiry is BigNumber, not string 2020-05-05 12:43:41 -04:00
F. Eugene Aumson
ae5421f76e
asset-s: Use expiryBufferMs to filter RFQ-T quotes 2020-04-29 17:24:51 -04:00
F. Eugene Aumson
a2e2b429d5
asset-s: exclude RFQ-T orders w/ bad takerAddress 2020-04-29 17:24:42 -04:00
F. Eugene Aumson
93bdaba8ee
asset-s: skip RFQT makers not supporting reqd pair
Skip querying an RFQ-T maker for a quote when the requested asset pair
isn't supported by that maker.
2020-04-29 17:23:10 -04:00
F. Eugene Aumson
4bcc4b3cf8
asset-s: relay expiration time in indicative quote 2020-04-29 15:45:35 -04:00
F. Eugene Aumson
8875f924b0
asset-s: test requestRfqtIndicativeQuotesAsync 2020-04-20 22:56:44 -04:00
F. Eugene Aumson
464c918134
asset-swapper: test RFQT indicative quote handling 2020-04-20 22:56:43 -04:00
F. Eugene Aumson
d6d4d29257
asset-swapper: RFQ-T indicative quotes
These changes have been exercised via mocha tests in the 0x-api repo.

Not sure why I had to add GetMarketOrdersRfqtOpts to the package
exports.  `yarn test:generate_docs:circleci` said:

$ node ./packages/monorepo-scripts/lib/doc_generate.js --package @0x/asset-swapper
GENERATE_DOCS: Generating Typedoc JSON for @0x/asset-swapper...
GENERATE_DOCS: Generating Typedoc Markdown for @0x/asset-swapper...
GENERATE_DOCS: Modifying Markdown To Exclude Unexported Items...
Error: @0x/asset-swapper package needs to export:
GetMarketOrdersRfqtOpts
From it's index.ts. If any are from external dependencies, then add them to the EXTERNAL_TYPE_MAP.
    at DocGenerateUtils._lookForMissingReferenceExportsThrowIfExists (/root/repo/packages/monorepo-scripts/lib/utils/doc_generate_utils.js:288:19)
    at DocGenerateUtils.<anonymous> (/root/repo/packages/monorepo-scripts/lib/utils/doc_generate_utils.js:255:34)
    at step (/root/repo/packages/monorepo-scripts/lib/utils/doc_generate_utils.js:32:23)
    at Object.next (/root/repo/packages/monorepo-scripts/lib/utils/doc_generate_utils.js:13:53)
    at fulfilled (/root/repo/packages/monorepo-scripts/lib/utils/doc_generate_utils.js:4:58)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
2020-04-17 02:34:36 -04:00
F. Eugene Aumson
957e3eb93c
asset-swapper: Restructure RFQ-T request options
There's one subtlety here: apiKey has been moved to be within the rfqt
namespace, after talking to Fabio and discovering that he only needs to
re-use the API key in 0x API, not in asset-swapper.
2020-04-17 01:18:07 -04:00
Steve Klebanoff
47ef7fffce
RFQ-T: validate assetData & add more tests (#2552)
* test for returning a 200 with invalid data, and additonal logging for that case

* Ensure RFQ-T response has asset data we expect

* validate signed order schema

* give more descriptive variable names and test an unsigned order

* takeout unused var
2020-04-15 00:11:37 -04:00
Steve Klebanoff
84adbcb683
asset-swapper: Mockable axios for QuoteRequestor (#2549)
* Mockable axios for QuoteRequestor

* Move RFQT Mocker to src

* move MockedRfqtFirmQuoteResponse into types file

* fix import
2020-04-10 23:09:56 -04:00