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

Adding member_zrx_staked to epoch pool rewards query #56

Merged
merged 9 commits into from
Mar 31, 2021

Conversation

lyaunzbe
Copy link
Contributor

In reference to: 0xProject/website#366

Basically, we want to be able to see the amount of ZRX staked per each epoch. Currently, staking endpoint staking/pools/{poolId} only shows amount of ZRX staked for current epoch and next epoch. Also added back nodemon dev npm script.

@lyaunzbe lyaunzbe requested review from xianny and sui414 March 22, 2021 04:51
Copy link
Contributor

@xianny xianny left a comment

Choose a reason for hiding this comment

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

Looks good to me but I think @sui414 should review as the data and queries are her expertise :)

"scripts": {
"build": "yarn tsc -b",
"clean": "rm -rf lib",
"dev": "nodemon -r dotenv/config src/index.ts | pino-pretty",
Copy link
Contributor

Choose a reason for hiding this comment

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

yay, thanks!

@xianny
Copy link
Contributor

xianny commented Mar 22, 2021

I took a peek at 0xProject/website#366 for more context.

Why not add epochRewards to the /pools response? It seems we would always want to call /pools from the front-end on page load, and could cache that response on localhost to use when clicking through to each pool's individual page. Could also include ETH/ZRX prices in the response.

Highly recommend doing aggregate queries and joins at the SQL layer instead of the API/network layer. Also, this data changes slowly so we can add a cache at the ingress layer for faster page loads.

@@ -328,18 +328,21 @@ export const poolEpochRewardsQuery = `
, e.ending_timestamp
, e.ending_block_number
, e.ending_transaction_hash
, esps.member_zrx_delegated AS member_zrx_staked
Copy link
Contributor

Choose a reason for hiding this comment

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

COALESCE(esps.member_zrx_delegated, 0.00)

@lyaunzbe lyaunzbe requested a review from sui414 March 31, 2021 07:21
@sui414 sui414 merged commit 3cdc149 into master Mar 31, 2021
Ktl-XV pushed a commit that referenced this pull request Apr 3, 2023
…ool-epoch-rewards

Adding member_zrx_staked to epoch pool rewards query
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.

3 participants