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

feat: ethToInputRate cost routing#315

Merged
dekz merged 1 commit intomasterfrom
feat/ethToInputRate
Aug 10, 2020
Merged

feat: ethToInputRate cost routing#315
dekz merged 1 commit intomasterfrom
feat/ethToInputRate

Conversation

@dekz
Copy link
Copy Markdown
Member

@dekz dekz commented Aug 10, 2020

Description

0xProject/0x-monorepo#2660

Certain edgecase scenarios can exist when the liquidity only lives on 0x Native and an ethToMakerRate cannot be determined on-chain.

Without an ethToMakerRate all fills are considered free and many native orders can be filled costing a pretty penny.

Simulations

Sell - pause-perpetual-cave
Buy - facilitate-tender-number

Staging v Prod

Previous

{
  "price": "4.000561",
  "guaranteedPrice": "4",
  "to": "0x61935cbdd02287b511119ddb11aeb42f1593b7ef",
  "value": "21000000000000000",
  "gas": "540000",
  "estimatedGas": "450000",
  "gasPrice": "100000000000",
  "protocolFee": "21000000000000000",
  "minimumProtocolFee": "21000000000000000",
  "buyAmount": "400056104000000000000",
  "sellAmount": "100000000",
  "estimatedGasTokenRefund": "0",
  "orders": [
    {
      "chainId": 1,
      "exchangeAddress": "0x61935cbdd02287b511119ddb11aeb42f1593b7ef",
      "makerAddress": "0xfeeea80c14f72afab75b9a6b1de4bdc937698760",
      "takerAddress": "0x0000000000000000000000000000000000000000",
      "feeRecipientAddress": "0x86003b044f70dac0abc80ac8957305b6370893ed",
      "senderAddress": "0x0000000000000000000000000000000000000000",
      "makerAssetAmount": "100000000000000000",
      "takerAssetAmount": "17983",
      "makerFee": "0",
      "takerFee": "0",
      "expirationTimeSeconds": "1597046685",
      "salt": "88965588553736697469828576928021009333498078927358510056009262835927520468329",
      "makerAssetData": "0xf47261b000000000000000000000000072783301f79df7df1dc2225299d959c4cabe8986",
      "takerAssetData": "0xf47261b0000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "makerFeeAssetData": "0x",
      "takerFeeAssetData": "0x",
      "signature": "0x1c1ad34ec85edb1b3749f7896243ffed9b314d538eee3449d8a54057e6805e2fb2416d40502e8518db8a15d7d65ba05a92c944d8c800614262da5c54894400e77202"
    },
    {
      "chainId": 1,
      "exchangeAddress": "0x61935cbdd02287b511119ddb11aeb42f1593b7ef",
      "makerAddress": "0xfeeea80c14f72afab75b9a6b1de4bdc937698760",
      "takerAddress": "0x0000000000000000000000000000000000000000",
      "feeRecipientAddress": "0x86003b044f70dac0abc80ac8957305b6370893ed",
      "senderAddress": "0x0000000000000000000000000000000000000000",
      "makerAssetAmount": "100000000000000000",
      "takerAssetAmount": "17991",
      "makerFee": "0",
      "takerFee": "0",
      "expirationTimeSeconds": "1597046662",
      "salt": "11456928216658952244894559883871157454655431280055726036764660769658647023142",
      "makerAssetData": "0xf47261b000000000000000000000000072783301f79df7df1dc2225299d959c4cabe8986",
      "takerAssetData": "0xf47261b0000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "makerFeeAssetData": "0x",
      "takerFeeAssetData": "0x",
      "signature": "0x1b499506966f50ab2b8dd0c6e3050204d318883136e9463a089612fe8eb55f7a5a513c9b36c7c7a1cb3a02a1237e04d6a3e279959b111971c10fd22fb34b133eff02"
    },
    {
      "chainId": 1,
      "exchangeAddress": "0x61935cbdd02287b511119ddb11aeb42f1593b7ef",
      "makerAddress": "0xfeeea80c14f72afab75b9a6b1de4bdc937698760",
      "takerAddress": "0x0000000000000000000000000000000000000000",
      "feeRecipientAddress": "0x86003b044f70dac0abc80ac8957305b6370893ed",
      "senderAddress": "0x0000000000000000000000000000000000000000",
      "makerAssetAmount": "1000000000000000000000",
      "takerAssetAmount": "250000000",
      "makerFee": "0",
      "takerFee": "0",
      "expirationTimeSeconds": "1597119139",
      "salt": "48622021555668487807385885001297822124294872234068043094324843293624285281059",
      "makerAssetData": "0xf47261b000000000000000000000000072783301f79df7df1dc2225299d959c4cabe8986",
      "takerAssetData": "0xf47261b0000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "makerFeeAssetData": "0x",
      "takerFeeAssetData": "0x",
      "signature": "0x1c986bd5b24a453558fa12cfa526108308901b39e1ee494fc02874c2495440990d04d99f0f8b2418c4a31961c227b80669ffca8b96a7f83e52731763a36bfa728902"
    }
  ],
  "allowanceTarget": "0x95e6f48254609a6ee006f7d493c8e5fb97094cef"
}

