Closed code423n4 closed 2 years ago
WatchPug
https://github.com/code-423n4/2022-01-trader-joe/blob/a1579f6453bc4bf9fb0db9c627beaa41135438ed/contracts/RocketJoeStaking.sol#L39-L39
uint256 private PRECISION;
https://github.com/code-423n4/2022-01-trader-joe/blob/a1579f6453bc4bf9fb0db9c627beaa41135438ed/contracts/RocketJoeStaking.sol#L57-L76
function initialize( IERC20Upgradeable _joe, RocketJoeToken _rJoe, uint256 _rJoePerSec, uint256 _startTime ) public initializer { // ... PRECISION = 1e18; // ... }
Some storage variables include PRECISION will never be changed and they should not be.
PRECISION
Changing them to constant can save gas.
constant
Can’t have constants in proxy contracts
Per sponsor, this is invalid because the contract in question is proxied.
Handle
WatchPug
Vulnerability details
https://github.com/code-423n4/2022-01-trader-joe/blob/a1579f6453bc4bf9fb0db9c627beaa41135438ed/contracts/RocketJoeStaking.sol#L39-L39
https://github.com/code-423n4/2022-01-trader-joe/blob/a1579f6453bc4bf9fb0db9c627beaa41135438ed/contracts/RocketJoeStaking.sol#L57-L76
Some storage variables include
PRECISION
will never be changed and they should not be.Changing them to
constant
can save gas.