-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loans: Add oracles to development runtime (#1377)
* add needed utilities to work with oracles * added to oracle and data-collector to development runtime * get compile it with tuples-96 feature * add pallet-membershipt for oracle prices· * workaround for initializing oracles * new CombineData, fix warnings, minor PR comments * fix taplo fmt * fix oracle benchmarking * simplify benchmarks * mocking members trait * finally benchmarks fixed * Adapt pool number * reduce benchmarking time * add OracleKey type * correct benchmarking * fix cargo versions * taplo fmt * minor constant reorganization * fix minor issue * fix benchmarks * simplify benchmark configuration * minor change * add minor comment
- Loading branch information
Showing
21 changed files
with
367 additions
and
36 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
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,36 @@ | ||
use codec::{Decode, Encode, MaxEncodedLen}; | ||
use frame_support::RuntimeDebug; | ||
use scale_info::TypeInfo; | ||
#[cfg(feature = "std")] | ||
use serde::{Deserialize, Serialize}; | ||
|
||
/// [ISIN](https://en.wikipedia.org/wiki/International_Securities_Identification_Number) format. | ||
pub type Isin = [u8; 12]; | ||
|
||
/// A representation of an oracle price identifier | ||
#[derive( | ||
Encode, | ||
Decode, | ||
Clone, | ||
Copy, | ||
PartialOrd, | ||
Ord, | ||
PartialEq, | ||
Eq, | ||
TypeInfo, | ||
RuntimeDebug, | ||
MaxEncodedLen, | ||
)] | ||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] | ||
pub enum OracleKey { | ||
Isin(Isin), | ||
} | ||
|
||
#[cfg(feature = "runtime-benchmarks")] | ||
impl From<u32> for OracleKey { | ||
fn from(value: u32) -> Self { | ||
// Any u32 value always fits into 12 bytes | ||
let isin = Isin::try_from(&(value as u128).to_be_bytes()[0..12]).unwrap(); | ||
OracleKey::Isin(isin) | ||
} | ||
} |
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
Oops, something went wrong.