Omniscia Glimpse Audit
GLMS_BSC Code Style Findings
GLMS_BSC Code Style Findings
GLM-01C: Redundant User-Defined Getters
Type | Severity | Location |
---|---|---|
Code Style | Informational | GLMS_BSC.sol:L54-L77 |
Description:
The linked getter functions all return their respective variables with an underscore (_
) prefix.
Example:
contracts/GLMS_BSC.sol
51/**52* @dev Returns the token decimals.53*/54function decimals() external view override returns (uint8) {55 return _decimals;56}57
58/**59* @dev Returns the token symbol.60*/61function symbol() external view override returns (string memory) {62 return _symbol;63}64
65/**66* @dev Returns the token name.67*/68function name() external view override returns (string memory) {69 return _name;70}71
72/**73* @dev See {BEP20-totalSupply}.74*/75function totalSupply() external view override returns (uint256) {76 return _totalSupply;77}
Recommendation:
We advise them to be dropped and the inner variables to be renamed with the underscore omitted and set as public
, ensuring that the getter functions are generated by the compiler instead.
Alleviation:
The variables were properly set to public
after removal of their manual getter functions.
GLM-02C: Variable Mutability Specifiers
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | GLMS_BSC.sol:L14-L17, L25-L28 |
Description:
The linked variables are assigned to only once during the contract's constructor
and are done so to literal values.
Example:
contracts/GLMS_BSC.sol
24constructor() {25 _name = "Glimpse";26 _symbol = "GLMS";27 _decimals = 18;28 _totalSupply = 360000000 * 10 ** 18;29 _balances[_msgSender()] = _totalSupply;30 31 emit Transfer(address(0), _msgSender(), _totalSupply);32}
Recommendation:
We advise the assignments to be relocated to the declarations and the variables to be set as constant
, greatly optimizing the codebase.
Alleviation:
The assignments were properly relocated, however, the variables were not set to constant
.