Skip to content

Conversation

@pavelvm5
Copy link

Adding code for sGhoSteward that can update supplyCap and targetRate in sGho.
For this to work, this steward should be granted with YIELD_MANAGER_ROLE.

For convenience, the targetRate is divided into three components and a special role is allocated for updating each variable.

address public executor = vm.addr(0x0001);
address public ghoCommittee = vm.addr(0x0002);

bytes32 public constant YIELD_MANAGER_ROLE = 'YIELD_MANAGER';
Copy link
Collaborator

@CheyenneAtapour CheyenneAtapour Nov 4, 2025

Choose a reason for hiding this comment

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

Nbd, but why is yield manager role defined differently from the ones below? EDIT: Oh perhaps because it's to distinguish it's a role on sGho rather than Steward contract

- Supports updating with each rate parameter *individually* or *multiple parameters simultaneously*.
- Integrates **Role-Based Access Control** from OpenZeppelin, enabling secure assignment, modification, and revocation of roles.
- Provides functions to view the current configuration and pre-calculate the `targetRate` for any given configuration.
- Enforces a hard cap of `50%` for the computed `targetRate`, regardless of configuration input.
Copy link
Collaborator

@CheyenneAtapour CheyenneAtapour Nov 4, 2025

Choose a reason for hiding this comment

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

To me, this sentence is a bit misleading, because it kind of sounds like the contract does not revert (and perhaps instead just uses 50% target rate even if it would calculate higher based on input config), when indeed it does revert based on the configuration input. It's mentioned below and indeed the contract does revert when this exceeds 50%. Perhaps can clarify here too that the contract reverts if configuration input would put target rate over 50%.

Copy link
Author

Choose a reason for hiding this comment

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

Description has been fixed.

fixedRate: 300 // 3%
});

vm.expectRevert();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps explicitly verify that the revert reason is because of the role?

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

assertEq(sGho.targetRate(), 400);
}

function test_setRateConfigNotAllRoles() public {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might be cleaner and more straightforward imo to break this up into multiple tests, showing that each role can set each different config param, and reverts for exactly the reason of not having the particular role after revoking it.

Copy link
Author

Choose a reason for hiding this comment

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

Test splitted into 3 different.


uint16 public constant AMPLIFICATION_DENOMINATOR = 100_00;

bytes32 public constant AMPLIFICATION_MANAGER_ROLE = keccak256('AMPLIFICATION_MANAGER_ROLE');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we add the @inheritdoc for all of these?

Copy link
Author

Choose a reason for hiding this comment

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

Added.

/// @notice Current rate parameters
RateConfig public rateConfig;

IsGHO public immutable sGHO;
Copy link
Collaborator

Choose a reason for hiding this comment

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

In the other contracts in the repo these are prefixed and then params on functions don't have prefix/suffix from what i've seen

Copy link
Author

Choose a reason for hiding this comment

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

Fixed accoarding to other contracts in this repo.

rateConfig_.fixedRate;

if (targetRate > MAX_RATE) {
revert TooBigRate();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd change to RateTooBig()

Copy link
Author

Choose a reason for hiding this comment

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

Error name changed.

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.

4 participants