Skip to content

Commit ccd07bc

Browse files
feat(price_pusher): add gas-price override option for EVM price pusher (#2419)
* feat(price_pusher): add gas-price override option for EVM price pusher Co-Authored-By: Ali Behjati <ali@dourolabs.xyz> * chore(price_pusher): bump version from 9.0.1 to 9.1.0 Co-Authored-By: Ali Behjati <ali@dourolabs.xyz> * refactor(price_pusher): use nullish coalescing for gas price Co-Authored-By: Ali Behjati <ali@dourolabs.xyz> * chore(apps/price_pusher): update readme --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Ali Behjati <ali@dourolabs.xyz> Co-authored-by: Ali Behjati <bahjatia@gmail.com>
1 parent 77c3b29 commit ccd07bc

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

apps/price_pusher/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ pnpm run start evm --endpoint wss://example-rpc.com \
101101
--mnemonic-file "path/to/mnemonic.txt" \
102102
[--pushing-frequency 10] \
103103
[--polling-frequency 5] \
104-
[--override-gas-price-multiplier 1.1]
104+
[--override-gas-price-multiplier 1.1] \
105+
[--override-gas-price-multiplier-cap 5] \
106+
[--gas-limit 1000000] \
107+
[--gas-price 160000000]
105108
106109
# For Injective
107110
pnpm run start injective --grpc-endpoint https://grpc-endpoint.com \

apps/price_pusher/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/price-pusher",
3-
"version": "9.0.1",
3+
"version": "9.1.0",
44
"description": "Pyth Price Pusher",
55
"homepage": "https://pyth.network",
66
"main": "lib/index.js",

apps/price_pusher/src/evm/command.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ export default {
6161
type: "number",
6262
required: false,
6363
} as Options,
64+
"gas-price": {
65+
description: "Override the gas price that would be received from the RPC",
66+
type: "number",
67+
required: false,
68+
} as Options,
6469
"update-fee-multiplier": {
6570
description:
6671
"Multiplier for the fee to update the price. It is useful in networks " +
@@ -94,6 +99,7 @@ export default {
9499
overrideGasPriceMultiplier,
95100
overrideGasPriceMultiplierCap,
96101
gasLimit,
102+
gasPrice,
97103
updateFeeMultiplier,
98104
logLevel,
99105
controllerLogLevel,
@@ -167,7 +173,8 @@ export default {
167173
overrideGasPriceMultiplierCap,
168174
updateFeeMultiplier,
169175
gasLimit,
170-
gasStation
176+
gasStation,
177+
gasPrice
171178
);
172179

173180
const controller = new Controller(

apps/price_pusher/src/evm/evm.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ export class EvmPricePusher implements IPricePusher {
136136
private overrideGasPriceMultiplierCap: number,
137137
private updateFeeMultiplier: number,
138138
private gasLimit?: number,
139-
private customGasStation?: CustomGasStation
139+
private customGasStation?: CustomGasStation,
140+
private gasPrice?: number
140141
) {}
141142

142143
// The pubTimes are passed here to use the values that triggered the push.
@@ -187,8 +188,11 @@ export class EvmPricePusher implements IPricePusher {
187188
// are using this to remain compatible with the networks that doesn't
188189
// support this transaction type.
189190
let gasPrice =
190-
Number(await this.customGasStation?.getCustomGasPrice()) ||
191-
Number(await this.client.getGasPrice());
191+
this.gasPrice ??
192+
Number(
193+
await (this.customGasStation?.getCustomGasPrice() ??
194+
this.client.getGasPrice())
195+
);
192196

193197
// Try to re-use the same nonce and increase the gas if the last tx is not landed yet.
194198
if (this.pusherAddress === undefined) {

0 commit comments

Comments
 (0)