Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

asset-swapper: Exchange Proxy support #2591

Merged
merged 15 commits into from
Jun 12, 2020

Conversation

dorothy-zbornak
Copy link
Contributor

@dorothy-zbornak dorothy-zbornak commented Jun 1, 2020

Description

This adds a new swap quote consumer to asset-swapper, ExchangeProxySwapQuoteConsumer, which can generate call data for the Exchange Proxy's transformERC20() function.

ExchangeProxySwapQuoteConsumer.getCallDataOrThrowAsync() can accept an options object:

{
  extensionContractOpts: {
    // Whether to accept ETH and automatically wrap it to WETH prior to fill.
    isFromETH: boolean;
    // Whether to unwrap WETH to ETH after the fill.
    isToETH: boolean;
  }
}

The CalldataInfo struct returned by getCallDataOrThrowAsync() from all consumers now has an allowanceTarget field.

Odds and Ends

  • Pinned @0x/instant's @0x/asset-swapper dependency to the old version to avoid constantly breaking instant.
  • Added transformer data decoding utils to @0x/contracts-zero-ex.
  • Add ITransformERC20 contract artifacts/wrappers where necessary.
  • Added placeholder EP addresses to ContractAddresses. None of this stuff is deployed so they're all NULL for now.
  • Fix @0x/contracts-broker tests and add them to CI.
  • Allow for identifiers prefixed with underscores in python contract wrappers.

Testing instructions

Types of changes

Checklist:

  • Prefix PR title with [WIP] if necessary.
  • Add tests to cover changes as needed.
  • Update documentation as needed.
  • Add new entries to the relevant CHANGELOG.jsons.

@dorothy-zbornak dorothy-zbornak force-pushed the feat/asset-swapper/exchange-proxy-support branch from a4dc11b to c4d89d6 Compare June 1, 2020 19:29
@dorothy-zbornak dorothy-zbornak marked this pull request as ready for review June 1, 2020 19:30
@coveralls
Copy link

coveralls commented Jun 1, 2020

Coverage Status

Coverage decreased (-0.03%) to 79.658% when pulling 7cf9630 on feat/asset-swapper/exchange-proxy-support into ecfbd62 on feat/contracts-zero-ex/0x-api-erc20-transformers.

@dorothy-zbornak dorothy-zbornak force-pushed the feat/asset-swapper/exchange-proxy-support branch from c4d89d6 to 6ef4a54 Compare June 1, 2020 20:00
@dorothy-zbornak dorothy-zbornak requested a review from feuGeneA as a code owner June 2, 2020 05:11
@dorothy-zbornak dorothy-zbornak force-pushed the feat/asset-swapper/exchange-proxy-support branch from fc86835 to 7cf9630 Compare June 2, 2020 05:25
@@ -44,7 +44,7 @@
"homepage": "https://github.com/0xProject/0x-monorepo/packages/instant/README.md",
"dependencies": {
"@0x/assert": "^3.0.7",
"@0x/asset-swapper": "^4.4.0",
"@0x/asset-swapper": "4.4.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

🧷

Base automatically changed from feat/contracts-zero-ex/0x-api-erc20-transformers to development June 3, 2020 18:09
@dorothy-zbornak dorothy-zbornak requested a review from dekz June 3, 2020 18:18
@dorothy-zbornak dorothy-zbornak force-pushed the feat/asset-swapper/exchange-proxy-support branch from 7cf9630 to 1a1a777 Compare June 8, 2020 01:33
transformer: this.contractAddresses.transformers.wethTransformer,
data: encodeWethTransformerData({
token: ETH_TOKEN_ADDRESS,
amount: quote.worstCaseQuoteInfo.totalTakerAssetAmount,
Copy link
Member

Choose a reason for hiding this comment

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

This could also technically be MAX_UINT256 as well right? As it's defined as what is actually sent in value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, because we don't want to wrap the protocol fee.

@dorothy-zbornak dorothy-zbornak force-pushed the feat/asset-swapper/exchange-proxy-support branch 4 times, most recently from 033c434 to 2c371d0 Compare June 9, 2020 20:50
`@0x/asset-swapper`: Fix ETH not being passed as the token to `transformERC20()`.
`@0x/contract-addresses`: Add `exchangeProxyGovernor`.
`@0x/contract-addresses`: Add deployed EP addresses.
`@0x/migrations`: Add `exchangeProxyGovernor`.
@dorothy-zbornak dorothy-zbornak force-pushed the feat/asset-swapper/exchange-proxy-support branch from ba13de8 to 0b6bcf6 Compare June 12, 2020 04:00
@dorothy-zbornak dorothy-zbornak merged commit 4fced27 into development Jun 12, 2020
@dorothy-zbornak dorothy-zbornak deleted the feat/asset-swapper/exchange-proxy-support branch June 12, 2020 05:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants