Omniscia Xcaliswap Audit

VotingDist Static Analysis Findings

VotingDist Static Analysis Findings

VDT-01S: Illegible Numeric Value Representation

TypeSeverityLocation
Code StyleVotingDist.sol:L30, L36

Description:

The linked representation of a numeric literal is sub-optimally represented decreasing the legibility of the codebase.

Example:

contracts/periphery/VotingDist.sol
30uint[1000000000000000] public tokens_per_week;

Recommendation:

To properly illustrate the 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:

The Xcaliswap team has NOT made any changes in the source code for this issue.

VDT-02S: Inexistent Sanitization of Input Address

TypeSeverityLocation
Input SanitizationVotingDist.sol:L40-L50

Description:

The linked function accepts an address argument yet does not properly sanitize it.

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:

contracts/periphery/VotingDist.sol
40constructor(address _voting_escrow) {
41 uint _t = block.timestamp / WEEK * WEEK;
42 start_time = _t;
43 last_token_time = _t;
44 time_cursor = _t;
45 address _token = IVotingEscrow(_voting_escrow).token();
46 token = _token;
47 voting_escrow = _voting_escrow;
48 depositor = msg.sender;
49 IERC20(_token).approve(_voting_escrow, type(uint).max);
50}

Recommendation:

We advise some basic sanitization to be put in place by ensuring that the address specified is non-zero.

Alleviation:

The Xcaliswap team has introduced a require check ensuring that the address specified is non-zero.