Combine multiple address mappings
Staking.sol 3 mappings can be combined
mapping(address => uint256) public supplyIndex;
/// @notice mapping of user balances
mapping(address => uint256) public balances;
/// @notice mapping of user claimable rewards
mapping(address => uint256) public claimable;
Gas: Instead of having 3 mappings we can combine into a single mapping of struct for the address user and their info on claims, balances et.
We will make use on a single mapping instead of 3 saving the computation, hashing of mapping storage slots computations and saving storage costs.
Manual Analysis
Staking.sol change to something similar to the below
struct User {
address user;
uint256 supplyIndex;
uint256 balances;
uint256 claimable;
}
mapping(address => User) userInfo;
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.