فهرست منبع

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>
devin-ai-integration[bot] 8 ماه پیش
والد
کامیت
ccd07bc46a
4فایلهای تغییر یافته به همراه20 افزوده شده و 6 حذف شده
  1. 4 1
      apps/price_pusher/README.md
  2. 1 1
      apps/price_pusher/package.json
  3. 8 1
      apps/price_pusher/src/evm/command.ts
  4. 7 3
      apps/price_pusher/src/evm/evm.ts

+ 4 - 1
apps/price_pusher/README.md

@@ -101,7 +101,10 @@ pnpm run start evm --endpoint wss://example-rpc.com \
     --mnemonic-file "path/to/mnemonic.txt" \
     [--pushing-frequency 10] \
     [--polling-frequency 5] \
-    [--override-gas-price-multiplier 1.1]
+    [--override-gas-price-multiplier 1.1] \
+    [--override-gas-price-multiplier-cap 5] \
+    [--gas-limit 1000000] \
+    [--gas-price 160000000]
 
 # For Injective
 pnpm run start injective --grpc-endpoint https://grpc-endpoint.com \

+ 1 - 1
apps/price_pusher/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@pythnetwork/price-pusher",
-  "version": "9.0.1",
+  "version": "9.1.0",
   "description": "Pyth Price Pusher",
   "homepage": "https://pyth.network",
   "main": "lib/index.js",

+ 8 - 1
apps/price_pusher/src/evm/command.ts

@@ -61,6 +61,11 @@ export default {
       type: "number",
       required: false,
     } as Options,
+    "gas-price": {
+      description: "Override the gas price that would be received from the RPC",
+      type: "number",
+      required: false,
+    } as Options,
     "update-fee-multiplier": {
       description:
         "Multiplier for the fee to update the price. It is useful in networks " +
@@ -94,6 +99,7 @@ export default {
       overrideGasPriceMultiplier,
       overrideGasPriceMultiplierCap,
       gasLimit,
+      gasPrice,
       updateFeeMultiplier,
       logLevel,
       controllerLogLevel,
@@ -167,7 +173,8 @@ export default {
       overrideGasPriceMultiplierCap,
       updateFeeMultiplier,
       gasLimit,
-      gasStation
+      gasStation,
+      gasPrice
     );
 
     const controller = new Controller(

+ 7 - 3
apps/price_pusher/src/evm/evm.ts

@@ -136,7 +136,8 @@ export class EvmPricePusher implements IPricePusher {
     private overrideGasPriceMultiplierCap: number,
     private updateFeeMultiplier: number,
     private gasLimit?: number,
-    private customGasStation?: CustomGasStation
+    private customGasStation?: CustomGasStation,
+    private gasPrice?: number
   ) {}
 
   // The pubTimes are passed here to use the values that triggered the push.
@@ -187,8 +188,11 @@ export class EvmPricePusher implements IPricePusher {
     // are using this to remain compatible with the networks that doesn't
     // support this transaction type.
     let gasPrice =
-      Number(await this.customGasStation?.getCustomGasPrice()) ||
-      Number(await this.client.getGasPrice());
+      this.gasPrice ??
+      Number(
+        await (this.customGasStation?.getCustomGasPrice() ??
+          this.client.getGasPrice())
+      );
 
     // Try to re-use the same nonce and increase the gas if the last tx is not landed yet.
     if (this.pusherAddress === undefined) {