Omniscia Gamma Strategies Audit
GammaController Static Analysis Findings
GammaController Static Analysis Findings
GCR-01S: Function State Mutability Optimizations
Type | Severity | Location |
---|---|---|
Gas Optimization | ![]() | GammaController.sol:L85, L91 |
Description:
The linked functions can have their mutability specifiers optimized.
Example:
contracts/adapters/tokemak/GammaController.sol
85function _getCoinsBalances(address lpTokenAddress) internal returns (uint256[N_COINS] memory coinsBalances) {86 coinsBalances[0] = ITokeHypervisor(lpTokenAddress).token0().balanceOf(manager);87 coinsBalances[1] = ITokeHypervisor(lpTokenAddress).token1().balanceOf(manager);88 return coinsBalances;89}90
91function _compareCoinsBalances(uint256[N_COINS] memory balancesBefore, uint256[N_COINS] memory balancesAfter, uint256[N_COINS] memory amounts) internal {92 for (uint256 i = 0; i < N_COINS; i++) {93 if (amounts[i] > 0) {94 require(balancesBefore[i] < balancesAfter[i], "BALANCE_MUST_INCREASE");95 }96 }97}
Recommendation:
We advise the first linked instance to be set as view
and the latter as pure
, optimizing their execution cost.
Alleviation:
Both function mutability specifiers were properly optimized as advised.
GCR-02S: Redundant Function Implementation
Type | Severity | Location |
---|---|---|
Gas Optimization | ![]() | GammaController.sol:L80-L83 |
Description:
The linked function remains unutilized in the codebase.
Example:
contracts/adapters/tokemak/GammaController.sol
80// @dev pool address is lp token address for gamma81function _getLPToken(address lpTokenAddress) internal returns (address) {82 return lpTokenAddress;83}
Recommendation:
We advise it to be safely omitted
Alleviation:
The function was safely omitted.
GCR-03S: Variable Shadowing
Type | Severity | Location |
---|---|---|
Language Specific | ![]() | GammaController.sol:L20, L21 |
Description:
The linked variables shadow the manager
and addressRegistry
declarations of BaseController
.
Example:
contracts/adapters/tokemak/GammaController.sol
19constructor(20 address manager,21 address addressRegistry22) public BaseController(manager, addressRegistry) { }
Recommendation:
We advise them to be renamed with a prefix / suffix underscore (_
) to avoid the naming collision.
Alleviation:
Only the addressRegistry
member was renamed with a prefix underscore thus rendering this exhibit partially alleviated.