Omniscia Bluejay Finance Audit
StakedToken Code Style Findings
StakedToken Code Style Findings
STN-01C: Inexistent Visibility Specifiers
Type | Severity | Location |
---|---|---|
Code Style | StakedToken.sol:L13, L14 |
Description:
The linked variables have no visibility specifiers explicitly set.
Example:
13uint256 constant WAD = 10**18;14uint256 constant RAY = 10**27;
Recommendation:
We advise them to be set to avoid potential compilation discrepancies in the future as the current behaviour is for the compiler to assign one automatically which may deviate between pragma
versions.
Alleviation:
The private
visibility specifier has been introduced for both referenced variables alleviating this exhibit.
STN-02C: Redundant Safe Arithmetics
Type | Severity | Location |
---|---|---|
Gas Optimization | StakedToken.sol:L76, L105, L218, L240 |
Description:
The linked subtractions are guaranteed to never underflow based on the conditionals that surround them.
Example:
236require(237 currentAllowance >= subtractedValue,238 "ERC20: decreased allowance below zero"239);240_approve(msg.sender, spender, currentAllowance - subtractedValue);
Recommendation:
We advise them to be wrapped to unchecked
code blocks optimizing their gas cost.
Alleviation:
All relevant statements have been wrapped in unchecked
code blocks optimizing their execution cost.
STN-03C: Variable Mutability Specifiers
Type | Severity | Location |
---|---|---|
Gas Optimization | StakedToken.sol:L48, L49 |
Description:
The linked variables are assigned to only once during the contract's constructor
.
Example:
39constructor(40 string memory _name,41 string memory _symbol,42 address _BLU,43 address _treasury,44 uint256 _interestRate45) {46 name = _name;47 symbol = _symbol;48 BLU = IERC20(_BLU);49 treasury = ITreasury(_treasury);50
51 lastInterestRateUpdate = block.timestamp;52 interestRate = _interestRate;53 accumulatedRates = RAY;54 minimumNormalizedBalance = WAD / 10**3; // 1/1000th of a BLU55
56 emit UpdatedInterestRate(interestRate);57 emit UpdatedMinimumNormalizedBalance(minimumNormalizedBalance);58}
Recommendation:
We advise them to be set as immutable
greatly optimizing the codebase.
Alleviation:
Both variables were properly set as immutable
optimizing the codebase.