@@ -3,90 +3,107 @@ pragma solidity ^0.8.19;
33
44/**
55 * @title IsGHO Interface
6- * @dev Interface for the sGHO contract, combining ERC4626, ERC20Permit, and custom logic.
6+ * @notice Interface for the sGHO contract, which is an ERC4626 vault for GHO tokens.
7+ * @dev This interface combines functionalities from ERC4626 for a tokenized vault,
8+ * ERC20Permit for gas-less approvals, and includes custom logic for yield generation and administrative roles.
79 */
810interface IsGHO {
911 // --- Custom Errors ---
1012
1113 /**
12- * @dev Invalid signature.
14+ * @notice Thrown when an invalid signature is provided .
1315 */
1416 error InvalidSignature ();
1517
1618 /**
17- * @dev Thrown when a direct ETH transfer is attempted.
19+ * @notice Thrown when a direct ETH transfer is attempted.
1820 */
1921 error NoEthAllowed ();
2022
2123 /**
22- * @dev Only caller with FUNDS_ADMIN role can call
24+ * @notice Thrown when a function is called by an address that does not have the FUNDS_ADMIN role.
2325 */
2426 error OnlyFundsAdmin ();
2527
2628 /**
27- * @dev Only YieldManager can call
29+ * @notice Thrown when a function is called by an address that does not have the YIELD_MANAGER role.
2830 */
2931 error OnlyYieldManager ();
3032
3133 /**
32- * @dev Throws if the contract is not initialized.
34+ * @notice Thrown if the contract is not initialized.
3335 */
3436 error NotInitialized ();
3537
3638 /**
37- * @dev Throws if the GHO token is being rescued .
39+ * @notice Thrown when an attempt is made to rescue the underlying GHO token .
3840 */
3941 error CannotRescueGHO ();
4042
4143 /**
42- * @dev Throws if the rate is greater than 50%.
44+ * @notice Thrown if the target rate is set to a value greater than 50%.
4345 */
4446 error RateMustBeLessThan50Percent ();
4547
4648 // --- State Variables (as view functions) ---
4749
4850 /**
49- * @dev Returns the address of the underlying GHO token used by the vault.
51+ * @notice Returns the address of the GHO token used as the underlying asset in the vault.
52+ * @return The address of the GHO token.
5053 */
5154 function gho () external view returns (address );
5255
5356 /**
54- * @dev Returns the chain ID where the contract was deployed. Used for EIP-712 signature validation.
57+ * @notice Returns the chain ID of the network where the contract is deployed.
58+ * @dev This is used for EIP-712 signature validation to prevent replay attacks across different chains.
59+ * @return The chain ID.
5560 */
5661 function deploymentChainId () external view returns (uint256 );
5762
5863 /**
59- * @dev Returns the EIP-712 version string.
64+ * @notice Returns the EIP-712 version for the permit signature.
65+ * @return The version string.
6066 */
6167 function VERSION () external view returns (string memory );
6268
6369 /**
64- * @dev Returns the current yield index.
70+ * @notice Returns the current yield index, representing the accumulated yield.
71+ * @dev This index is used to calculate the value of sGHO in terms of GHO.
72+ * @return The current yield index.
6573 */
6674 function yieldIndex () external view returns (uint256 );
6775
6876 /**
69- * @dev Returns the current target rate.
77+ * @notice Returns the current target annual percentage rate (APR) for yield generation.
78+ * @dev The rate is expressed in basis points (1% = 100).
79+ * @return The target rate in basis points.
7080 */
7181 function targetRate () external view returns (uint256 );
7282
7383 /**
74- * @dev Returns the last update timestamp.
84+ * @notice Returns the timestamp of the last time the yield index was updated.
85+ * @return The Unix timestamp of the last update.
7586 */
7687 function lastUpdate () external view returns (uint256 );
7788
7889 /**
79- * @dev Returns the FUNDS_ADMIN role identifier.
90+ * @notice Returns the role identifier for the Funds Admin.
91+ * @dev This role has permissions to manage funds, such as rescuing tokens.
92+ * @return The keccak256 hash of "FUNDS_ADMIN_ROLE".
8093 */
8194 function FUNDS_ADMIN_ROLE () external view returns (bytes32 );
8295
8396 /**
84- * @dev Returns the YIELD_MANAGER role identifier.
97+ * @notice Returns the role identifier for the Yield Manager.
98+ * @dev This role has permissions to update the target rate.
99+ * @return The keccak256 hash of "YIELD_MANAGER_ROLE".
85100 */
86101 function YIELD_MANAGER_ROLE () external view returns (bytes32 );
87102
88103 /**
89- * @dev Returns the permit typehash.
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.
90107 */
91108 function PERMIT_TYPEHASH () external view returns (bytes32 );
92109
@@ -100,15 +117,19 @@ interface IsGHO {
100117 // Note: Standard ERC20Permit functions (permit, nonces, DOMAIN_SEPARATOR) are inherited via IERC20Permit.
101118
102119 /**
103- * @dev Initialize the contract.
120+ * @notice Initializes the sGHO contract.
121+ * @dev This function can only be called once. It sets up initial roles and configurations.
122+ * While the function is marked as `payable`, it is designed to reject any attached Ether value.
104123 */
105124 function initialize () external payable ;
106125
107126 /**
108- * @dev Overload of the standard permit function to accept v, r, s signature components directly.
127+ * @notice Overload of the standard ERC20Permit `permit` function.
128+ * @dev This version accepts the v, r, and s components of the signature directly,
129+ * which can be useful for platforms that do not handle the single `bytes` signature format.
109130 * @param owner The owner of the tokens.
110131 * @param spender The address to grant allowance to.
111- * @param value The amount of allowance.
132+ * @param value The amount of allowance to grant .
112133 * @param deadline The timestamp after which the permit is invalid.
113134 * @param v The recovery ID of the signature.
114135 * @param r The R component of the signature.
@@ -125,31 +146,35 @@ interface IsGHO {
125146 ) external ;
126147
127148 /**
128- * @dev Set the target rate for yield generation.
129- * @param newRate The new target rate in basis points (e.g., 1000 = 10%).
149+ * @notice Sets the target rate for yield generation.
150+ * @dev This function can only be called by an address with the YIELD_MANAGER role.
151+ * The new rate must be less than 50% (5000 basis points).
152+ * @param newRate The new target rate in basis points (e.g., 1000 for 10%).
130153 */
131154 function setTargetRate (uint256 newRate ) external ;
132155
133156 /**
134- * @dev Get the vault APR.
135- * @return The current vault APR.
157+ * @notice Calculates and returns the current vault Annual Percentage Rate ( APR) .
158+ * @return The current vault APR, in basis points (1% = 100) .
136159 */
137160 function vaultAPR () external view returns (uint256 );
138161
139162 /**
140- * @dev Rescue ERC20 tokens from the contract.
163+ * @notice Rescues ERC20 tokens that have been accidentally sent to this contract.
164+ * @dev This function can only be called by an address with the FUNDS_ADMIN role.
165+ * It prevents the rescue of the underlying GHO token to protect the vault's assets.
141166 * @param erc20Token The address of the ERC20 token to rescue.
142- * @param to The recipient address.
143- * @param amount The amount to rescue.
167+ * @param to The address where the rescued tokens will be sent .
168+ * @param amount The amount of tokens to rescue.
144169 */
145170 function rescueERC20 (address erc20Token , address to , uint256 amount ) external ;
146171
147172 // --- Events ---
148173
149174 /**
150- * @dev Emitted when ERC20 tokens are rescued from the contract.
151- * @param caller The address initiating the rescue.
152- * @param token The address of the ERC20 token rescued .
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.
153178 * @param to The recipient address of the rescued tokens.
154179 * @param amount The amount of tokens rescued.
155180 */
@@ -161,7 +186,7 @@ interface IsGHO {
161186 );
162187
163188 /**
164- * @dev Receive function to reject direct Ether transfers.
189+ * @notice The receive function is implemented to reject direct Ether transfers to the contract .
165190 */
166191 receive () external payable ;
167192}
0 commit comments