Skip to content

Commit 586a439

Browse files
authored
feat(price_pusher): add more options to evm pusher (#1538)
This change makes gasLimit configurable and also adds an updateFeeMultiplier which is useful in Hedera as they have an inconsistency between the `value` passed in tx and the `value` on-chain.
1 parent 020ecdf commit 586a439

File tree

4 files changed

+1400
-1373
lines changed

4 files changed

+1400
-1373
lines changed

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": "6.6.3",
3+
"version": "6.7.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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,20 @@ export default {
5252
required: false,
5353
default: 5,
5454
} as Options,
55+
"gas-limit": {
56+
description: "Gas limit for the transaction",
57+
type: "number",
58+
required: false,
59+
} as Options,
60+
"update-fee-multiplier": {
61+
description:
62+
"Multiplier for the fee to update the price. It is useful in networks " +
63+
"such as Hedera where setting on-chain getUpdateFee as the transaction value " +
64+
"won't work. Default to 1",
65+
type: "number",
66+
required: false,
67+
default: 1,
68+
} as Options,
5569
...options.priceConfigFile,
5670
...options.priceServiceEndpoint,
5771
...options.mnemonicFile,
@@ -73,6 +87,8 @@ export default {
7387
txSpeed,
7488
overrideGasPriceMultiplier,
7589
overrideGasPriceMultiplierCap,
90+
gasLimit,
91+
updateFeeMultiplier,
7692
} = argv;
7793

7894
const priceConfigs = readPriceConfigFile(priceConfigFile);
@@ -119,6 +135,8 @@ export default {
119135
pythContractFactory,
120136
overrideGasPriceMultiplier,
121137
overrideGasPriceMultiplierCap,
138+
updateFeeMultiplier,
139+
gasLimit,
122140
gasStation
123141
);
124142

apps/price_pusher/src/evm/evm.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ export class EvmPricePusher implements IPricePusher {
130130
pythContractFactory: PythContractFactory,
131131
private overrideGasPriceMultiplier: number,
132132
private overrideGasPriceMultiplierCap: number,
133+
private updateFeeMultiplier: number,
134+
private gasLimit?: number,
133135
customGasStation?: CustomGasStation
134136
) {
135137
this.customGasStation = customGasStation;
@@ -168,6 +170,7 @@ export class EvmPricePusher implements IPricePusher {
168170
updateFee = await this.pythContract.methods
169171
.getUpdateFee(priceFeedUpdateData)
170172
.call();
173+
updateFee = Number(updateFee) * (this.updateFeeMultiplier || 1);
171174
console.log(`Update fee: ${updateFee}`);
172175
} catch (e: any) {
173176
console.error(
@@ -217,7 +220,12 @@ export class EvmPricePusher implements IPricePusher {
217220
priceIdsWith0x,
218221
pubTimesToPush
219222
)
220-
.send({ value: updateFee, gasPrice, nonce: txNonce })
223+
.send({
224+
value: updateFee,
225+
gasPrice,
226+
nonce: txNonce,
227+
gasLimit: this.gasLimit,
228+
})
221229
.on("transactionHash", (hash: string) => {
222230
console.log(`Successful. Tx hash: ${hash}`);
223231
})

0 commit comments

Comments
 (0)