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

🔧 series floorprice #116

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

roiLeo
Copy link
Contributor

@roiLeo roiLeo commented Nov 2, 2022

on series:

  • SQL query floor_price will always be null since it's based on nft.price from e.interaction = 'BUY'
  • on handleTokenBuy price is set to BigInt(0)

⚠️ This is not final fix, floor_price should be based on last e.interaction = 'LIST'

query MyQuery {
  events(where: {interaction_eq: BUY}, limit: 5) {
    interaction
    meta
    timestamp
    caller
    nft {
      price
    }
  }
  series(limit: 5) {
    emoteCount
    floorPrice
    highestSale
  }
}

PR type

  • Bugfix

What's new?

Before submitting Pull Request, please make sure:

  • My contribution builds clean without any errors or warnings
  • I've merged recent default branch -- main and I've no conflicts
  • I've tried to respect high code quality standards
  • I've didn't break any original functionality
  • I've posted a screenshot of demonstrated change in this PR

Optional

  • I've run the indexer and it hasn't failed

Screenshot

Capture d’écran 2022-11-02 à 3 05 49 PM

@vikiival
Copy link
Member

vikiival commented Mar 6, 2023

soo?

@roiLeo
Copy link
Contributor Author

roiLeo commented Mar 6, 2023

soo?

long story short, series query should be reworked.

@roiLeo
Copy link
Contributor Author

roiLeo commented Mar 6, 2023

UPDATE:

query MyQuery {
  series(limit: 5, orderBy: floorPrice_DESC) {
    id
    floorPrice
    highestSale
  }
}

results:
/snek/004

{
  "data": {
    "series": [
      {
        "id": "3132385849",
        "floorPrice": null,
        "highestSale": "150000000000"
      },
      {
        "id": "2773267381",
        "floorPrice": null,
        "highestSale": "10000000000"
      },
      {
        "id": "3033790537",
        "floorPrice": null,
        "highestSale": "1000000000000"
      },
      {
        "id": "331660682",
        "floorPrice": null,
        "highestSale": "542476800000"
      },
      {
        "id": "185770742",
        "floorPrice": null,
        "highestSale": "330000000000"
      }
    ]
  }
}

localhost

{
  "data": {
    "series": [
      {
        "id": "488018416",
        "floorPrice": "100000000000000",
        "highestSale": "100000000000000"
      },
      {
        "id": "807893860",
        "floorPrice": "1000000000000",
        "highestSale": "1000000000000"
      },
      {
        "id": "3033790537",
        "floorPrice": "1000000000000",
        "highestSale": "1000000000000000000"
      },
      {
        "id": "3424749042",
        "floorPrice": "1000000000000",
        "highestSale": "10000000000000"
      },
      {
        "id": "756873665",
        "floorPrice": "1000000000000",
        "highestSale": "1000000000000"
      }
    ]
  }
}

I think we can beta test this one on 004

@roiLeo roiLeo mentioned this pull request Mar 9, 2023
@roiLeo
Copy link
Contributor Author

roiLeo commented Mar 22, 2023

from #162 (comment)

Now issue is, floor_price will be based on all time interaction.
Let's say I:

List nft for 10$
Relist for 20$
floor_price will be 10$ since it's based on all BUY/LIST events

We should base it on last made event. (and we still check burned nft ☹️)
We have to make a nested request. (join)

edit:

What 's up:

      INNER JOIN (
        SELECT *
        FROM event e
        WHERE e.interaction = 'BUY'
        OR e.interaction = 'LIST'
        GROUP BY e.nft_id, e.id
        ORDER BY e.timestamp
        LIMIT 0 OFFSET 1
      ) e on ne.id = e.nft_id
      ${computedDateRange}

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.

2 participants