-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: feat/staking-data-pool-detailed-capacity
Are you sure you want to change the base?
feat: add new field capacityPerPool to capacity pool API #139
Conversation
9337fb9
to
d8e7aa8
Compare
999a544
to
b73a66b
Compare
d8e7aa8
to
c5fda65
Compare
function calculateProductDataForTranche(productPools, firstUsableTrancheIndex, useFixedPrice, now, assets, assetRates) { | ||
const aggregatedData = { | ||
capacityUsedNXM: Zero, | ||
capacityAvailableNXM: Zero, | ||
minPrice: Zero, | ||
totalPremium: Zero, | ||
}; | ||
|
||
const capacityPerPool = productPools.map(pool => { |
There was a problem hiding this comment.
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
b73a66b
to
f117f00
Compare
b0f4aa8
to
8683c06
Compare
8683c06
to
213f5d3
Compare
totalPremium, | ||
}; | ||
} | ||
function calculateProductDataForTranche(productPools, firstUsableTrancheIndex, useFixedPrice, now, assets, assetRates) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
* add calculateAvailableCapacity
* remove code duplication in capacityEngine
* capacityPerPools unit tests if withPools=true * calculateProductDataForTranche * calculateAvailableCapacity * getProductsInPool * calculateTrancheInfo
* capacityPerPool field unit test
cb34d60
to
72c5c26
Compare
Description
Closes #131
/capacity/:pooId
:capacityPerPool
field object - min/maxAnnualPrice for a product per poolNOTE: this PR is behind #130
Testing
unit tests
Checklist