-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* impl pallet-oracle-feed * impl pallet-oracle-data-collection * tech debt: PayFee docs * attach both pallets to development runtime * runtime change support for changing feeders * add AggregationProvider * fix clippy * mock for pallet-oracle-feed * add pallet-oracle-feed tests * add mock for pallet-oracle-data-collection * prepare testing for pallet-oracle-data-collection * add pallet-oracle-data-collection testing * fix docs * add benchmarking for pallet_oracle_feed * add altair & centrifuge runtimes * complete pallet-oracle-benchmarks * Benchmarks for pallet-oracle-data-collection * set maximum weights to oracle-data * add weights * add satisfy() method to PreConditions * fix change guard for benchmarks * prepare provider initialization * oracle provider with initial state for benchmarking * taplo fmt * benchmark for oracle-data-collection working * try-runtime support * fix clippy * fix docs * add root support for feeders * RuntimeOrigin as a feeder source * last_change_id_for out of benchmark line * doc Willian suggestions * testing events * deposit taken from storage size * add sp_std dependency to oracle feed * size deposit to all runtimes * remove TODO comment
- Loading branch information
Showing
45 changed files
with
2,490 additions
and
77 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#[frame_support::pallet] | ||
pub mod pallet { | ||
use cfg_traits::fees::PayFee; | ||
use frame_support::pallet_prelude::*; | ||
use mock_builder::{execute_call, register_call}; | ||
|
||
#[pallet::config] | ||
pub trait Config: frame_system::Config {} | ||
|
||
#[pallet::pallet] | ||
pub struct Pallet<T>(_); | ||
|
||
#[pallet::storage] | ||
pub(super) type CallIds<T: Config> = StorageMap< | ||
_, | ||
Blake2_128Concat, | ||
<Blake2_128 as frame_support::StorageHasher>::Output, | ||
mock_builder::CallId, | ||
>; | ||
|
||
impl<T: Config> Pallet<T> { | ||
pub fn mock_pay(f: impl Fn(&T::AccountId) -> DispatchResult + 'static) { | ||
register_call!(f); | ||
} | ||
} | ||
|
||
impl<T: Config> PayFee<T::AccountId> for Pallet<T> { | ||
fn pay(a: &T::AccountId) -> DispatchResult { | ||
execute_call!(a) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#[frame_support::pallet] | ||
pub mod pallet { | ||
use cfg_traits::PreConditions; | ||
use frame_support::pallet_prelude::*; | ||
use mock_builder::{execute_call_instance, register_call_instance}; | ||
|
||
#[pallet::config] | ||
pub trait Config<I: 'static = ()>: frame_system::Config { | ||
type Conditions; | ||
type Result; | ||
} | ||
|
||
#[pallet::pallet] | ||
pub struct Pallet<T, I = ()>(_); | ||
|
||
#[pallet::storage] | ||
pub(super) type CallIds<T: Config<I>, I: 'static = ()> = StorageMap< | ||
_, | ||
Blake2_128Concat, | ||
<Blake2_128 as frame_support::StorageHasher>::Output, | ||
mock_builder::CallId, | ||
>; | ||
|
||
impl<T: Config<I>, I: 'static> Pallet<T, I> { | ||
pub fn mock_check(f: impl Fn(T::Conditions) -> T::Result + 'static) { | ||
register_call_instance!(f); | ||
} | ||
} | ||
|
||
impl<T: Config<I>, I: 'static> PreConditions<T::Conditions> for Pallet<T, I> { | ||
type Result = T::Result; | ||
|
||
fn check(a: T::Conditions) -> T::Result { | ||
execute_call_instance!(a) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#[frame_support::pallet] | ||
pub mod pallet { | ||
use cfg_traits::ValueProvider; | ||
use frame_support::pallet_prelude::*; | ||
use mock_builder::{execute_call, register_call}; | ||
|
||
#[pallet::config] | ||
pub trait Config: frame_system::Config { | ||
type Source; | ||
type Key; | ||
type Value; | ||
} | ||
|
||
#[pallet::pallet] | ||
pub struct Pallet<T>(_); | ||
|
||
#[pallet::storage] | ||
pub(super) type CallIds<T: Config> = StorageMap< | ||
_, | ||
Blake2_128Concat, | ||
<Blake2_128 as frame_support::StorageHasher>::Output, | ||
mock_builder::CallId, | ||
>; | ||
|
||
impl<T: Config> Pallet<T> { | ||
pub fn mock_get( | ||
f: impl Fn(&T::Source, &T::Key) -> Result<Option<T::Value>, DispatchError> + 'static, | ||
) { | ||
register_call!(move |(a, b)| f(a, b)); | ||
} | ||
} | ||
|
||
impl<T: Config> ValueProvider<T::Source, T::Key> for Pallet<T> { | ||
type Value = T::Value; | ||
|
||
fn get(a: &T::Source, b: &T::Key) -> Result<Option<Self::Value>, DispatchError> { | ||
execute_call!((a, b)) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.