Omniscia Xcaliswap Audit
Token Code Style Findings
Token Code Style Findings
TNE-01C: Inexplicable Mint Instruction
Type | Severity | Location |
---|---|---|
Code Style | ![]() | Token.sol:L21 |
Description:
The linked _mint
statement will mint a total of 0
units to the msg.sender
which is inexplicable.
Example:
21_mint(msg.sender, 0);
Recommendation:
We advise a default initial supply value to be declared as a constant
and utilized here as it currently serves no purpose.
Alleviation:
The Xcaliswap team evaluated this exhibit but opted not to apply any changes for it in the current iteration of the protocol.
TNE-02C: Inefficient mapping
Lookups
Type | Severity | Location |
---|---|---|
Gas Optimization | ![]() | Token.sol:L55, L57 |
Description:
The linked statements perform key-based lookup operations on mapping
declarations from storage multiple times for the same key redundantly.
Example:
54function transferFrom(address _from, address _to, uint _value) external returns (bool) {55 uint allowed_from = allowance[_from][msg.sender];56 if (allowed_from != type(uint).max) {57 allowance[_from][msg.sender] -= _value;58 }59 return _transfer(_from, _to, _value);60}
Recommendation:
As the lookups internally perform an expensive keccak256
operation, we advise the lookups to be cached wherever possible to a single local declaration that either holds the value of the mapping
in case of primitive types or holds a storage
pointer to the struct
contained.
Alleviation:
The Xcaliswap team evaluated this exhibit but opted not to apply any changes for it in the current iteration of the protocol.
TNE-03C: Inexistent Error Messages
Type | Severity | Location |
---|---|---|
Code Style | ![]() | Token.sol:L26, L63 |
Description:
The linked require
checks have no error messages explicitly defined.
Example:
26require(msg.sender == minter);
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.
TNE-04C: Inexistent Override of Interface
Type | Severity | Location |
---|---|---|
Code Style | ![]() | Token.sol:L4 |
Description:
While the Token
contract is EIP-20 compliant, it should properly illustrate this trait by inheriting an IERC20
interface either as a local dependency or imported from a third-party library like OpenZeppelin.
Example:
1// SPDX-License-Identifier: GPL-3.0-or-later2pragma solidity 0.8.11;3
4contract Token {
Recommendation:
We advise this inheritance structure to be applied as otherwise the standards the contract is meant to conform to are unclear to its readers.
Alleviation:
The Xcaliswap team evaluated this exhibit but opted not to apply any changes for it in the current iteration of the protocol.