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(PRT): Add Prt and PrtFeeSplitExtension #176

Merged
merged 19 commits into from
Jun 24, 2024
Merged

feat(PRT): Add Prt and PrtFeeSplitExtension #176

merged 19 commits into from
Jun 24, 2024

Conversation

pblivin0x
Copy link
Contributor

No description provided.

Copy link
Collaborator

@ckoopmann ckoopmann left a 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.

contracts/adapters/PrtFeeSplitExtension.sol Show resolved Hide resolved
contracts/adapters/PrtFeeSplitExtension.sol Show resolved Hide resolved
contracts/adapters/PrtFeeSplitExtension.sol Outdated Show resolved Hide resolved
contracts/adapters/PrtFeeSplitExtension.sol Outdated Show resolved Hide resolved
contracts/adapters/PrtFeeSplitExtension.sol Show resolved Hide resolved
contracts/staking/PrtStakingPool.sol Outdated Show resolved Hide resolved
contracts/staking/PrtStakingPool.sol Outdated Show resolved Hide resolved
contracts/staking/PrtStakingPool.sol Outdated Show resolved Hide resolved
contracts/staking/PrtStakingPool.sol Outdated Show resolved Hide resolved
contracts/staking/PrtStakingPool.sol Outdated Show resolved Hide resolved
@ckoopmann ckoopmann self-requested a review June 12, 2024 12:50
Copy link
Collaborator

@ckoopmann ckoopmann left a 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.

@pblivin0x pblivin0x changed the title feat(PRT): Add PrtStakingPool System feat(PRT): Add Prt and PrtFeeSplitExtension Jun 19, 2024
@pblivin0x pblivin0x marked this pull request as ready for review June 19, 2024 20:58
@pblivin0x pblivin0x requested a review from edkim June 19, 2024 20:58
Copy link
Collaborator

@ckoopmann ckoopmann left a 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 👍

contracts/adapters/PrtFeeSplitExtension.sol Outdated Show resolved Hide resolved
contracts/adapters/PrtFeeSplitExtension.sol Outdated Show resolved Hide resolved
contracts/adapters/PrtFeeSplitExtension.sol Outdated Show resolved Hide resolved
contracts/adapters/PrtFeeSplitExtension.sol Show resolved Hide resolved
@@ -0,0 +1,760 @@
import "module-alias/register";
Copy link
Collaborator

@ckoopmann ckoopmann Jun 20, 2024

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).

Copy link
Contributor Author

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

Copy link
Contributor

@edkim edkim left a 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");
Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor Author

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())
Copy link
Contributor

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.

Copy link
Contributor Author

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())
Copy link
Contributor

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

Copy link
Contributor Author

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);
Copy link
Contributor

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

Copy link
Contributor Author

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 {
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added here e7a8a8c

{
setToken = _setToken;
_mint(_distributor, _totalSupply);
_setupDecimals(18);
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed here 932489a

Copy link
Contributor

@edkim edkim left a comment

Choose a reason for hiding this comment

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

Changes LGTM 🔥

Copy link
Collaborator

@ckoopmann ckoopmann left a comment

Choose a reason for hiding this comment

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

LGTM ! 🛳️

@pblivin0x pblivin0x merged commit 6477886 into master Jun 24, 2024
5 checks passed
@pblivin0x pblivin0x deleted the prt-base branch June 24, 2024 02:18
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.

3 participants