Combine multiple address mappings
DSCEngine.sol line 78 and 79
mapping(address user => mapping(address token => uint256 amount)) private s_collateralDeposited;
mapping(address user => uint256 amountDscMinted) private s_DSCMinted;
Above can be combined into single mapping
Gas: Instead of having 2 mappings we can combine into a single mapping of struct for the user addresses data
We will make use on a single mapping instead of 2 saving the computation, hashing of mapping storage slots computations and saving storage costs. Also since we have 2 tokens we can also remove the inner mapping ==> mapping(address token => uint256 amount to add seperate amounts deposited into user struct
Manual Analysis
struct User {
address user;
uint256 amountWBTCDeposited;
uint256 amountWETHDeposited;
uint256 amountDSCMinted;
}
mapping(address user => 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.