re-al-Foundation / rwa-contracts

0 stars 0 forks source link

[RSE-04C] Redundant Query of Current Cycle #98

Closed chasebrownn closed 5 months ago

chasebrownn commented 5 months ago

RSE-04C: Redundant Query of Current Cycle

Type Severity Location
Gas Optimization RevenueStreamETH.sol:L139

Description:

The RevenueStreamETH::depositETH function will push the current cycle to the cycles entry as block.timestamp yet will dynamically query the same value via RevenueStreamETH::currentCycle.

Example:

if (revenue[block.timestamp] == 0) {
    cycles.push(block.timestamp);
    revenue[currentCycle()] = msg.value;
}

Recommendation:

We advise the block.timestamp to be utilized, optimizing the gas cost of the function.

chasebrownn commented 5 months ago

Acknowledged