Skip to content

Commit

Permalink
feat add constants and pairs for KES oracles (#245)
Browse files Browse the repository at this point in the history
* feat add constants and pairs for KES oracles

* fix: add CELOKES to core pairs list
  • Loading branch information
nvtaveras authored May 10, 2024
1 parent 9ddadec commit c67cac2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/exchange_adapters/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export abstract class BaseExchangeAdapter {
[ExternalCurrency.USDC, 'USDC'],
[ExternalCurrency.EUROC, 'EUROC'],
[ExternalCurrency.XOF, 'XOF'],
[ExternalCurrency.KES, 'KES'],
])

protected readonly logger: Logger
Expand Down
8 changes: 8 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export enum ExternalCurrency {
USDC = 'USDC',
EUROC = 'EUROC',
XOF = 'XOF',
KES = 'KES',
}

export type Currency = ExternalCurrency | CeloToken
Expand All @@ -65,6 +66,7 @@ export enum OracleCurrencyPair {
CELOBTC = 'CELOBTC',
CELOBRL = 'CELOBRL',
CELOXOF = 'CELOXOF',
CELOKES = 'CELOKES',
BTCEUR = 'BTCEUR',
CELOUSDT = 'CELOUSDT',
CELOBUSD = 'CELOBUSD',
Expand Down Expand Up @@ -92,13 +94,15 @@ export enum OracleCurrencyPair {
USDXOF = 'USDXOF',
EUROCXOF = 'EUROCXOF',
EUROCUSDT = 'EUROCUSDT',
KESUSD = 'KESUSD',
}

export const CoreCurrencyPair: OracleCurrencyPair[] = [
OracleCurrencyPair.CELOEUR,
OracleCurrencyPair.CELOUSD,
OracleCurrencyPair.CELOBRL,
OracleCurrencyPair.CELOXOF,
OracleCurrencyPair.CELOKES,
]

export const CurrencyPairBaseQuote: Record<
Expand All @@ -110,6 +114,7 @@ export const CurrencyPairBaseQuote: Record<
[OracleCurrencyPair.CELOEUR]: { base: CeloContract.GoldToken, quote: ExternalCurrency.EUR },
[OracleCurrencyPair.CELOBRL]: { base: CeloContract.GoldToken, quote: ExternalCurrency.BRL },
[OracleCurrencyPair.CELOXOF]: { base: CeloContract.GoldToken, quote: ExternalCurrency.XOF },
[OracleCurrencyPair.CELOKES]: { base: CeloContract.GoldToken, quote: ExternalCurrency.KES },
[OracleCurrencyPair.BTCEUR]: { base: ExternalCurrency.BTC, quote: ExternalCurrency.EUR },
[OracleCurrencyPair.CELOUSDT]: { base: CeloContract.GoldToken, quote: ExternalCurrency.USDT },
[OracleCurrencyPair.CELOBUSD]: { base: CeloContract.GoldToken, quote: ExternalCurrency.BUSD },
Expand Down Expand Up @@ -137,6 +142,7 @@ export const CurrencyPairBaseQuote: Record<
[OracleCurrencyPair.USDXOF]: { base: ExternalCurrency.USD, quote: ExternalCurrency.XOF },
[OracleCurrencyPair.EUROCXOF]: { base: ExternalCurrency.EUROC, quote: ExternalCurrency.XOF },
[OracleCurrencyPair.EUROCUSDT]: { base: ExternalCurrency.EUROC, quote: ExternalCurrency.USDT },
[OracleCurrencyPair.KESUSD]: { base: ExternalCurrency.KES, quote: ExternalCurrency.USD },
}

export enum AggregationMethod {
Expand Down Expand Up @@ -179,6 +185,8 @@ export async function reportTargetForCurrencyPair(
return kit.registry.addressFor('StableTokenBRL' as CeloContract)
} else if (pair === OracleCurrencyPair.CELOXOF) {
return kit.registry.addressFor('StableTokenXOF' as CeloContract)
} else if (pair === OracleCurrencyPair.CELOKES) {
return kit.registry.addressFor('StableTokenKES' as CeloContract)
} else {
throw new Error(`${pair} can not be converted to a ReportTarget`)
}
Expand Down

0 comments on commit c67cac2

Please sign in to comment.