In general, in all the functions of smart contract, Arrays is used to store the information of users and positions. So, we had to search in all arrays length to do any task, and even in some cases, all Array`s members are shifted. For example
function deleteHolder(address _holder) private {
if (holders[i] == _holder) {
holders[i] = holders[holders.length - 1];
holders.pop();
}
}
}
And it is not possible to control the number of arras’s member in reality and it depends on the number of users and tokens. This issue has a great negative effect on gas consumption of functions. It is suggested to refactor the whole contract and use mapping instead of array.
It highly impact on gas which spends by functions.
Manual
Using Mapping to store data instead of arrays.
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.