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

Calculate collectible price in dutch sell #385

Merged
merged 13 commits into from
May 17, 2019

Conversation

unjapones
Copy link
Contributor

@unjapones unjapones commented May 16, 2019

Connects #376.

Includes

  • Add /src/util/collectibles.ts file (similtar to /src/util/tokens.ts) which exports getCollectiblePrice.
  • Add dutch_auction_price_chart_card component for the Price Chart content.
  • Hide the Price Chart card of an individual collectible if it is not in dutch sell.
  • Show real values in the Price Chart card of an individual collectible that is in dutch sell.

Screenshots

Basic sell (cancellable)
basic_sell

Dutch sell (not cancellable)
dutch_sell

Basic buy
basic_buy

Dutch buy
dutch_buy

unjapones added 5 commits May 16, 2019 12:36
…sell' into calculate-collectible-price-in-dutch-sell
Use decodeDutchAuctionData and linear function formula.
Update 0x.js to get the fix in DutchAuctionWrapper.decodeDutchAuctionData.
@@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"0x.js": "^6.0.8",
"0x.js": "^6.0.9",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

// Use y = mx + b (linear function)
const m = endAmount.minus(beginAmount).dividedBy(startTimeSeconds.minus(beginTimeSeconds));
const b = beginAmount.minus(beginTimeSeconds.multipliedBy(m));
return m.multipliedBy(todayInSeconds()).plus(b);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

BTW I compared the result using getAuctionDetailsAsync and the amount was the same (the decimal part of the amount was not, but we can ignore it).

@@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"0x.js": "^6.0.8",
"0x.js": "^6.0.9",
"@0x/connect": "^5.0.8",
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: This library also had a release, should we update it?

@unjapones unjapones merged commit 075fe94 into erc721 May 17, 2019
@unjapones unjapones deleted the calculate-collectible-price-in-dutch-sell branch May 17, 2019 13:16
birimbau pushed a commit to birimbau/VeriDex that referenced this pull request Jan 4, 2020
…-price-in-dutch-sell

Calculate collectible price in dutch sell
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.

3 participants