Omniscia vfat Audit
NftFarmStrategy Static Analysis Findings
NftFarmStrategy Static Analysis Findings
NFS-01S: Illegible Numeric Value Representations
Type | Severity | Location |
---|---|---|
Code Style | ![]() | NftFarmStrategy.sol:L1008, L1010 |
Description:
The linked representations of numeric literals are sub-optimally represented decreasing the legibility of the codebase.
Example:
1008if (fee <= 500) {
Recommendation:
To properly illustrate each value's purpose, we advise the following guidelines to be followed.
For values meant to depict fractions with a base of 1e18
, we advise fractions to be utilized directly (i.e. 1e17
becomes 0.1e18
) as they are supported.
For values meant to represent a percentage base, we advise each value to utilize the underscore (_
) separator to discern the percentage decimal (i.e. 10000
becomes 100_00
, 300
becomes 3_00
and so on).
Finally, for large numeric values we simply advise the underscore character to be utilized again to represent them (i.e. 1000000
becomes 1_000_000
).
Alleviation (6ab7af3bb495b817ffec469255ea679b1813eecb):
The vfat team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.
NFS-02S: Inexistent Sanitization of Input Addresses
Type | Severity | Location |
---|---|---|
Input Sanitization | ![]() | NftFarmStrategy.sol:L91-L105 |
Description:
The linked function(s) accept address
arguments yet do not properly sanitize them.
Impact:
The presence of zero-value addresses, especially in constructor
implementations, can cause the contract to be permanently inoperable. These checks are advised as zero-value inputs are a common side-effect of off-chain software related bugs.
Example:
91constructor(92 SickleFactory factory,93 ConnectorRegistry connectorRegistry,94 INftSettingsRegistry nftSettingsRegistry_,95 Libraries memory libraries96) StrategyModule(factory, connectorRegistry) {97 nftTransferLib = libraries.nftTransferLib;98 nftZapLib = libraries.nftZapLib;99 swapLib = libraries.swapLib;100 transferLib = libraries.transferLib;101 feesLib = libraries.feesLib;102 nftSettingsLib = libraries.nftSettingsLib;103 nftSettingsRegistry = nftSettingsRegistry_;104 strategyAddress = address(this);105}
Recommendation:
We advise some basic sanitization to be put in place by ensuring that each address
specified is non-zero.
Alleviation (6ab7af3bb495b817ffec469255ea679b1813eecb):
The vfat team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.
NFS-03S: Multiple Top-Level Declarations
Type | Severity | Location |
---|---|---|
Code Style | ![]() | NftFarmStrategy.sol:L50, L62 |
Description:
The referenced file contains multiple top-level declarations that decrease the legibility of the codebase.
Example:
50library NftFarmStrategyFees {51 bytes4 constant Deposit = bytes4(keccak256("FarmDepositFee"));52 bytes4 constant Harvest = bytes4(keccak256("FarmHarvestFee"));53 bytes4 constant Compound = bytes4(keccak256("FarmCompoundFee"));54 bytes4 constant Withdraw = bytes4(keccak256("FarmWithdrawFee"));55 bytes4 constant HarvestFor = bytes4(keccak256("FarmHarvestForFee"));56 bytes4 constant CompoundFor = bytes4(keccak256("FarmCompoundForFee"));57 bytes4 constant RebalanceLow = bytes4(keccak256("RebalanceLowFee"));58 bytes4 constant RebalanceMid = bytes4(keccak256("RebalanceMidFee"));59 bytes4 constant RebalanceHigh = bytes4(keccak256("RebalanceHighFee"));60}61
62contract NftFarmStrategy 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 (6ab7af3bb495b817ffec469255ea679b1813eecb):
The vfat team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.