-
Notifications
You must be signed in to change notification settings - Fork 66
Feature/Add product management function setProducts() #401
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
Conversation
e5c7b87
to
2f071b4
Compare
08584bd
to
aaa56c2
Compare
A meta discussion about solving 3 issues in 1 PR I've been doing 1 issue per PR, should we be more strict with that or just leave it to reasonable judgement case by case |
I ended up merging the 3 issues into one, as they were too interdependent. So overall it does follow the 1 issue - 1 pr structure. |
aaa56c2
to
db913c3
Compare
1fa212f
to
9b87833
Compare
9ac893b
to
4e9b4ea
Compare
2be0da8
to
9e4b1e6
Compare
9e4b1e6
to
b0da140
Compare
31da612
to
c54acd1
Compare
4b07e98
to
d773e62
Compare
d773e62
to
3fade5f
Compare
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.
🚀
fa4487d
to
57bc95c
Compare
…alized with targetWeight above 1
57bc95c
to
c33d757
Compare
Context
closes #334
closes #329
closes #328
Changes proposed in this pull request
334 - Add ability for manager to add/remove/edit products in the staking pool by creating a
setProducts(ProductParams[] products)
function that lets the manager add/remove or edit existing products. The product must exist in the Cover contract to be added.329 - Enforce max 20x leverage. The staking pool has a global variable targetWeight that must be below 20x.
328 -
setProducts()
allows managers to adjust any product in one txThis PR adds a
setProducts()
function that allows managers to add, edit or remove products from their staking pool. The staking pool can offer full capacity for up to 20 products. This is managed by keeping track of atotalTargetWeight
and atotalEffectiveWeight
. Allocation for a product cannot exceed that products target weight. When setting targetWeight, thetotalTargetWeight
and thetotalEffectiveWeight
cannot exceed 20x. This means if the stakingpool is at full allocation, the manager will not be able to add another product even if they reduce thetargetWeight
of other products.totalEffectiveWeight
is the sum of max(product.targetWeight, product.allocatedWeight).totalTargetWeight
is the max amount the contract will allocate....can never be above 2000 (20.00)_setInitialProducts()
totalTargetWeight
as the pool should have no allocations yetsetProducts()
totalTargetWeight
is still below the max.cover.getCapacityRatios()
Note: There was some fixes made to
activeStake
/totalCapacities
astotalCapacities
was being stored/retrieved with 12 extra decimal places relative toallocatedCapacities
Test plan
Added unit tests at:
test/unit/StakingPool/setProducts.js
Checklist
Review
When reviewing a PR, please indicate intention in comments using the following emojis: