-
Notifications
You must be signed in to change notification settings - Fork 66
Feature: Make upgradeCapitalPool copy over investmentAssets and coverAssets when pool is upgraded #573
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
527d137
to
3cf85cf
Compare
3cf85cf
to
0be6c5b
Compare
At a feature spec level, this implementation makes things a little bit less flexible. With the constructor variables we can rebuild the arrays everytime and add new things in on a need basis or deprecate etc. Here we need to upgrade the pool and the run another governance update to add or deprecate an asset. I'm not convinced it's ideal to have it, it does heavily reduce the probability of error so that's the big upside. Putting this out there. |
5bc1216
to
9bc6980
Compare
test/unit/Pool/removeAsset.js
Outdated
assert.strictEqual(maxAmount.toString(), ether('32500').toString()); | ||
assert.strictEqual(maxSlippageRatio.toString(), '0'); | ||
// TODO: does this need to be exactly this timestamp? | ||
assert.strictEqual(lastSwapTime.toString(), '1633425218'); |
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 lastSwapTime
is no longer manually set in the constructor, but instead goes through _addAsset()
, which sets lastSwapTIme
to 0. I didn't make any changes for this as I wanted to ask if this exact timestamp is still required?
return swapDetails[assetAddress]; | ||
} | ||
|
||
function getAssetsAndSwapDetails() external view returns ( |
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.
Should we exclude abandoned assets from being copied over? I could change this function so it only returns active assets.
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.
what do you mean by abandoned what do you check for that?
98c88af
to
f165501
Compare
contracts/modules/capital/Pool.sol
Outdated
|
||
// Transfer cover assets. Start from 1 (0 is ETH) | ||
uint coverAssetsCount = coverAssets.length; | ||
uint coverAssetsCount = coverAssets.length; // substract 1 as ETH is skiped |
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.
there's no substraction here the comment is not relevant imo, it's just ETH skipped at the start
we can use some unit tests for the constructor itself for Pool.sol now since it's relatively complex. |
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.
Small changes, and a request for unit testing the constructor
c0fafb1
to
3c69709
Compare
3c69709
to
a88063f
Compare
a88063f
to
0c30bde
Compare
As per discussion, the current implementation will fail to upgrade because the |
Context
closes #473
Changes proposed in this pull request
This PR changes the capital pool so when it is deployed, it copies over
coverAssets
,investmentAssets
andswapDetails
from the previous pool. It also also adds the option to add additional assets when deploying a new Pool.Test plan
A test was added to
unit/Pool/upgradeCapitalPool.js
. I was going to create a new unit test fileconstructor.js
and add more tests, but the tests are still using truffle/web3 and I was having issues testing the reverts in the constructor.Checklist
Review
When reviewing a PR, please indicate intention in comments using the following emojis: