From f8cf028a0bca9fe1d5e2201ed5501d37d9973ad6 Mon Sep 17 00:00:00 2001 From: Vadim Yavorsky Date: Thu, 19 Sep 2024 17:02:50 +0100 Subject: [PATCH] Update gas price calculation in CommunityPool contract --- proxy/contracts/mainnet/CommunityPool.sol | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/proxy/contracts/mainnet/CommunityPool.sol b/proxy/contracts/mainnet/CommunityPool.sol index ddcbb7a36..d3c45e007 100644 --- a/proxy/contracts/mainnet/CommunityPool.sol +++ b/proxy/contracts/mainnet/CommunityPool.sol @@ -262,6 +262,7 @@ contract CommunityPool is Twin, ICommunityPool { override returns (uint256) { + require(tx.gasprice != 0, "Gas price is zero"); uint256 currentValue = _multiplyOnAdaptedBaseFee(minTransactionGas); if (currentValue <= _userWallets[receiver][schainHash]) { return 0; @@ -273,10 +274,10 @@ contract CommunityPool is Twin, ICommunityPool { * @dev Checks whether user wallet was recharged for sufficient amount. */ function _balanceIsSufficient(bytes32 schainHash, address receiver, uint256 delta) private view returns (bool) { - return delta + _userWallets[receiver][schainHash] >= minTransactionGas * tx.gasprice; + return delta + _userWallets[receiver][schainHash] >= minTransactionGas * block.basefee; } function _multiplyOnAdaptedBaseFee(uint256 value) private view returns (uint256) { - return value * block.basefee * multiplierNumerator / multiplierDivider; + return value * tx.gasprice * multiplierNumerator / multiplierDivider; } }