Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adds lockers count to the tvl endpoint #142

Merged
merged 2 commits into from
Feb 19, 2024
Merged

Conversation

gluneau
Copy link
Contributor

@gluneau gluneau commented Feb 14, 2024

Prerequisite: graphql indexes have to be on v2 first

Add 3 new enpoints with 3 values each for stakers and lockers. (date, count, amount)
and a combined endpoint.

http://127.0.0.1:5001/astar-token-api/us-central1/app/api/v3/shiden/dapps-staking/stakers-total/90%20days

[
  {
    "date": "1708041600000",
    "count": 403,
    "amount": "1977589088000000000000000"
  },
  {
    "date": "1707955200000",
    "count": 397,
    "amount": "1967662208000000000000000"
  }, ...

http://127.0.0.1:5001/astar-token-api/us-central1/app/api/v3/shiden/dapps-staking/lockers-total/90%20days

[
  {
    "date": "1708041600000",
    "count": 3343,
    "amount": "16286708604872965460014209"
  },
  {
    "date": "1707955200000",
    "count": 3344,
    "amount": "16286474924238392891442274"
  }, ...

http://127.0.0.1:5001/astar-token-api/us-central1/app/api/v3/shiden/dapps-staking/lockers-and-stakers-total/90%20days

[
  {
    "date": "1708041600000",
    "tvl": "16286708604872965460014209",
    "lockersCount": 3343,
    "tvs": "1977589088000000000000000",
    "stakersCount": 403
  },
  {
    "date": "1707955200000",
    "tvl": "16286474924238392891442274",
    "lockersCount": 3344,
    "tvs": "1967662208000000000000000",
    "stakersCount": 397
  }, ...

Copy link

github-actions bot commented Feb 14, 2024

Visit the preview URL for this PR (updated for commit 84e72d8):

https://astar-token-api--pr142-feat-lockerscount-lbn0gu0l.web.app

(expires Fri, 23 Feb 2024 02:36:11 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f99fa4f4f8f3bb450e6e842f7e1c7783d6d896a3

@gluneau gluneau requested a review from bobo-k2 February 14, 2024 23:58
@bobo-k2
Copy link
Contributor

bobo-k2 commented Feb 15, 2024

Maybe to return objects array from the call. When you have just timestamp and value (e.g.) tvl this is fine to have array, because it is more or less obvious from the endpoint name and data.

This change will probably break some client code. Think about introducing a new endpoint

Return something like

[
  {
    timestamp: "1705363200000",
    tvl: "5475067296262039963124623",
    uniqueLockerAccounts: 21016
  }
]

@gluneau
Copy link
Contributor Author

gluneau commented Feb 16, 2024

Maybe to return objects array from the call. When you have just timestamp and value (e.g.) tvl this is fine to have array, because it is more or less obvious from the endpoint name and data.

This change will probably break some client code. Think about introducing a new endpoint

Return something like

[
  {
    timestamp: "1705363200000",
    tvl: "5475067296262039963124623",
    uniqueLockerAccounts: 21016
  }
]

I have reverted the endpoint changes and introduced 3 new endpoints.

Copy link
Contributor

@bobo-k2 bobo-k2 left a comment

Choose a reason for hiding this comment

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

LGTM, I think the combined lockers and stakers endpoint is not necessary, but it is ok to have it.

@gluneau gluneau merged commit 7a6168e into prod Feb 19, 2024
5 checks passed
@gluneau gluneau deleted the feat/lockerscount branch February 19, 2024 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants