From ef17a397eefdebd1032d41a3ef34987ae928e18a Mon Sep 17 00:00:00 2001 From: jingyi2811 Date: Wed, 2 Jun 2021 16:54:44 +0800 Subject: [PATCH 1/6] Quick push. Switch to another branch --- .../category/oracle/appointOracle.test.ts | 94 +++++++++++++++++++ .../jellyfish-api-core/src/category/oracle.ts | 44 +++++++++ packages/jellyfish-api-core/src/index.ts | 3 + 3 files changed, 141 insertions(+) create mode 100644 packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts create mode 100644 packages/jellyfish-api-core/src/category/oracle.ts diff --git a/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts b/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts new file mode 100644 index 0000000000..9147da5c85 --- /dev/null +++ b/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts @@ -0,0 +1,94 @@ +import { MasterNodeRegTestContainer } from '@defichain/testcontainers' +import { ContainerAdapterClient } from '../../container_adapter_client' +import { UTXO } from '../../../src/category/oracle' +import { RpcApiError } from '../../../src' + +describe('Oracle', () => { + const container = new MasterNodeRegTestContainer() + const client = new ContainerAdapterClient(container) + + beforeAll(async () => { + await container.start() + await container.waitForReady() + await container.waitForWalletCoinbaseMaturity() + }) + + afterAll(async () => { + await container.stop() + }) + + it('should appointOracle', async () => { + const priceFeeds = [ + { currency: 'USD', token: 'TESLA' }, + { currency: 'EUR', token: 'TESLA' } + ] + + const data = await client.oracle.appointOracle(await container.getNewAddress(), priceFeeds, { weightage: 1 }) + + expect(typeof data).toStrictEqual('string') + expect(data.length).toStrictEqual(64) + }) + + it('should appointOracle with utxos', async () => { + const priceFeeds = [ + { currency: 'USD', token: 'TESLA' }, + { currency: 'EUR', token: 'TESLA' } + ] + + const address = await container.getNewAddress() + const utxos = await container.call('listunspent', [1, 9999999, [address], true]) + const inputs: UTXO = utxos.map((utxo: UTXO) => { + return { + txid: utxo.txid, + vout: utxo.vout + } + }) + + const data = await client.oracle.appointOracle(address, priceFeeds, { weightage: 1, utxos: [inputs] }) + + expect(typeof data).toStrictEqual('string') + expect(data.length).toStrictEqual(64) + }) + + it('should appointOracle with utxos', async () => { + const priceFeeds = [ + { currency: 'USD', token: 'TESLA' }, + { currency: 'EUR', token: 'TESLA' } + ] + + const address = await container.getNewAddress() + const utxos = await container.call('listunspent', [1, 9999999, [address], true]) + const inputs: UTXO = utxos.map((utxo: UTXO) => { + return { + txid: utxo.txid, + vout: utxo.vout + } + }) + + const data = await client.oracle.appointOracle(address, priceFeeds, { weightage: 1, utxos: [inputs] }) + + expect(typeof data).toStrictEqual('string') + expect(data.length).toStrictEqual(64) + }) + + it('should not accountToUtxos with utxos for arbitrary utxos', async () => { + const priceFeeds = [ + { currency: 'USD', token: 'TESLA' }, + { currency: 'EUR', token: 'TESLA' } + ] + + const { txid, vout } = await container.fundAddress(await container.getNewAddress(), 10) + // const utxos = await container.call('listunspent') + // const inputs: UTXO[] = utxos.map((utxo: UTXO) => { + // return { + // txid: utxo.txid, + // vout: utxo.vout + // } + // }) + + const promise = client.oracle.appointOracle(await container.getNewAddress(), priceFeeds, { weightage: 1, utxos: [{ txid, vout }] }) + + await expect(promise).rejects.toThrow(RpcApiError) + await expect(promise).rejects.toThrow('RpcApiError: \'Test AccountToUtxosTx execution failed:\nonly available for DFI transactions\', code: -32600, method: accounttoutxos') + }) +}) diff --git a/packages/jellyfish-api-core/src/category/oracle.ts b/packages/jellyfish-api-core/src/category/oracle.ts new file mode 100644 index 0000000000..3b51ff6270 --- /dev/null +++ b/packages/jellyfish-api-core/src/category/oracle.ts @@ -0,0 +1,44 @@ +import { ApiClient } from '../.' + +/** + * Oracle RPCs for DeFi Blockchain + */ +export class Oracle { + private readonly client: ApiClient + + constructor (client: ApiClient) { + this.client = client + } + + /** + * Creates a appoint oracle transaction and saves oracle to database. + * @param {string} [address] + * @param {PriceFeeds} priceFeeds + * @param {AppointOracleOptions} [options] + * @param {number} [options.weightage] + * @param {UTXO[]} [options.utxos = []] + * @param {string} [options.utxos.txid] + * @param {number} [options.utxos.vout] + * + * @return {Promise} + */ + async appointOracle (address: string, pricefeeds: PriceFeeds[], options: AppointOracleOptions): Promise { + // return await this.client.call('appointoracle', [address, pricefeeds, options.weightage, options.utxos = []], 'number') + return 'abc' + } +} + +export interface PriceFeeds { + currency: string + token: string +} + +export interface AppointOracleOptions { + weightage: number + utxos?: UTXO[] +} + +export interface UTXO { + txid: string + vout: number +} diff --git a/packages/jellyfish-api-core/src/index.ts b/packages/jellyfish-api-core/src/index.ts index 6466339ef6..274c3fd5e9 100644 --- a/packages/jellyfish-api-core/src/index.ts +++ b/packages/jellyfish-api-core/src/index.ts @@ -7,6 +7,7 @@ import { Wallet } from './category/wallet' import { Account } from './category/account' import { PoolPair } from './category/poolpair' import { Token } from './category/token' +import { Oracle } from './category/oracle' export * from '@defichain/jellyfish-json' @@ -18,6 +19,7 @@ export * as wallet from './category/wallet' export * as poolpair from './category/poolpair' export * as token from './category/token' export * as account from './category/account' +export * as oracle from './category/oracle' /** * A protocol agnostic DeFiChain node client, RPC calls are separated into their category. @@ -31,6 +33,7 @@ export abstract class ApiClient { public readonly account = new Account(this) public readonly poolpair = new PoolPair(this) public readonly token = new Token(this) + public readonly oracle = new Oracle(this) /** * A promise based procedure call handling From 35f963a6216357eba39fe9a173b873edc6b8f3ed Mon Sep 17 00:00:00 2001 From: jingyi2811 Date: Wed, 2 Jun 2021 18:42:37 +0800 Subject: [PATCH 2/6] Add appoint oracle RPC --- .../category/oracle/appointOracle.test.ts | 41 ++++--------------- .../jellyfish-api-core/src/category/oracle.ts | 10 ++--- website/docs/jellyfish/api/oracle.md | 39 ++++++++++++++++++ 3 files changed, 52 insertions(+), 38 deletions(-) create mode 100644 website/docs/jellyfish/api/oracle.md diff --git a/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts b/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts index 9147da5c85..a1a9af2c7e 100644 --- a/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts @@ -1,6 +1,6 @@ import { MasterNodeRegTestContainer } from '@defichain/testcontainers' import { ContainerAdapterClient } from '../../container_adapter_client' -import { UTXO } from '../../../src/category/oracle' +import { AppointOracleOptions, UTXO } from '../../../src/category/oracle' import { RpcApiError } from '../../../src' describe('Oracle', () => { @@ -23,28 +23,11 @@ describe('Oracle', () => { { currency: 'EUR', token: 'TESLA' } ] - const data = await client.oracle.appointOracle(await container.getNewAddress(), priceFeeds, { weightage: 1 }) + const options: AppointOracleOptions = { + weightage: 1 + } - expect(typeof data).toStrictEqual('string') - expect(data.length).toStrictEqual(64) - }) - - it('should appointOracle with utxos', async () => { - const priceFeeds = [ - { currency: 'USD', token: 'TESLA' }, - { currency: 'EUR', token: 'TESLA' } - ] - - const address = await container.getNewAddress() - const utxos = await container.call('listunspent', [1, 9999999, [address], true]) - const inputs: UTXO = utxos.map((utxo: UTXO) => { - return { - txid: utxo.txid, - vout: utxo.vout - } - }) - - const data = await client.oracle.appointOracle(address, priceFeeds, { weightage: 1, utxos: [inputs] }) + const data = await client.oracle.appointOracle(await container.getNewAddress(), priceFeeds, options) expect(typeof data).toStrictEqual('string') expect(data.length).toStrictEqual(64) @@ -58,14 +41,14 @@ describe('Oracle', () => { const address = await container.getNewAddress() const utxos = await container.call('listunspent', [1, 9999999, [address], true]) - const inputs: UTXO = utxos.map((utxo: UTXO) => { + const inputs: UTXO[] = utxos.map((utxo: UTXO) => { return { txid: utxo.txid, vout: utxo.vout } }) - const data = await client.oracle.appointOracle(address, priceFeeds, { weightage: 1, utxos: [inputs] }) + const data = await client.oracle.appointOracle(address, priceFeeds, { weightage: 1, utxos: inputs }) expect(typeof data).toStrictEqual('string') expect(data.length).toStrictEqual(64) @@ -78,17 +61,9 @@ describe('Oracle', () => { ] const { txid, vout } = await container.fundAddress(await container.getNewAddress(), 10) - // const utxos = await container.call('listunspent') - // const inputs: UTXO[] = utxos.map((utxo: UTXO) => { - // return { - // txid: utxo.txid, - // vout: utxo.vout - // } - // }) - const promise = client.oracle.appointOracle(await container.getNewAddress(), priceFeeds, { weightage: 1, utxos: [{ txid, vout }] }) await expect(promise).rejects.toThrow(RpcApiError) - await expect(promise).rejects.toThrow('RpcApiError: \'Test AccountToUtxosTx execution failed:\nonly available for DFI transactions\', code: -32600, method: accounttoutxos') + await expect(promise).rejects.toThrow('RpcApiError: \'Test AppointOracleTx execution failed:\ntx not from foundation member\', code: -32600, method: appointoracle') }) }) diff --git a/packages/jellyfish-api-core/src/category/oracle.ts b/packages/jellyfish-api-core/src/category/oracle.ts index 3b51ff6270..55b93d344b 100644 --- a/packages/jellyfish-api-core/src/category/oracle.ts +++ b/packages/jellyfish-api-core/src/category/oracle.ts @@ -11,7 +11,7 @@ export class Oracle { } /** - * Creates a appoint oracle transaction and saves oracle to database. + * Creates an appoint oracle transaction and saves the oracle to database. * @param {string} [address] * @param {PriceFeeds} priceFeeds * @param {AppointOracleOptions} [options] @@ -22,9 +22,9 @@ export class Oracle { * * @return {Promise} */ - async appointOracle (address: string, pricefeeds: PriceFeeds[], options: AppointOracleOptions): Promise { - // return await this.client.call('appointoracle', [address, pricefeeds, options.weightage, options.utxos = []], 'number') - return 'abc' + async appointOracle (address: string, pricefeeds: PriceFeeds[], options: AppointOracleOptions = {}): Promise { + const { utxos = [] } = options + return await this.client.call('appointoracle', [address, pricefeeds, options.weightage, utxos], 'number') } } @@ -34,7 +34,7 @@ export interface PriceFeeds { } export interface AppointOracleOptions { - weightage: number + weightage?: number utxos?: UTXO[] } diff --git a/website/docs/jellyfish/api/oracle.md b/website/docs/jellyfish/api/oracle.md new file mode 100644 index 0000000000..880b3bd831 --- /dev/null +++ b/website/docs/jellyfish/api/oracle.md @@ -0,0 +1,39 @@ +--- +id: oracle +title: Oracle API +sidebar_label: Oracle API +slug: /jellyfish/api/oracle +--- + +```js +import {Client} from '@defichain/jellyfish' +const client = new Client() + +// Using client.oracle. +const something = await client.oracle.method() +``` + +## appointOracle + +Creates an appoint oracle transaction and saves the oracle to database. + +```ts title="client.oracle.appointOracle()" +interface oracle { + appointOracle (address: string, pricefeeds: PriceFeeds[], options: AppointOracleOptions = {}): Promise +} + +interface PriceFeeds { + currency: string + token: string +} + +interface AppointOracleOptions { + weightage?: number + utxos?: UTXO[] +} + +interface UTXO { + txid: string + vout: number +} +``` From c1238dcc8ca56b473cf15c2a67f0c9bf46a81089 Mon Sep 17 00:00:00 2001 From: jingyi2811 Date: Wed, 2 Jun 2021 22:49:05 +0800 Subject: [PATCH 3/6] Improve code --- .../category/oracle/appointOracle.test.ts | 21 +++++++++---------- .../jellyfish-api-core/src/category/oracle.ts | 16 +++++++------- website/docs/jellyfish/api/oracle.md | 7 +++---- website/sidebars.js | 3 ++- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts b/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts index a1a9af2c7e..cc651681c5 100644 --- a/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts @@ -1,6 +1,6 @@ import { MasterNodeRegTestContainer } from '@defichain/testcontainers' import { ContainerAdapterClient } from '../../container_adapter_client' -import { AppointOracleOptions, UTXO } from '../../../src/category/oracle' +import { UTXO } from '../../../src/category/oracle' import { RpcApiError } from '../../../src' describe('Oracle', () => { @@ -20,14 +20,10 @@ describe('Oracle', () => { it('should appointOracle', async () => { const priceFeeds = [ { currency: 'USD', token: 'TESLA' }, - { currency: 'EUR', token: 'TESLA' } + { currency: 'EUR', token: 'APPLE' } ] - const options: AppointOracleOptions = { - weightage: 1 - } - - const data = await client.oracle.appointOracle(await container.getNewAddress(), priceFeeds, options) + const data = await client.oracle.appointOracle(await container.getNewAddress(), priceFeeds, { weightage: 1 }) expect(typeof data).toStrictEqual('string') expect(data.length).toStrictEqual(64) @@ -36,7 +32,7 @@ describe('Oracle', () => { it('should appointOracle with utxos', async () => { const priceFeeds = [ { currency: 'USD', token: 'TESLA' }, - { currency: 'EUR', token: 'TESLA' } + { currency: 'EUR', token: 'APPLE' } ] const address = await container.getNewAddress() @@ -54,14 +50,17 @@ describe('Oracle', () => { expect(data.length).toStrictEqual(64) }) - it('should not accountToUtxos with utxos for arbitrary utxos', async () => { + it('should not appointOracle with arbitrary utxos', async () => { const priceFeeds = [ { currency: 'USD', token: 'TESLA' }, - { currency: 'EUR', token: 'TESLA' } + { currency: 'EUR', token: 'APPLE' } ] const { txid, vout } = await container.fundAddress(await container.getNewAddress(), 10) - const promise = client.oracle.appointOracle(await container.getNewAddress(), priceFeeds, { weightage: 1, utxos: [{ txid, vout }] }) + const promise = client.oracle.appointOracle(await container.getNewAddress(), priceFeeds, { + weightage: 1, + utxos: [{ txid, vout }] + }) await expect(promise).rejects.toThrow(RpcApiError) await expect(promise).rejects.toThrow('RpcApiError: \'Test AppointOracleTx execution failed:\ntx not from foundation member\', code: -32600, method: appointoracle') diff --git a/packages/jellyfish-api-core/src/category/oracle.ts b/packages/jellyfish-api-core/src/category/oracle.ts index 55b93d344b..346ceff0a6 100644 --- a/packages/jellyfish-api-core/src/category/oracle.ts +++ b/packages/jellyfish-api-core/src/category/oracle.ts @@ -11,24 +11,24 @@ export class Oracle { } /** - * Creates an appoint oracle transaction and saves the oracle to database. - * @param {string} [address] - * @param {PriceFeeds} priceFeeds + * Creates an oracle appointment transaction and saves it to the database. + * + * @param {string} address + * @param {PriceFeed[]} priceFeeds * @param {AppointOracleOptions} [options] - * @param {number} [options.weightage] + * @param {number} options.weightage * @param {UTXO[]} [options.utxos = []] * @param {string} [options.utxos.txid] * @param {number} [options.utxos.vout] - * * @return {Promise} */ - async appointOracle (address: string, pricefeeds: PriceFeeds[], options: AppointOracleOptions = {}): Promise { + async appointOracle (address: string, priceFeeds: PriceFeed[], options: AppointOracleOptions = {}): Promise { const { utxos = [] } = options - return await this.client.call('appointoracle', [address, pricefeeds, options.weightage, utxos], 'number') + return await this.client.call('appointoracle', [address, priceFeeds, options.weightage, utxos], 'number') } } -export interface PriceFeeds { +export interface PriceFeed { currency: string token: string } diff --git a/website/docs/jellyfish/api/oracle.md b/website/docs/jellyfish/api/oracle.md index 880b3bd831..c02c54c0d1 100644 --- a/website/docs/jellyfish/api/oracle.md +++ b/website/docs/jellyfish/api/oracle.md @@ -8,21 +8,20 @@ slug: /jellyfish/api/oracle ```js import {Client} from '@defichain/jellyfish' const client = new Client() - // Using client.oracle. const something = await client.oracle.method() ``` ## appointOracle -Creates an appoint oracle transaction and saves the oracle to database. +Creates an oracle appointment transaction and saves it to the database. ```ts title="client.oracle.appointOracle()" interface oracle { - appointOracle (address: string, pricefeeds: PriceFeeds[], options: AppointOracleOptions = {}): Promise + appointOracle (address: string, priceFeeds: PriceFeed[], options: AppointOracleOptions = {}): Promise } -interface PriceFeeds { +interface PriceFeed { currency: string token: string } diff --git a/website/sidebars.js b/website/sidebars.js index 04cdc6a6da..257a9b95b0 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -15,7 +15,8 @@ module.exports = { 'jellyfish/api/wallet', 'jellyfish/api/poolpair', 'jellyfish/api/token', - 'jellyfish/api/account' + 'jellyfish/api/account', + 'jellyfish/api/oracle' ] } ], From 789c2ba18d5ea11dcb026cd87d9d28cd67f2a1da Mon Sep 17 00:00:00 2001 From: jingyi2811 Date: Thu, 3 Jun 2021 12:10:47 +0800 Subject: [PATCH 4/6] Apply suggestions from code review --- .../category/oracle/appointOracle.test.ts | 44 ++++++++++++++++--- .../jellyfish-api-core/src/category/oracle.ts | 2 +- website/docs/jellyfish/api/oracle.md | 2 +- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts b/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts index cc651681c5..ede62038c1 100644 --- a/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts @@ -23,10 +23,26 @@ describe('Oracle', () => { { currency: 'EUR', token: 'APPLE' } ] - const data = await client.oracle.appointOracle(await container.getNewAddress(), priceFeeds, { weightage: 1 }) + const txid = await client.oracle.appointOracle(await container.getNewAddress(), priceFeeds, { weightage: 1 }) - expect(typeof data).toStrictEqual('string') - expect(data.length).toStrictEqual(64) + expect(typeof txid).toStrictEqual('string') + expect(txid.length).toStrictEqual(64) + + await container.generate(1) + + const result = await container.call('getoracledata', [txid]) + expect(result).toStrictEqual( + { + weightage: 1, + oracleid: txid, + address: expect.any(String), // This is an oracle address, not the address in line 26 + priceFeeds: [ + { token: 'APPLE', currency: 'EUR' }, + { token: 'TESLA', currency: 'USD' } + ], + tokenPrices: [] + } + ) }) it('should appointOracle with utxos', async () => { @@ -44,10 +60,26 @@ describe('Oracle', () => { } }) - const data = await client.oracle.appointOracle(address, priceFeeds, { weightage: 1, utxos: inputs }) + const txid = await client.oracle.appointOracle(address, priceFeeds, { weightage: 1, utxos: inputs }) - expect(typeof data).toStrictEqual('string') - expect(data.length).toStrictEqual(64) + expect(typeof txid).toStrictEqual('string') + expect(txid.length).toStrictEqual(64) + + await container.generate(1) + + const result = await container.call('getoracledata', [txid]) + expect(result).toStrictEqual( + { + weightage: 1, + oracleid: txid, + address: expect.any(String), // This is an oracle address, not the address in line 54 + priceFeeds: [ + { token: 'APPLE', currency: 'EUR' }, + { token: 'TESLA', currency: 'USD' } + ], + tokenPrices: [] + } + ) }) it('should not appointOracle with arbitrary utxos', async () => { diff --git a/packages/jellyfish-api-core/src/category/oracle.ts b/packages/jellyfish-api-core/src/category/oracle.ts index 346ceff0a6..c815ac51f0 100644 --- a/packages/jellyfish-api-core/src/category/oracle.ts +++ b/packages/jellyfish-api-core/src/category/oracle.ts @@ -11,7 +11,7 @@ export class Oracle { } /** - * Creates an oracle appointment transaction and saves it to the database. + * Creates a price oracle for rely of real time price data. * * @param {string} address * @param {PriceFeed[]} priceFeeds diff --git a/website/docs/jellyfish/api/oracle.md b/website/docs/jellyfish/api/oracle.md index c02c54c0d1..13833f4a09 100644 --- a/website/docs/jellyfish/api/oracle.md +++ b/website/docs/jellyfish/api/oracle.md @@ -14,7 +14,7 @@ const something = await client.oracle.method() ## appointOracle -Creates an oracle appointment transaction and saves it to the database. +Creates a price oracle for rely of real time price data. ```ts title="client.oracle.appointOracle()" interface oracle { From 709cf46003ab853721e1b049aa8c2d29bcebe092 Mon Sep 17 00:00:00 2001 From: jingyi2811 Date: Thu, 3 Jun 2021 12:34:28 +0800 Subject: [PATCH 5/6] Add missing imports --- packages/jellyfish-api-core/src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/jellyfish-api-core/src/index.ts b/packages/jellyfish-api-core/src/index.ts index 79c5025488..7819be4983 100644 --- a/packages/jellyfish-api-core/src/index.ts +++ b/packages/jellyfish-api-core/src/index.ts @@ -7,6 +7,8 @@ import { Wallet } from './category/wallet' import { Account } from './category/account' import { PoolPair } from './category/poolpair' import { Token } from './category/token' +import { Oracle } from './category/oracle' +import { Server } from './category/server' export * from '@defichain/jellyfish-json' From e8e00860930cf27be5f83e2860a05933820a9721 Mon Sep 17 00:00:00 2001 From: jingyi2811 Date: Thu, 3 Jun 2021 14:10:30 +0800 Subject: [PATCH 6/6] Remove wrong comment --- .../__tests__/category/oracle/appointOracle.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts b/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts index ede62038c1..8782bdd60a 100644 --- a/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts +++ b/packages/jellyfish-api-core/__tests__/category/oracle/appointOracle.test.ts @@ -35,7 +35,7 @@ describe('Oracle', () => { { weightage: 1, oracleid: txid, - address: expect.any(String), // This is an oracle address, not the address in line 26 + address: expect.any(String), priceFeeds: [ { token: 'APPLE', currency: 'EUR' }, { token: 'TESLA', currency: 'USD' } @@ -72,7 +72,7 @@ describe('Oracle', () => { { weightage: 1, oracleid: txid, - address: expect.any(String), // This is an oracle address, not the address in line 54 + address: expect.any(String), priceFeeds: [ { token: 'APPLE', currency: 'EUR' }, { token: 'TESLA', currency: 'USD' }