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

[asset-buyer][instant] Fix incorrect token prices for non 18-decimal tokens #1252

Merged
merged 7 commits into from
Nov 13, 2018

Conversation

BMillman19
Copy link
Contributor

@BMillman19 BMillman19 commented Nov 13, 2018

Description

  • Update AssetBuyer to return information about total eth spent on the target asset instead of per-unit token prices.
  • Update AssetBuyer to include eth spent on zrx tokens to fund takerFees as part of the feeEthAmount returned by getBuyQuoteAsync. Previously this cost was being reported as part of the base amount being paid for an asset and the feeEthAmount represented only the affiliate fee.
  • Update Instant to calculate per-unit token prices using the amount of units that is provided by the user
  • Update variable names in Instant to be clearer what amounts represent normal units vs base units

Testing instructions

Unit tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • Prefix PR title with [WIP] if necessary.
  • Prefix PR title with bracketed package name(s) corresponding to the changed package(s). For example: [sol-cov] Fixed bug.
  • Add tests to cover changes as needed.
  • Update documentation as needed.
  • Add new entries to the relevant CHANGELOG.jsons.

@BMillman19 BMillman19 force-pushed the fix/asset-buyer/price-per-token branch from 928424a to b65b410 Compare November 13, 2018 04:46
@BMillman19 BMillman19 changed the title [wip] Fix/asset buyer/price per token [asset-buyer][instant] Fix incorrect token prices for non 18-decimal tokens Nov 13, 2018
@coveralls
Copy link

coveralls commented Nov 13, 2018

Coverage Status

Coverage increased (+0.02%) to 84.711% when pulling 5527de6 on fix/asset-buyer/price-per-token into 11f0beb on development.

@BMillman19 BMillman19 force-pushed the fix/asset-buyer/price-per-token branch from b65b410 to e8afc66 Compare November 13, 2018 04:51
@@ -14,13 +14,15 @@ export interface LatestBuyQuoteOrderDetailsProps {}

interface ConnectedState {
buyQuoteInfo?: BuyQuoteInfo;
selectedAssetAmount?: BigNumber;
Copy link
Contributor

Choose a reason for hiding this comment

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

Per convo, use word "unit" to describe selected asest amount

const assetEthBaseUnitAmount = buyQuoteAccessor.assetEthAmount();
const feeEthBaseUnitAmount = buyQuoteAccessor.feeEthAmount();
const totalEthBaseUnitAmount = buyQuoteAccessor.totalEthAmount();
const perAssetUnitEthBaseUnitAmount =
Copy link
Contributor

Choose a reason for hiding this comment

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

this var name is descriptive but pretty long and gnarly, could we just call it something like pricePerTokenEth?

@BMillman19 BMillman19 force-pushed the fix/asset-buyer/price-per-token branch from 80e3773 to 5527de6 Compare November 13, 2018 18:29
@@ -1,4 +1,13 @@
[
{
"version": "2.3.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a full version bump (3)?

* development:
  Publish
  Updated CHANGELOGS
  Fix a bug when undefined was been tried to convert to an array
  feat(instant): add extra asset metadata
  chore: fix linter error
  Improve logo spacing
  fix: lowercase supplied address before comparing with derived addresses (which are not checksummed)
  Remove unused instance variable
  update yarn.lock
  Increase logo size
  Replace remaining scroll-links with Link component
  Adjust paddin
  Fix menuItem background colors depending on the context
  Remove "Home" menu item, instead make different parts of logo link to different sections of the website
  Rename tutorial to match verb structure
  chore: Make `External exports` clickable on sidebar
  style: reduce border size on version dropdown
  style: make line-height of sidebar title 26px, make sure still bottom aligned with version picker
  Update yarn.lock
  style: remove small gap under topbar
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants