Omniscia Xcaliswap Audit

SwapFactory Code Style Findings

SwapFactory Code Style Findings

SFY-01C: Inefficient Fee Definition System

TypeSeverityLocation
Gas OptimizationSwapFactory.sol:L15, L28-L29

Description:

The fee mapping is meant to indicate what fee should be applied depending on whether a particular pair represents a stable or volatile pair. The way this is achieved is inefficient as the fee cannot be re-set in the contract meaning that two constant declarations could have been utilized instead with a public fee function.

Example:

contracts/Core/SwapFactory.sol
25constructor(address _feeCollector) {
26 pauser = msg.sender;
27 isPaused = false;
28 fee[true] = 369; // 0.0369% for stable swaps (hundredth of a basis point / 369/1000000)
29 fee[false] = 2700; // 0.27% for vaiable swaps (hundredth of a basis point / 2700/1000000)
30 feeCollector = _feeCollector;
31}

Recommendation:

We advise the mapping to be omitted in favour of the function described above greatly increasing the gas cost of the contract.

Alleviation:

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

SFY-02C: Inexistent Error Messages

TypeSeverityLocation
Code StyleSwapFactory.sol:L38, L43, L48

Description:

The linked require checks have no error messages explicitly defined.

Example:

contracts/Core/SwapFactory.sol
38require(msg.sender == pauser);

Recommendation:

We advise each to be set so to increase the legibility of the codebase and aid in validating the require checks' conditions.

Alleviation:

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