Omniscia Nexera Audit
DataIndex Code Style Findings
DataIndex Code Style Findings
DIX-01C: Syntactic Sugar Optimization
Type | Severity | Location |
---|---|---|
Gas Optimization | ![]() | DataIndex.sol:L79, L80, L84, L85 |
Description:
The referenced functions will always cast the input address
type to the IDataObject
interface.
Example:
contracts/DataIndex.sol
78///@inheritdoc IDataIndex79function read(address dobj, DataPoint dp, bytes4 operation, bytes calldata data) external view returns (bytes memory) {80 return IDataObject(dobj).read(dp, operation, data);81}82
83///@inheritdoc IDataIndex84function write(address dobj, DataPoint dp, bytes4 operation, bytes calldata data) external onlyApprovedDM(dp) returns (bytes memory) {85 return IDataObject(dobj).write(dp, operation, data);86}
Recommendation:
We advise the function's input to be set to the IDataObject
data type directly, optimizing the code's syntax.
Alleviation:
The referenced syntax has been optimized as advised, updating the DataIndex::read
and DataIndex::write
functions to accept an IDataObject
argument directly.