integritee-network / worker

Integritee off-chain worker and sidechain validateer
Apache License 2.0
89 stars 46 forks source link

Define extended teeracle demo cases #1019

Closed clangenb closed 1 year ago

clangenb commented 2 years ago

We would like to extend our teeracle demo case to go beyond of trading pairs:

Ideas:

Then we could:

echevrier commented 2 years ago

Possible simple use cases

Weather oracle : Temperature, Amount of precipitation at a location

Storage in Teeracle Pallet

/// Any string value from different sources 
#[pallet::storage]
#[pallet::getter(fn some_nmap)]
pub(super) type GeneralStringValues <T: Config> = StorageNMap<
    _,
    (
        NMapKey<Blake2_128Concat, GeneralStringKey>, //Temperature or Precipitation
        NMapKey<Blake2_128Concat, GeneralStringKey >, //Zurich or London
        NMapKey< Blake2_128Concat, DataSourceString >, //https:….
    ),
    GeneralStringValue,
    ValueQuery, //
>;

With:

pub type GeneralStringKey= PalletString;
pub type DataSourceString = PalletString;
pub type GeneralStringValue = PalletString;

In this case we would need an update function:

pub fn update_general_string_value(
            origin: OriginFor<T>,
            data_source: DataSourceString,
            key_1: GeneralStringKey,
            key_2: GeneralStringKey,
            new_value: Option< GeneralStringValue >,
        ) -> DispatchResultWithPostInfo {…}

and new events and errors.

Worker

The worker needs to be reworked, it is not generic enough, but specific to the exchange rate oracle:

coax1d commented 2 years ago

Discussed with @clangenb

The extended demo will make use of at least one additional oracle such as a weather oracle as stated above by @echevrier. The extended oracle will use a new more generic structure by adapting the app-libs/exchange-oracle as well as the enclave-runtime/Teeracle to be more accommodating to making generic requests untied to exchange rates.

The long tail goal of the Teeracle demo will be to make it far more configurable either via indirect or direct invocation configuration. For now a clear path to adding additional oracles outside the realm of exchanges is what is required for completion.

Requesting to close from @clangenb if this suffices

clangenb commented 2 years ago

Now that I read this again, I suggest that we close it, when we have the demo ready. However, I agree with what has been written. :)

Just a mention, here is the pallet-side PR for this: https://github.com/integritee-network/pallets/pull/109

coax1d commented 2 years ago

Agreed!

clangenb commented 1 year ago

Done!