gnosis / dex-services

Off-chain services for the Gnosis Protocol v1.
33 stars 9 forks source link

Add route for current min order size in owl #1409

Closed e00E closed 4 years ago

e00E commented 4 years ago

We want to use this for the frontend.

This commit has several todos that can be improved. We will do these later so that the route is available as quickly as possible so we stop blocking the frontend.

Related to #1404 .

I introduced a new trait EthPricing which has the get_eth_price method that used to be in PriceEstimating. This is cleaner because EconomicViability only needs this one method and makes it easier to create EconomicViability with the price source we have in PriceEstimator instead of using PriceOracle.

The todos that we can do after this PR:

  1. Avoid code duplication for economic viability related arguments in driver and price estimator.
  2. Avoid code duplication for creation of economic viability from arguments in driver and price estimator.
  3. Introduce a network_id argument to price estimator which is needed for the gas price estimation to not be hardcoded to mainnet.
  4. Create a better version of this route that works per token and returns the amount in that token instead of in owl.
  5. Add openapi docs for the route.

Test Plan

Run price estimator with --economic-viability-subsidy-factor 5. curl -i "http://localhost:8080/api/v1/minimum-order-size-owl" returns 1838937853604742400000 which is 1839 owl and fits with the min avg fee we pass to the solver. To check the solver look at https://dashboard-projects.gnosisdev.com/d/BOeaAdNGk/solver-metrics?orgId=1 . Note that the open solver is currently using subsidy factor 5 while the others are using 10.

nlordell commented 4 years ago

I just noticed, we should add this to the OpenAPI spec.

e00E commented 4 years ago

I just noticed, we should add this to the OpenAPI spec.

Agree. Will also do this in follow up PR and added it to todo list.