diff --git a/contracts/extensions/RONTransferHelper.sol b/contracts/extensions/RONTransferHelper.sol index 766110845..fe8ce64b1 100644 --- a/contracts/extensions/RONTransferHelper.sol +++ b/contracts/extensions/RONTransferHelper.sol @@ -37,4 +37,15 @@ abstract contract RONTransferHelper { function _unsafeSendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) { (_success, ) = _recipient.call{ value: _amount }(""); } + + /** + * @dev Same purpose with {_unsafeSendRON(address,uin256)} but containing gas limit stipend forwarded in the call. + */ + function _unsafeSendRON( + address payable _recipient, + uint256 _amount, + uint256 _gas + ) internal returns (bool _success) { + (_success, ) = _recipient.call{ value: _amount, gas: _gas }(""); + } } diff --git a/contracts/ronin/staking/CandidateStaking.sol b/contracts/ronin/staking/CandidateStaking.sol index 15e077812..3902f0e2b 100644 --- a/contracts/ronin/staking/CandidateStaking.sol +++ b/contracts/ronin/staking/CandidateStaking.sol @@ -92,7 +92,7 @@ abstract contract CandidateStaking is BaseStaking, ICandidateStaking { _amount = _pool.stakingAmount; if (_amount > 0) { _deductStakingAmount(_pool, _amount); - if (!_unsafeSendRON(payable(_pool.admin), _amount)) { + if (!_unsafeSendRON(payable(_pool.admin), _amount, 3500)) { emit StakingAmountTransferFailed(_pool.addr, _pool.admin, _amount, address(this).balance); } } diff --git a/contracts/ronin/staking/Staking.sol b/contracts/ronin/staking/Staking.sol index 74a33e6c5..8c5877a1e 100644 --- a/contracts/ronin/staking/Staking.sol +++ b/contracts/ronin/staking/Staking.sol @@ -80,7 +80,7 @@ contract Staking is IStaking, CandidateStaking, DelegatorStaking, Initializable { _actualDeductingAmount = _deductStakingAmount(_stakingPool[_consensusAddr], _amount); address payable _recipientAddr = payable(validatorContract()); - if (!_unsafeSendRON(_recipientAddr, _actualDeductingAmount)) { + if (!_unsafeSendRON(_recipientAddr, _actualDeductingAmount, 3500)) { emit StakingAmountDeductFailed(_consensusAddr, _recipientAddr, _actualDeductingAmount, address(this).balance); } } diff --git a/contracts/ronin/validator/CoinbaseExecution.sol b/contracts/ronin/validator/CoinbaseExecution.sol index b8ef5ab62..93907d8f0 100644 --- a/contracts/ronin/validator/CoinbaseExecution.sol +++ b/contracts/ronin/validator/CoinbaseExecution.sol @@ -252,7 +252,7 @@ abstract contract CoinbaseExecution is function _distributeMiningReward(address _consensusAddr, address payable _treasury) private { uint256 _amount = _miningReward[_consensusAddr]; if (_amount > 0) { - if (_unsafeSendRON(_treasury, _amount)) { + if (_unsafeSendRON(_treasury, _amount, 3500)) { emit MiningRewardDistributed(_consensusAddr, _treasury, _amount); return; } @@ -277,7 +277,7 @@ abstract contract CoinbaseExecution is ) private { uint256 _amount = _bridgeOperatingReward[_consensusAddr]; if (_amount > 0) { - if (_unsafeSendRON(_treasury, _amount)) { + if (_unsafeSendRON(_treasury, _amount, 3500)) { emit BridgeOperatorRewardDistributed(_consensusAddr, _bridgeOperator, _treasury, _amount); return; }