getStrategyDebt() and getStrategyAssets() return the totalDebt of a strategy and might be improved with more similar names to avoid confusion over debt vs. assets.
NatSpec is incomplete for some functions, such as missing return value descriptions for beforeWithdraw()/excessDebt/_excessDebt and no NatSpec for _removeStrategy() in GVault
The debt variable is not used for any purpose. It may be better to simply compare debtPayment to the value of _excessDebt(msg.sender) to replace the safeMath in this line.
Inaccurate NatSpec for withdraw()'s _amount (better would be "asset quantity needed by Vault if not holding enough asset balance") and missing NatSpec for return values
Consider a better name than "controller" or "ctrl" in GToken for the GTranche address, because the word "controller" does not appear anywhere in GTranche
Assets in Convex are not locked and therefore are not used to vote in reward distribution. There are potential downsides to this approach and this choice should be documented somewhere in Gro's documentation. The strategy that ConvexStrategy was inspired by does lock some tokens for voting.
_claimableRewards() in ConvexStrategy does not return a value if MIN_REWARD_SELL_AMOUNT is not met and this if statement is not entered
Consider replacing slippage in divestAll() with the baseSlippage value used elsewhere because baseSlippage can be modified by the owner unlike slippage
estimatedTotalAssets() should replace _estimatedTotalAssets(true) with _estimatedTotalAssets(false) because the rewards return value is not needed
The NatSpec in CurveOracle uses the term "yield token" to mostly refer to 3CRV while FixedTokensCurve NatSpec uses "yield token" to mostly refer to GVault shares. Consider terms that more clearly differentiate the tokens.
General nitpicks with comments, naming, and typos in the contracts.
Technical Details
withdrawalQueue(uint256 i)
towithdrawalQueueAt(uint256 i)
andwithdrawalQueue()
tofullWithdrawalQueue()
.getStrategyDebt()
andgetStrategyAssets()
return thetotalDebt
of a strategy and might be improved with more similar names to avoid confusion over debt vs. assets.beforeWithdraw()
/excessDebt
/_excessDebt
and no NatSpec for_removeStrategy()
in GVaultdepositIntoTrancheForCaller()
is missing a comment that _token_index of 3 or greater is 3CRVsetUtilizationThreshold()
(note utilization with a 'z') sets the variableutilisationThreshold
(note utilisation with 's') and there is a functionutilization()
(note utilization with a 'z')((_lockedProfit / _releaseTime) * _timeSinceLastReport)
to((_lockedProfit * _timeSinceLastReport) / _releaseTime)
to match Vault.vy approachemergencyExit()
functionemergency
boolean function argument is missing a NatSpec comment as is_calcFactor()
in GTranche and_loss
in PnLdebt
variable is not used for any purpose. It may be better to simply comparedebtPayment
to the value of_excessDebt(msg.sender)
to replace the safeMath in this line.withdraw()
's_amount
(better would be "asset quantity needed by Vault if not holding enough asset balance") and missing NatSpec for return valuesutilisationThreshold
._claimableRewards()
in ConvexStrategy does not return a value ifMIN_REWARD_SELL_AMOUNT
is not met and this if statement is not enteredslippage
indivestAll()
with thebaseSlippage
value used elsewhere becausebaseSlippage
can be modified by the owner unlikeslippage
estimatedTotalAssets()
should replace_estimatedTotalAssets(true)
with_estimatedTotalAssets(false)
because the rewards return value is not neededfactor
in_calcTrancheValue()
andfactor
elsewhere in GTranche_calcTokenAmount()
can remove the_deposit
boolean function argument because it is never used for anything useful in the function_tranche
bool function argument from_calcTrancheValue()
if (_factor == 0)
logic from_calcTrancheValue()
because this can never happen based on current contract logiclastDistribution
could be uint32 instead of uint64_calcFees()
to_gainSubFees()
Impact
Informational.
Recommendation
Consider fixing nitpicks.