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: add new field capacityPerPool to capacity pool API #139

Open
wants to merge 13 commits into
base: feat/staking-data-pool-detailed-capacity
Choose a base branch
from

Conversation

rackstar
Copy link
Contributor

@rackstar rackstar commented Oct 11, 2024

Description

Closes #131

/capacity/:pooId:

  • new capacityPerPool field object - min/maxAnnualPrice for a product per pool

NOTE: this PR is behind #130

Testing

unit tests

Checklist

  • Performed a self-review of my own code
  • Made corresponding changes to the documentation

@rackstar rackstar self-assigned this Oct 11, 2024
@rackstar rackstar force-pushed the feat/staking-data-product-pricing-per-pool branch 2 times, most recently from 9337fb9 to d8e7aa8 Compare October 11, 2024 14:00
@rackstar rackstar changed the title Feat/staking data product pricing per pool feat: staking data product pricing per pool Oct 11, 2024
@rackstar rackstar changed the base branch from dev to feat/staking-data-pool-detailed-capacity October 11, 2024 14:01
@rackstar rackstar force-pushed the feat/staking-data-pool-detailed-capacity branch from 999a544 to b73a66b Compare October 11, 2024 14:02
@rackstar rackstar force-pushed the feat/staking-data-product-pricing-per-pool branch from d8e7aa8 to c5fda65 Compare October 11, 2024 14:03
Comment on lines +66 to +73
function calculateProductDataForTranche(productPools, firstUsableTrancheIndex, useFixedPrice, now, assets, assetRates) {
const aggregatedData = {
capacityUsedNXM: Zero,
capacityAvailableNXM: Zero,
minPrice: Zero,
totalPremium: Zero,
};

const capacityPerPool = productPools.map(pool => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The main change here is adding capacityPerPool to the result along with the previous aggregatedData return value

@rackstar rackstar force-pushed the feat/staking-data-pool-detailed-capacity branch from b73a66b to f117f00 Compare November 19, 2024 09:12
@rackstar rackstar force-pushed the feat/staking-data-product-pricing-per-pool branch from b0f4aa8 to 8683c06 Compare November 19, 2024 09:13
@rackstar rackstar changed the title feat: staking data product pricing per pool feat: add new field capacityPerPool to capacity pool API Nov 19, 2024
@rackstar rackstar force-pushed the feat/staking-data-product-pricing-per-pool branch from 8683c06 to 213f5d3 Compare November 19, 2024 09:47
totalPremium,
};
}
function calculateProductDataForTranche(productPools, firstUsableTrancheIndex, useFixedPrice, now, assets, assetRates) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would remove assets and assetRates from this function, as I can see we are not using availableCapacityInAssets for anything and we are recalculating it again later in the code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the availableCapacityInAssets in this function is under capacityPerPool field, meaning the value is segregated by StakingPool.

on the other hand the 2nd capacityInAssets (on capacityEngine function) is the value across all StakingPools.

@rackstar rackstar force-pushed the feat/staking-data-product-pricing-per-pool branch from cb34d60 to 72c5c26 Compare November 19, 2024 14:42
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.

Staking Data (Part 2)
3 participants