Skip to content
Open
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
4 changes: 2 additions & 2 deletions src/monitoringV2/price.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ export class PriceService {
const underlying = specialTokens.get(formattedAddress);
if (!underlying) continue; // Not a special token

// Fetch price from underlying equity contract
// Fetch price from underlying equity contract (with transient-error retry)
const equityContract = new ethers.Contract(underlying, EquityABI, this.providerService.provider);
const nativePrice = await equityContract.price();
const nativePrice = await this.providerService.call(() => equityContract.price());
let formattedPrice = ethers.formatUnits(nativePrice, 18);

// For WFPS, convert CHF to EUR
Expand Down
4 changes: 4 additions & 0 deletions src/monitoringV2/provider.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ export class ProviderService {
return results;
}

async call<T>(thunk: () => Promise<T>, retries = 5): Promise<T> {
return this.withRetry(thunk, { retries });
}

async getBlock(blockNumber: number): Promise<ethers.Block | null> {
if (this.blockCache.has(blockNumber)) {
return this.blockCache.get(blockNumber);
Expand Down
Loading