New

{
  "price": "4",
  "guaranteedPrice": "4",
  "value": "7000000000000000",
  "gas": "180000",
  "estimatedGas": "150000",
  "gasPrice": "100000000000",
  "protocolFee": "7000000000000000",
  "minimumProtocolFee": "7000000000000000",
  "buyAmount": "400000000000000000000",
  "sellAmount": "100000000",
  "estimatedGasTokenRefund": "0",
  "orders": [
    {
      "chainId": 1,
      "exchangeAddress": "0x61935cbdd02287b511119ddb11aeb42f1593b7ef",
      "makerAddress": "0xfeeea80c14f72afab75b9a6b1de4bdc937698760",
      "takerAddress": "0x0000000000000000000000000000000000000000",
      "feeRecipientAddress": "0x86003b044f70dac0abc80ac8957305b6370893ed",
      "senderAddress": "0x0000000000000000000000000000000000000000",
      "makerAssetAmount": "1000000000000000000000",
      "takerAssetAmount": "250000000",
      "makerFee": "0",
      "takerFee": "0",
      "expirationTimeSeconds": "1597119139",
      "salt": "48622021555668487807385885001297822124294872234068043094324843293624285281059",
      "makerAssetData": "0xf47261b000000000000000000000000072783301f79df7df1dc2225299d959c4cabe8986",
      "takerAssetData": "0xf47261b0000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "makerFeeAssetData": "0x",
      "takerFeeAssetData": "0x",
      "signature": "0x1c986bd5b24a453558fa12cfa526108308901b39e1ee494fc02874c2495440990d04d99f0f8b2418c4a31961c227b80669ffca8b96a7f83e52731763a36bfa728902"
    }
  ],
  "allowanceTarget": "0x95e6f48254609a6ee006f7d493c8e5fb97094cef"
}

Testing Instructions

Checklist

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

@dekz
Copy link
Copy Markdown
Member Author

dekz commented Aug 10, 2020

deploy staging

@dekz
Copy link
Copy Markdown
Member Author

dekz commented Aug 10, 2020

deploy production

@dekz dekz merged commit e542c98 into master Aug 10, 2020
@dekz dekz deleted the feat/ethToInputRate branch August 10, 2020 10:41
github-actions bot pushed a commit that referenced this pull request Aug 10, 2020
# [1.14.0](v1.13.0...v1.14.0) (2020-08-10)

### Bug Fixes

* handle addresses in depth ([#313](#313)) ([ce6978b](ce6978b))
* return input in depth-chart ([#307](#307)) ([a3fa961](a3fa961))
* source regression ([#306](#306)) ([cdcfc78](cdcfc78))
* update asset-swapper optimizer for splits ([#311](#311)) ([5b212c9](5b212c9))

### Features

* Add support for buy token affiliate fees ([#310](#310)) ([2866253](2866253))
* ethToInputRate cost routing ([#315](#315)) ([e542c98](e542c98))
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.14.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.

1 participant