Skip to content

Commit

Permalink
prepare provider initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
lemunozm committed Dec 5, 2023
1 parent 429f824 commit f148d8f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
3 changes: 0 additions & 3 deletions libs/mocks/src/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,5 @@ pub mod pallet {
) -> DispatchResult {
execute_call!((a, b))
}

#[cfg(feature = "runtime-benchmarks")]
fn add_fee_requirements(_: &Self::AccountId, _: Fee<Self::Balance, Self::FeeKey>) {}
}
}
7 changes: 6 additions & 1 deletion libs/traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ pub mod fees {
/// Allows to initialize an initial state required for a pallet that
/// calls pay a fee
#[cfg(feature = "runtime-benchmarks")]
fn add_fee_requirements(from: &Self::AccountId, fee: Fee<Self::Balance, Self::FeeKey>);
fn add_fee_requirements(_from: &Self::AccountId, _fee: Fee<Self::Balance, Self::FeeKey>) {}
}

/// Trait to pay fees
Expand Down Expand Up @@ -707,6 +707,11 @@ pub trait ValueProvider<Source, Key> {
type Timestamp;

fn get(source: &Source, id: &Key) -> Result<(Self::Value, Self::Timestamp), DispatchError>;

/// Allows to initialize an initial state required for a pallet that
/// calls `get()`.
#[cfg(feature = "runtime-benchmarks")]
fn set(_: &Source, _: &Key) {}
}

/// A provider that never returns a value
Expand Down
9 changes: 9 additions & 0 deletions runtime/common/src/oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,13 @@ where

Ok((balance, timestamp))
}

/// Allows to initialize an initial state required for a pallet that
/// calls `get()`.
#[cfg(feature = "runtime-benchmarks")]
fn set((account_id, pool_id): &(AccountId, PoolId), key: &OracleKey) {
// TODO
// initialize pool
// initialize asset_registry
}
}

0 comments on commit f148d8f

Please sign in to comment.