Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

feat: support ExchangeProxy for swap quotes (Swap V1) #262

Merged
merged 45 commits into from
Jul 15, 2020

Conversation

xianny
Copy link
Contributor

@xianny xianny commented Jun 18, 2020

Description

Introduces swap/v1 and preserves old functionality in swap/v0.

Changes:

  • Selling of ERC20 and receiving ETH in v1 is no longer an error but is supported with parameters (isToEth) to the ExchangeProxy.
  • SwapQuoteConsumer exports call data for ExchangeProxy
  • Support RFQT via EP (specify taker address as EP FlashWallet)
  • Support ETH output and input (using EP parameters), removing any Forwarder references
  • Add allowance target to response
  • disabled shouldBatchBridgeOrders (waiting for "on-chain fills without protocol fees" to ship)

Note on versioning
This PR adds paths for V0 and V1 functionality within the code. This approach is less than ideal as code complexity can quickly grow unmanageable. We're doing this as a one-off because V1 does not have significant changes compared to V0. We'll need to revisit our approach for future major version bumps.

Additional context: Technically V1 does not have breaking interface changes from V0 and might not warrant a major version bump. However, one of our integrators who rely on hardcoded contract addresses or users not expecting a new allowance target will have a badd experience. We'll be running V0 and V1 concurrently to support them. Discussion is still open as to how we will approach similar situations in the future.

Testing Instructions

Existing unit tests have been copied and moved swap_test.ts -> swap_v0_test.ts with no meaningful changes. These should still pass.

swap_test.ts has the same tests as before, with one difference. When sellToken=ETH it should return the exchange proxy address instead of the forwarder address as the to field.

Checklist

  • Update documentation as needed. Website Documentation PR:
  • Prefix PR title with [WIP] if necessary.
  • Add tests to cover changes as needed.

This PR now includes Balancer changes from #277
DO NOT MERGE until:

  • BalancerBridge 0x-monorepo#2613 has been approved & merged
  • @0x/asset-swapper and @0x/contract-addresses are updated to non-gitpkg versions, or at least gitpkg publishes that are on the monorepo development branch
  • simbot comparing staging vs prod looks good

@xianny xianny force-pushed the feat/allowance-target branch from ed60524 to 04817eb Compare June 23, 2020 20:32
@xianny xianny changed the title wip - EP allowance target feat: support ExchangeProxy in swap (swap v1) Jun 23, 2020
@xianny xianny changed the title feat: support ExchangeProxy in swap (swap v1) feat: support ExchangeProxy for swap quotes (Swap V1) Jun 23, 2020
@xianny xianny marked this pull request as ready for review June 23, 2020 21:34
@xianny xianny requested a review from dekz June 23, 2020 21:34
@xianny xianny force-pushed the feat/allowance-target branch 2 times, most recently from 24e147b to c0ad8bd Compare June 23, 2020 23:01
@xianny xianny requested a review from dekz June 24, 2020 00:27
@xianny
Copy link
Contributor Author

xianny commented Jun 24, 2020

deploy staging

@xianny xianny force-pushed the feat/allowance-target branch 2 times, most recently from c4f64f2 to d79a170 Compare June 24, 2020 22:27
@dekz dekz force-pushed the feat/allowance-target branch 3 times, most recently from 0a2fad6 to e57bb80 Compare June 25, 2020 04:03
@dekz dekz self-requested a review June 25, 2020 04:47
dekz
dekz previously requested changes Jun 25, 2020
@dekz dekz force-pushed the feat/allowance-target branch from 2a98d3b to 7b443d7 Compare June 25, 2020 06:18
@xianny xianny force-pushed the feat/allowance-target branch 3 times, most recently from 03f92e7 to 7264975 Compare June 25, 2020 17:15
@xianny xianny requested review from dekz and dorothy-zbornak June 25, 2020 17:33
@xianny
Copy link
Contributor Author

xianny commented Jun 25, 2020

deploy staging

Copy link
Contributor

@dorothy-zbornak dorothy-zbornak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good!

@dekz dekz requested a review from dorothy-zbornak June 26, 2020 07:57
@dekz dekz dismissed their stale review June 26, 2020 07:57

outdated

@dekz dekz force-pushed the feat/allowance-target branch from 324e35b to 1d0235f Compare June 26, 2020 08:59
@dekz
Copy link
Member

dekz commented Jul 9, 2020

deploy staging

@xianny xianny force-pushed the feat/allowance-target branch from f4ef0a1 to 37cccb2 Compare July 10, 2020 21:41
@xianny
Copy link
Contributor Author

xianny commented Jul 10, 2020

deploy staging

@moodlezoup moodlezoup force-pushed the feat/allowance-target branch from 09baeb2 to 1967bfc Compare July 11, 2020 01:48
@moodlezoup
Copy link
Contributor

deploy staging

@moodlezoup
Copy link
Contributor

deploy staging

@moodlezoup
Copy link
Contributor

deploy staging

@dekz
Copy link
Member

dekz commented Jul 15, 2020

deploy staging

@dekz dekz force-pushed the feat/allowance-target branch from 5e8955e to feaf5d4 Compare July 15, 2020 09:24
@dekz dekz force-pushed the feat/allowance-target branch from 2dfe8cb to fb9b8d9 Compare July 15, 2020 10:33
@dekz
Copy link
Member

dekz commented Jul 15, 2020

Realized prices

image

Revert rate

image

Response time

image

@dekz
Copy link
Member

dekz commented Jul 15, 2020

deploy staging

@dekz
Copy link
Member

dekz commented Jul 15, 2020

Typescript 3.9.6 update + crazy market conditions

Response time

image

Realized Price

image

@dekz dekz merged commit 3415d63 into master Jul 15, 2020
@dekz dekz deleted the feat/allowance-target branch July 15, 2020 22:07
@dekz
Copy link
Member

dekz commented Jul 15, 2020

deploy production

github-actions bot pushed a commit that referenced this pull request Jul 20, 2020
# [1.11.0](v1.10.2...v1.11.0) (2020-07-20)

### Features

* support ExchangeProxy for swap quotes (Swap V1) ([#262](#262)) ([3415d63](3415d63)), closes [#268](#268) [#269](#269) [#282](#282)
* Updates BZRX token address to new BZRX token ([#279](#279)) ([8032d96](8032d96))
@github-actions
Copy link

🎉 This PR is included in version 1.11.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants