Skip to content

Commit 2aac34d

Browse files
authored
Merge pull request #1 from adamazad/adamazad-sgho-standalone-review
sgho: address comments
2 parents 3862119 + 942920c commit 2aac34d

File tree

4 files changed

+265
-395
lines changed

4 files changed

+265
-395
lines changed

src/contracts/extensions/sgho/interfaces/IsGHO.sol

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,36 @@ interface IsGHO {
4141
error CannotRescueGHO();
4242

4343
/**
44-
* @notice Thrown if the target rate is set to a value greater than 50%.
44+
* @notice Thrown if the target rate is set to a value greater than the max rate.
4545
*/
46-
error RateMustBeLessThan50Percent();
46+
error RateMustBeLessThanMaxRate();
47+
48+
/**
49+
* @notice Thrown when a deposit or mint would exceed the total supply cap.
50+
*/
51+
error SupplyCapExceeded();
52+
53+
// --- Events ---
54+
55+
/**
56+
* @notice Emitted when the target rate is updated.
57+
* @param newRate The new target rate.
58+
*/
59+
event TargetRateUpdated(uint256 newRate);
60+
61+
/**
62+
* @notice Emitted when ERC20 tokens are rescued from the contract.
63+
* @param caller The address that initiated the rescue operation.
64+
* @param token The address of the rescued ERC20 token.
65+
* @param to The recipient address of the rescued tokens.
66+
* @param amount The amount of tokens rescued.
67+
*/
68+
event ERC20Rescued(
69+
address indexed caller,
70+
address indexed token,
71+
address indexed to,
72+
uint256 amount
73+
);
4774

4875
// --- State Variables (as view functions) ---
4976

@@ -53,19 +80,19 @@ interface IsGHO {
5380
*/
5481
function gho() external view returns (address);
5582

83+
/**
84+
* @notice Returns the total supply cap of the vault.
85+
* @return The total supply cap.
86+
*/
87+
function supplyCap() external view returns (uint256);
88+
5689
/**
5790
* @notice Returns the chain ID of the network where the contract is deployed.
5891
* @dev This is used for EIP-712 signature validation to prevent replay attacks across different chains.
5992
* @return The chain ID.
6093
*/
6194
function deploymentChainId() external view returns (uint256);
6295

63-
/**
64-
* @notice Returns the EIP-712 version for the permit signature.
65-
* @return The version string.
66-
*/
67-
function VERSION() external view returns (string memory);
68-
6996
/**
7097
* @notice Returns the current yield index, representing the accumulated yield.
7198
* @dev This index is used to calculate the value of sGHO in terms of GHO.
@@ -100,13 +127,6 @@ interface IsGHO {
100127
*/
101128
function YIELD_MANAGER_ROLE() external view returns (bytes32);
102129

103-
/**
104-
* @notice Returns the EIP-712 type hash for the permit signature.
105-
* @dev This is used to construct the domain separator for EIP-712 signatures.
106-
* @return The EIP-712 type hash for the permit.
107-
*/
108-
function PERMIT_TYPEHASH() external view returns (bytes32);
109-
110130
// --- Functions ---
111131

112132
// Note: Standard ERC4626 functions (asset, totalAssets, convertToShares, convertToAssets,
@@ -121,7 +141,12 @@ interface IsGHO {
121141
* @dev This function can only be called once. It sets up initial roles and configurations.
122142
* While the function is marked as `payable`, it is designed to reject any attached Ether value.
123143
*/
124-
function initialize() external payable;
144+
function initialize(
145+
address gho_,
146+
address aclManager_,
147+
uint256 maxTargetRate_,
148+
uint256 supplyCap_
149+
) external payable;
125150

126151
/**
127152
* @notice Overload of the standard ERC20Permit `permit` function.
@@ -171,20 +196,6 @@ interface IsGHO {
171196

172197
// --- Events ---
173198

174-
/**
175-
* @notice Emitted when ERC20 tokens are rescued from the contract.
176-
* @param caller The address that initiated the rescue operation.
177-
* @param token The address of the rescued ERC20 token.
178-
* @param to The recipient address of the rescued tokens.
179-
* @param amount The amount of tokens rescued.
180-
*/
181-
event ERC20Rescued(
182-
address indexed caller,
183-
address indexed token,
184-
address indexed to,
185-
uint256 amount
186-
);
187-
188199
/**
189200
* @notice The receive function is implemented to reject direct Ether transfers to the contract.
190201
*/

0 commit comments

Comments
 (0)