Omniscia Xcaliswap Audit

Minter Static Analysis Findings

Minter Static Analysis Findings

MRE-01S: Illegible Numeric Value Representations

TypeSeverityLocation
Code StyleMinter.sol:L16, L56, L90

Description:

The linked representations of numeric literals are sub-optimally represented decreasing the legibility of the codebase.

Example:

contracts/periphery/Minter.sol
16uint internal constant target_base = 10000; // 2% per week target emission

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:

The Xcaliswap team has partially fixed this issue by removing the illegible representations from one instance (L19).

MRE-02S: Inexistent Sanitization of Input Addresses

TypeSeverityLocation
Input SanitizationMinter.sol:L39-L57

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:

contracts/periphery/Minter.sol
39constructor(
40 address __voter, // the voting & distribution system
41 address __ve, // the ve(3,3) system that will be locked into
42 address __ve_dist, // the distribution system that ensures users aren't diluted
43 address _admin,
44 uint _totalSupply
45) {
46 initializer = msg.sender;
47 admin = _admin;
48 _token = underlying(IVotingEscrow(__ve).token());
49 _voter = IVoter(__voter);
50 _ve = IVotingEscrow(__ve);
51 _ve_dist = IVotingDist(__ve_dist);
52 active_period = (block.timestamp + (2*week)) / week * week;
53 last_epoch = block.timestamp;
54 boost = 100;
55 // 1.7% of the LM target (36.9% of total supply)
56 weekly = _totalSupply * 17 * 369 / 1000000;
57}

Recommendation:

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

Alleviation:

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