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
4 changes: 3 additions & 1 deletion oracle/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
import {
createValidator,
createPriceCache,
createPriceHistoryService,
createAggregator,
createContractUpdater,
type PriceAggregator,
Expand Down Expand Up @@ -77,8 +78,9 @@ export class OracleService {
});

const cache = createPriceCache(config.cacheTtlSeconds);
const priceHistory = createPriceHistoryService();

this.aggregator = createAggregator(providers, validator, cache, {
this.aggregator = createAggregator(providers, validator, cache, priceHistory, {
circuitBreaker: config.circuitBreaker,
});

Expand Down
3 changes: 2 additions & 1 deletion oracle/src/services/contract-updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/

import {
Account,
Keypair,
Contract,
rpc,
Expand Down Expand Up @@ -251,7 +252,7 @@ export class ContractUpdater {

// 2. Check admin account exists and has funds
try {
const adminAccount = await this.server.getAccount(this.adminKeypair.publicKey());
const adminAccount = (await this.server.getAccount(this.adminKeypair.publicKey())) as any;
result.admin = true;
result.details.admin = {
exists: true,
Expand Down
4 changes: 2 additions & 2 deletions oracle/src/services/price-aggregator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class PriceAggregator {
const circuitBreaker = this.circuitBreakers.get(provider.name);

// Check circuit breaker state
if (circuitBreaker && circuitBreaker.getState() === 'OPEN') {
if (circuitBreaker && circuitBreaker.currentState === 'OPEN') {
logger.warn(`Circuit breaker OPEN for ${provider.name}, skipping`);
continue;
}
Expand Down Expand Up @@ -275,7 +275,7 @@ export class PriceAggregator {
return avg;
}

return sorted[mid];
return sorted[mid].price;
}

/**
Expand Down