Skip to content

Commit ccc3b66

Browse files
committed
fix: add redstone gateways option
1 parent 6c96252 commit ccc3b66

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/config/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const envConfigMapping: Record<keyof ConfigSchema, string | string[]> = {
3333
telegramBotToken: "TELEGRAM_BOT_TOKEN",
3434
telegramNotificationsChannel: "TELEGRAM_NOTIFICATIONS_CHANNEL",
3535
telegramAlersChannel: "TELEGRAM_ALERTS_CHANNEL",
36+
redstoneGateways: "REDSTONE_GATEWAYS",
3637
};
3738

3839
export const envConfig: Record<string, string> = Object.fromEntries(

src/config/schema.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ export const ConfigSchema = z.object({
7070
* Enable optimistic liquidations
7171
*/
7272
optimistic: booleanLike.pipe(z.boolean().optional()),
73+
/**
74+
* Override redstone gateways
75+
*/
76+
redstoneGateways: z
77+
.string()
78+
.optional()
79+
.transform(v => v?.split(",")),
7380
/**
7481
* The serive can deploy partial liquidator contracts.
7582
* Usage: deploy them once from local machine then pass the address to production service

src/services/RedstoneServiceV3.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ export class RedstoneServiceV3 {
7777
*/
7878
#optimisticTimestamp?: number;
7979
#optimisticCache: Map<string, PriceOnDemandExtras> = new Map();
80+
#gateways?: string[];
8081

8182
public async launch(): Promise<void> {
8283
this.liquidationPreviewUpdates = this.liquidationPreviewUpdates.bind(this);
84+
this.#gateways = this.config.redstoneGateways;
8385

8486
if (this.config.optimistic) {
8587
const block = await this.client.pub.getBlock({
@@ -377,6 +379,7 @@ export class RedstoneServiceV3 {
377379
dataPackagesIds: Array.from(new Set(updates.map(t => t.dataFeedId))),
378380
uniqueSignersCount,
379381
historicalTimestamp: this.#optimisticTimestamp,
382+
urls: this.#gateways,
380383
});
381384
wrapper.setMetadataTimestamp(Date.now());
382385
// redstone does not provide any error types, just string messages

0 commit comments

Comments
 (0)