Skip to content

Commit 9e7686f

Browse files
committed
fix: use SafeMath more consistently
1 parent 37d70a5 commit 9e7686f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

contracts/gateway/L1GraphTokenGateway.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ contract L1GraphTokenGateway is GraphTokenGateway, L1ArbitrumMessenger {
212212
// makes sure only sufficient ETH is supplied as required for successful redemption on L2
213213
// if a user does not desire immediate redemption they should provide
214214
// a msg.value of AT LEAST maxSubmissionCost
215-
uint256 expectedEth = maxSubmissionCost + (_maxGas * _gasPriceBid);
215+
uint256 expectedEth = maxSubmissionCost.add(_maxGas.mul(_gasPriceBid));
216216
require(msg.value >= expectedEth, "WRONG_ETH_VALUE");
217217
}
218218
outboundCalldata = getOutboundCalldata(_l1Token, from, _to, _amount, extraData);

contracts/reservoir/L1Reservoir.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,14 +298,14 @@ contract L1Reservoir is L1ReservoirV1Storage, Reservoir {
298298
* @param _globalDelta New global rewards (i.e. rewards on L1 and L2) since the last update block
299299
*/
300300
function snapshotAccumulatedRewards(uint256 _globalDelta) internal {
301-
issuanceBase = issuanceBase + _globalDelta;
301+
issuanceBase = issuanceBase.add(_globalDelta);
302302
// Reimplementation of getAccumulatedRewards but reusing the _globalDelta calculated above,
303303
// to save gas
304-
accumulatedLayerRewards =
305-
accumulatedLayerRewards +
304+
accumulatedLayerRewards = accumulatedLayerRewards.add(
306305
_globalDelta.mul(FIXED_POINT_SCALING_FACTOR.sub(l2RewardsFraction)).div(
307306
FIXED_POINT_SCALING_FACTOR
308-
);
307+
)
308+
);
309309
lastRewardsUpdateBlock = block.number;
310310
}
311311

contracts/reservoir/Reservoir.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ abstract contract Reservoir is GraphUpgradeable, ReservoirV1Storage, IReservoir
3636
*/
3737
function getAccumulatedRewards(uint256 _blocknum) public view override returns (uint256) {
3838
// R(t) = R(t0) + (DeltaR(t, t0))
39-
return accumulatedLayerRewards + getNewRewards(_blocknum);
39+
return accumulatedLayerRewards.add(getNewRewards(_blocknum));
4040
}
4141

4242
/**

0 commit comments

Comments
 (0)