Incomplete documentation
There are certain areas in the code where a documentation of the mechanisms would help with comprehensibility. The undocumented function getTokens
return tokens in the reverse order:
function getTokens(uint256 _count, uint256 _offset) public view returns (Token[] memory) {
PondStorage storage $ = _getStorage();
uint256 size = $.tokenAddresses.length;
if (size < _count + _offset) _count = size - _offset;
Token[] memory result = new Token[](_count);
for (uint i = 0; i < _count; i++) {
result[i] = this.getToken($.tokenAddresses[size - _offset - 1 - i]);
}
return result;
}
For example, asking for offset zero would return the latest created token and then, going backwards, count
time. It could give unexpected results to a user, depending on how it is used.
Code maturity is very important in high-assurance projects. Undocumented code may result in developer confusion, potentially leading to future bugs should the code be modified later on.