-
Notifications
You must be signed in to change notification settings - Fork 48
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(PRT): Add Prt
and PrtFeeSplitExtension
#176
Conversation
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.
Good stuff.
I added a few comments on the Extension and StakingPool contracts. A lot of them just nit picking on event emission etc. But you might want to check out the alternative mechanism to calculate pending rewards that I linked.
Happy to elaborate.
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.
Looks good👍
Changes / comments all make sense to me. Snapshot logic should also work well enough given monthly updates and partial claim function.
Maybe try to fix ci or just skip the failing test.
Other than that no more issues from my side.
Prt
and PrtFeeSplitExtension
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.
Mostly nitpicking. One more substantial comment / question on the accruerHistory
and one suggestion / reminder regarding integration tests.
Great work 👍
@@ -0,0 +1,760 @@ | |||
import "module-alias/register"; |
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.
Now that we have moved the staking pool to the other repo we don't have integration tests anywhere.
We should probably add those somewhere. (we could wait until one of them is deployed though to avoid having to import one repo into the other).
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.
let's handle integration tests in https://github.com/IndexCoop/periphery
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.
Great work! Mostly minor comments/suggestions. The one thing to look at more closely is if we should enforce that the StakingPool's stakeToken
matches the address stored in the prt
variable.
mutualUpgrade(manager.operator(), manager.methodologist()) | ||
{ | ||
require(address(_prtStakingPool) != address(0), "Zero address not valid"); | ||
require(_prtStakingPool.feeSplitExtension() == address(this), "PrtFeeSplitExtension must be set"); |
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.
Note that in the newer version of SnapshotStakingPool.sol
the public variable is called distributor
and not feeSplitExtension
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 also check to make sure the Staking Pool's stakeToken
matches the address stored in prt
?
In the constructor we check if prt.setToken()
is correct, but I don't think that's effective unless we also check that the StakingPool uses that same prt.
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.
added additional checks to match the SnapshotStakingPool
here 515e783
bool[] memory _statuses | ||
) | ||
external | ||
mutualUpgrade(manager.operator(), manager.methodologist()) |
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.
Does this function have to be mutual upgrade? To me it feels like this is something the operator should be responsible over. Also, the Leverage Strategy extensions updateCallerStatus
is onlyOperator rather than mutual upgrade.
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.
updated to onlyOperator
here 8015c24
*/ | ||
function updateAnyoneAccrue(bool _status) | ||
external | ||
mutualUpgrade(manager.operator(), manager.methodologist()) |
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.
Same comment as above for setAccruersStatus
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.
updated to onlyOperator
here 8015c24
|
||
interface IPrtStakingPool { | ||
function accrue(uint256 _amount) external; | ||
function feeSplitExtension() external view returns (address); |
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.
Noting the newer version of SnapshotStakingPool uses the variable name distributor
instead of feeSplitExtension
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.
fixed here 515e783
* sufficient for accounting for all collected fees. If the PRT take is greater than 0, the PRT Staking Pool will accrue the fees | ||
* and update the snapshot. | ||
*/ | ||
function accrueFeesAndDistribute() public override onlyAllowedAccruer { |
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.
Maybe we should add a line for require(address(prtStakingPool) != address(0), "PRT Staking Pool not set")
, as a reminder that this function can be called before the prtStakingPool is defined?
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.
added here e7a8a8c
contracts/token/Prt.sol
Outdated
{ | ||
setToken = _setToken; | ||
_mint(_distributor, _totalSupply); | ||
_setupDecimals(18); |
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.
Nit: Not really necessary, since the default is 18. https://docs.openzeppelin.com/contracts/3.x/api/token/erc20#ERC20-_setupDecimals-uint8-
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.
removed here 932489a
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.
Changes LGTM 🔥
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.
LGTM ! 🛳️
No description provided.