Omniscia Xcaliswap Audit

Math Code Style Findings

Math Code Style Findings

MHT-01C: Code Duplication

TypeSeverityLocation
Code StyleMath.sol:L15-L17, L19-L30

Description:

The linked code exists in the Math implementation under periphery.

Example:

contracts/Core/libraries/Math.sol
15function min(uint a, uint b) internal pure returns (uint) {
16 return a < b ? a : b;
17}
18
19function sqrt(uint y) internal pure returns (uint z) {
20 if (y > 3) {
21 z = y;
22 uint x = y / 2 + 1;
23 while (x < z) {
24 z = x;
25 x = (y / x + x) / 2;
26 }
27 } else if (y != 0) {
28 z = 1;
29 }
30}

Recommendation:

We advise code duplication in the codebase to be minimized and proper inheritance and naming conventions to be used instead to denote new functionality introduced to existing libraries.

Alleviation:

The Xcaliswap team evaluated this exhibit but opted not to apply any changes for it in the current iteration of the protocol.