Skip to content

Commit 8877fdb

Browse files
ZvonimirZvonimir
authored andcommitted
rename bufferPercent to gasPriceBufferPercent
1 parent a0fc90e commit 8877fdb

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

services/blockchain-service/blockchain-service-base.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,12 +1427,12 @@ export default class BlockchainServiceBase {
14271427
/**
14281428
* Apply buffer percentage to a gas price
14291429
* @param {BigInt} gasPrice - Gas price in wei
1430-
* @param {number} bufferPercent - Buffer percentage to add
1430+
* @param {number} gasPriceBufferPercent - Buffer percentage to add
14311431
* @returns {BigInt} Gas price with buffer applied
14321432
*/
1433-
applyGasPriceBuffer(gasPrice, bufferPercent) {
1434-
if (!bufferPercent) return gasPrice;
1435-
return (gasPrice * BigInt(100 + Number(bufferPercent))) / 100n;
1433+
applyGasPriceBuffer(gasPrice, gasPriceBufferPercent) {
1434+
if (!gasPriceBufferPercent) return gasPrice;
1435+
return (gasPrice * BigInt(100 + Number(gasPriceBufferPercent))) / 100n;
14361436
}
14371437

14381438
/**
@@ -1443,14 +1443,14 @@ export default class BlockchainServiceBase {
14431443
* @returns {Promise<BigInt>} Estimated gas price in wei
14441444
*/
14451445
async estimateGasPriceFromFeeHistory(blockchain) {
1446-
const { bufferPercent } = blockchain;
1446+
const { gasPriceBufferPercent } = blockchain;
14471447
const feeHistory = await this.getFeeHistory(blockchain, FEE_HISTORY_BLOCK_COUNT);
14481448

14491449
// Fallback to network gas price if feeHistory not supported or empty
14501450
if (!feeHistory.supported) {
14511451
return this.applyGasPriceBuffer(
14521452
BigInt(await this.getNetworkGasPrice(blockchain)),
1453-
bufferPercent,
1453+
gasPriceBufferPercent,
14541454
);
14551455
}
14561456

@@ -1460,15 +1460,15 @@ export default class BlockchainServiceBase {
14601460
if (baseFees.length === 0 || priorityFees.length === 0) {
14611461
return this.applyGasPriceBuffer(
14621462
BigInt(await this.getNetworkGasPrice(blockchain)),
1463-
bufferPercent,
1463+
gasPriceBufferPercent,
14641464
);
14651465
}
14661466

14671467
// Find max base fee and priority fee from recent blocks
14681468
const maxBaseFee = baseFees.reduce((max, bf) => (bf > max ? bf : max), 0n);
14691469
const maxPriorityFee = priorityFees.reduce((max, pf) => (pf > max ? pf : max), 0n);
14701470

1471-
return this.applyGasPriceBuffer(maxBaseFee + maxPriorityFee, bufferPercent);
1471+
return this.applyGasPriceBuffer(maxBaseFee + maxPriorityFee, gasPriceBufferPercent);
14721472
}
14731473

14741474
/**

services/input-service.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,10 @@ export default class InputService {
194194

195195
const maxAllowance =
196196
options.blockchain?.maxAllowance ?? this.config.blockchain?.maxAllowance ?? undefined;
197-
const bufferPercent =
198-
options.blockchain?.bufferPercent ?? this.config.blockchain?.bufferPercent ?? undefined;
197+
const gasPriceBufferPercent =
198+
options.blockchain?.gasPriceBufferPercent ??
199+
this.config.blockchain?.gasPriceBufferPercent ??
200+
undefined;
199201
const retryTxGasPriceMultiplier =
200202
options.blockchain?.retryTxGasPriceMultiplier ??
201203
this.config.blockchain?.retryTxGasPriceMultiplier ??
@@ -215,7 +217,7 @@ export default class InputService {
215217
forceReplaceTxs,
216218
gasPriceOracleLink,
217219
maxAllowance,
218-
bufferPercent,
220+
gasPriceBufferPercent,
219221
retryTxGasPriceMultiplier,
220222
};
221223

0 commit comments

Comments
 (0)