Created
March 14, 2023 12:56
-
-
Save kianenigma/a1d74c28a49d42e6230c955242a998fe to your computer and use it in GitHub Desktop.
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
// rought file paths writte above each item. | |
// pallet-balances::weights.rs | |
trait WieghtInfo { | |
fn transfer() -> u32; | |
} | |
// pallet-balances | |
trait Config { | |
type WeightInfo: weights::WeightInfo; | |
} | |
impl<T: Config> Pallet { | |
fn foo() { | |
// tada? not much magic | |
let transfer_weight_info = T::WeightInfo::transfer() | |
} | |
} | |
// runtime::weights::pallet_balances | |
struct WeightInfo; | |
impl pallet_balances::WeightInfo for WeightInfo { | |
fn transfer() -> u32 { 42u32 } | |
} | |
// runtime | |
struct Runtime; | |
impl pallet_balances::Config for Runtime { | |
type WeightInfo = runtime::weights::pallet_balances::WeightInfo | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment