The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: low
Invalid

Bad method for data saving

Summary

Vulnerability Details:

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.

Impact

It highly impact on gas which spends by functions.

Tools Used:

Manual

Recommendations:

Using Mapping to store data instead of arrays.

Updates

Lead Judging Commences

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

informational/invalid

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.