Omniscia 0xPhase Audit
IVault Code Style Findings
IVault Code Style Findings
IVT-01C: Multiple Top-Level Declarations
Type | Severity | Location |
---|---|---|
Code Style | IVault.sol:L73, L141, L266, L279, L290 |
Description:
The referenced file contains multiple top-level declarations that decrease the legibility of the codebase.
Example:
vault/IVault.sol
73interface IVaultAccounting {74 /// @notice Adds collateral for the user75 /// @param amount The amount to add76 /// @param extraData The extra adapter data77 function addCollateral(78 uint256 amount,79 bytes memory extraData80 ) external payable;81
82 /// @notice Adds collateral for the user83 /// @param user The user address84 /// @param amount The amount to add85 /// @param extraData The extra adapter data86 function addCollateral(87 address user,88 uint256 amount,89 bytes memory extraData90 ) external payable;91
92 /// @notice Gives collateral for the user93 /// @param user The user id94 /// @param amount The amount to add95 /// @param extraData The extra adapter data96 function addCollateral(97 uint256 user,98 uint256 amount,99 bytes memory extraData100 ) external payable;101
102 /// @notice Removes collateral from the user103 /// @param amount The amount to remove104 /// @param extraData The extra adapter data105 function removeCollateral(uint256 amount, bytes memory extraData) external;106
107 /// @notice Removes all collateral from the user108 /// @param extraData The extra adapter data109 function removeAllCollateral(bytes memory extraData) external;110
111 /// @notice Mints for the user112 /// @param amount The amount to mint113 function mintUSD(uint256 amount) external;114
115 /// @notice Repays for the user116 /// @param amount The amount to repay117 function repayUSD(uint256 amount) external;118
119 /// @notice Repays for the user120 /// @param user The user address121 /// @param amount The amount to repay122 function repayUSD(address user, uint256 amount) external;123
124 /// @notice Repays for the user125 /// @param user The user id126 /// @param amount The amount to repay127 function repayUSD(uint256 user, uint256 amount) external;128
129 /// @notice Repays all for the user130 function repayAllUSD() external;131
132 /// @notice Repays all for the user133 /// @param user The user address134 function repayAllUSD(address user) external;135
136 /// @notice Repays all for the user137 /// @param user The user id138 function repayAllUSD(uint256 user) external;139}140
141interface IVaultGetters {142 /// @notice Returns if the user is solvent143 /// @param user The user id144 /// @return If the user is solvent145 function isSolvent(uint256 user) external view returns (bool);146
147 /// @notice Returns the user's debt value in dollars148 /// @param user The user id149 /// @return The debt value150 function debtValue(uint256 user) external view returns (uint256);151
152 /// @notice Returns the user's debt shares153 /// @param user The user id154 /// @return The debt shares155 function debtShares(uint256 user) external view returns (uint256);156
157 /// @notice Returns the user's deposit value in dollars158 /// @param user The user id159 /// @return The deposit value160 function depositValue(uint256 user) external view returns (uint256);161
162 /// @notice Returns the user's total deposit in token amount163 /// @param user The user id164 /// @return The total deposit165 function deposit(uint256 user) external view returns (uint256);166
167 /// @notice Returns the user's yield deposit in token amount168 /// @param user The user id169 /// @return The yield deposit170 function yieldDeposit(uint256 user) external view returns (uint256);171
172 /// @notice Returns the user's vault deposit in token amount173 /// @param user The user id174 /// @return The vault deposit175 function pureDeposit(uint256 user) external view returns (uint256);176
177 /// @notice Returns the price of the underlying asset from the oracle178 /// @return The underlying asset price179 function price() external view returns (uint256);180
181 /// @notice Returns the interest rate for the vault182 /// @return The interest rate183 function getInterest() external view returns (uint256);184
185 /// @notice Returns the total amount of collateral in the vault and invested in yield186 /// @return The amount of collateral187 function collectiveCollateral() external view returns (uint256);188
189 /// @notice Returns the system clock contract190 /// @return The system clock contract191 function systemClock() external view returns (ISystemClock);192
193 /// @notice Returns the manager contract194 /// @return The manager contract195 function manager() external view returns (Manager);196
197 /// @notice Returns the cash contract198 /// @return The cash contract199 function cash() external view returns (IPegToken);200
201 /// @notice Returns the treasury contract202 /// @return The treasury contract203 function treasury() external view returns (ITreasury);204
205 /// @notice Returns the storage contract206 /// @return The storage contract207 function varStorage() external view returns (Storage);208
209 /// @notice Returns the asset token contract210 /// @return The asset token contract211 function asset() external view returns (IERC20);212
213 /// @notice Returns the price oracle contract214 /// @return The price oracle contract215 function priceOracle() external view returns (IOracle);216
217 /// @notice Returns the max mint218 /// @return The max mint219 function maxMint() external view returns (uint256);220
221 /// @notice Returns the interest contract222 /// @return The interest contract223 function interest() external view returns (IInterest);224
225 /// @notice Returns the max collateral ratio226 /// @return The max collateral ratio227 function maxCollateralRatio() external view returns (uint256);228
229 /// @notice Returns the borrow fee230 /// @return The borrow fee231 function borrowFee() external view returns (uint256);232
233 /// @notice Returns the liquidation fee234 /// @return The liquidation fee235 function liquidationFee() external view returns (uint256);236
237 /// @notice Returns the health target minimum238 /// @return The health target minimum239 function healthTargetMinimum() external view returns (uint256);240
241 /// @notice Returns the health target maximum242 /// @return The health target minimum243 function healthTargetMaximum() external view returns (uint256);244
245 /// @notice Returns the collective debt246 /// @return The collective debt247 function collectiveDebt() external view returns (uint256);248
249 /// @notice Returns the total debt shares250 /// @return The total debt shares251 function totalDebtShares() external view returns (uint256);252
253 /// @notice Returns the last debt update timestamp254 /// @return The last debt update timestamp255 function lastDebtUpdate() external view returns (uint256);256
257 /// @notice Returns if the context is currently locked due to a sensitive function being called258 /// @return If the context is currently locked259 function contextLocked() external view returns (bool);260
261 /// @notice Returns if the market is current locked262 /// @return If the matket is currently locked263 function marketsLocked() external view returns (bool);264}265
266interface IVaultLiquidation {267 /// @notice Liquidates a user based on liquidationInfo(user)268 /// @param user The user id269 function liquidateUser(uint256 user) external;270
271 /// @notice Returns liquidation info about the user272 /// @param user The user id273 /// @return The liquidation info274 function liquidationInfo(275 uint256 user276 ) external view returns (LiquidationInfo memory);277}278
279interface IVaultSetters {280 /// @notice Sets the health target for a liquidation for the user281 /// @param healthTarget The health target282 function setHealthTarget(uint256 healthTarget) external;283
284 /// @notice Sets the yield percent for the user285 /// @param yieldPercent The yield percent286 function setYieldPercent(uint256 yieldPercent) external;287}288
289// solhint-disable-next-line no-empty-blocks290interface IVault is
Recommendation:
We advise all highlighted top-level declarations to be split into their respective code files, avoiding unnecessary imports as well as increasing the legibility of the codebase.
Alleviation (3dd3d7bf0c2693b2f9c23bacedfa420393f7ea84):
All highlighted interfaces except the main IVault
one were split to their dedicated files, rendering this exhibit applied in full.