Platform: Code4rena
Start Date: 03/05/2023
Pot Size: $60,500 USDC
Total HM: 25
Participants: 114
Period: 8 days
Judge: Picodes
Total Solo HM: 6
Id: 234
League: ETH
Rank: 97/114
Findings: 1
Award: $22.28
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: JCN
Also found by: 0x73696d616f, 0xSmartContract, 0xnev, Audit_Avengers, Aymen0909, Blckhv, Eurovickk, K42, Kenshin, Rageur, Raihan, ReyAdmirado, SAAJ, SAQ, Shubham, Tomio, Walter, ayden, codeslide, descharre, dicethedev, hunter_w3b, j4ld1na, kaveyjoe, okolicodes, patitonar, petrichor, pontifex, yongskiws
22.2767 USDC - $22.28
Title: Unnecessary variable declaration
Proof of Concept: RewardsManager.sol#L436 RewardsManager.sol#L444 Consider declare this variable directly instead, which can save gas costs by reducing unnecessary variable declarations.
Recommended Mitigation Steps:
for (uint256 i = 0; i < positionIndexes_.length; ) { uint256 bucketIndex = positionIndexes_[i]; //declare here BucketState memory bucketSnapshot = stakes[tokenId_].snapshot[bucketIndex]; if (epoch_ != stakingEpoch_) { // if staked in a previous epoch then use the initial exchange rate of epoch uint256 bucketRate = bucketExchangeRates[ajnaPool_][bucketIndex][epoch_]; //declare here } else {
#0 - c4-judge
2023-05-17T10:50:52Z
Picodes marked the issue as grade-b