Open danesposi opened 1 year ago
Greetings 2PI team.
On the function massUpdatePools I suggest you store the poolInfo.length value in a variable before the execution of the for loop, as this prevents the program to access and load the storage at every iteration, thus saving some gas.
massUpdatePools
poolInfo.length
https://github.com/2pinetwork/contracts/blob/ad2308267fc0f7f2ff6d8e4b5f9632693b7f2412/contracts/Archimedes.sol#L144-L149
Could be:
function massUpdatePools() public { uint256 nPoolInfo = poolInfo.length for (uint pid = 0; pid < nPoolInfo; ++pid) { updatePool(pid); if (_outOfGasForLoop()) { break; } } }
Hey sorry for the delay. I didn't receive the notification, thanks for that :+1: will improve in the coming days
Greetings 2PI team.
On the function
massUpdatePools
I suggest you store thepoolInfo.length
value in a variable before the execution of the for loop, as this prevents the program to access and load the storage at every iteration, thus saving some gas.https://github.com/2pinetwork/contracts/blob/ad2308267fc0f7f2ff6d8e4b5f9632693b7f2412/contracts/Archimedes.sol#L144-L149
Could be: