Omniscia KlimaDAO Audit
KlimaToken Code Style Findings
KlimaToken Code Style Findings
KTN-01C: Function Name Typo
Type | Severity | Location |
---|---|---|
Code Style | Informational | KlimaToken.sol:L1286, L1294, L1297 |
Description:
The linked function name contains a typo.
Example:
1286function _uodateTWAPOracle( address dexPoolToUpdateFrom_, uint twapEpochPeriodToUpdate_ ) internal {1287 if ( _dexPoolsTWAPSources.contains( dexPoolToUpdateFrom_ )) {1288 twapOracle.updateTWAP( dexPoolToUpdateFrom_, twapEpochPeriodToUpdate_ );1289 }1290}1291
1292function _beforeTokenTransfer( address from_, address to_, uint256 amount_ ) internal override virtual {1293 if( _dexPoolsTWAPSources.contains( from_ ) ) {1294 _uodateTWAPOracle( from_, twapEpochPeriod );1295 } else {1296 if ( _dexPoolsTWAPSources.contains( to_ ) ) {1297 _uodateTWAPOracle( to_, twapEpochPeriod );1298 }1299 }1300}
Recommendation:
We advise it to be corrected.
Alleviation:
The KlimaDAO team considered this exhibit but opted to retain the codebase in its current state.
KTN-02C: Improper Visibility Specifier
Type | Severity | Location |
---|---|---|
Code Style | Informational | KlimaToken.sol:L1347 |
Description:
The _burnFrom
function is declared as public
and is internally invoked by burnFrom
which is also set as such.
Example:
1343function burnFrom(address account_, uint256 amount_) public virtual {1344 _burnFrom(account_, amount_);1345}1346
1347function _burnFrom(address account_, uint256 amount_) public virtual {
Recommendation:
We advise the underscore (_
) prefixed function to be set as internal
or private
to avoid redundancy in the codebase.
Alleviation:
The KlimaDAO team considered this exhibit but opted to retain the codebase in its current state.
KTN-03C: Inefficient Hash Specification
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | KlimaToken.sol:L731 |
Description:
The ERC20TOKEN_ERC1820_INTERFACE_ID
variable is assigned to a keccak256
instruction and is declared as constant
.
Example:
730// TODO comment actual hash value.731bytes32 constant private ERC20TOKEN_ERC1820_INTERFACE_ID = keccak256( "ERC20Token" );
Recommendation:
We advise it to be set as immutable
instead to cache the result of the keccak256
instruction as otherwise it is performed each time redundantly.
Alleviation:
The KlimaDAO team considered this exhibit but opted to retain the codebase in its current state.