storing a storage (state) variable ,which is used once, in memory is not gas efficient
storing a storage variable in the memory cost one SLOAD and MSTORE and when use the memory variable it will cost MLOAD .
if the state variable s_collateralDeposited[user][token]
used once it will cost only SLOAD . which will save gas
gas saved = 6 gas per iteration .
do not store s_collateralDeposited[user][token]
in memory and perform the loop like this
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.