Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gas price calculation in CommunityPool contract #1705

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions proxy/contracts/mainnet/CommunityPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
}
Loading