Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion price_pusher/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pythnetwork/pyth-evm-price-pusher",
"version": "2.0.1",
"version": "2.0.2",
"description": "Pyth EVM Price Pusher",
"homepage": "https://pyth.network",
"main": "lib/index.js",
Expand Down
5 changes: 5 additions & 0 deletions price_pusher/src/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export class Controller {
await this.sourcePriceListener.start();
await this.targetPriceListener.start();

// wait for the listeners to get updated. There could be a restart
// before this run and we need to respect the cooldown duration as
// their might be a message sent before.
await sleep(this.cooldownDuration * 1000);

for (;;) {
const pricesToPush: PriceConfig[] = [];
const pubTimesToPush: UnixTimestamp[] = [];
Expand Down
24 changes: 15 additions & 9 deletions price_pusher/src/evm/evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,20 @@ export class EvmPricePusher implements ChainPricePusher {
"Pushing ",
priceIdsWith0x.map((priceIdWith0x) => `${priceIdWith0x}`)
);
const updateFee = await this.pythContract.methods
.getUpdateFee(priceFeedUpdateData)
.call();
console.log(`Update fee: ${updateFee}`);

let updateFee;

try {
updateFee = await this.pythContract.methods
.getUpdateFee(priceFeedUpdateData)
.call();
console.log(`Update fee: ${updateFee}`);
} catch (e: any) {
console.error(
"An unidentified error has occured when getting the update fee:"
);
throw e;
}

const gasPrice = await this.customGasStation?.getCustomGasPrice();

Expand All @@ -168,11 +178,7 @@ export class EvmPricePusher implements ChainPricePusher {
console.log(`Successful. Tx hash: ${hash}`);
})
.on("error", (err: Error, receipt?: TransactionReceipt) => {
if (
err.message.includes(
"VM Exception while processing transaction: revert"
)
) {
if (err.message.includes("revert")) {
// Since we are using custom error structs on solidity the rejection
// doesn't return any information why the call has reverted. Assuming that
// the update data is valid there is no possible rejection cause other than
Expand Down