Skip to content

Instantly share code, notes, and snippets.

@kianenigma
Created March 14, 2023 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kianenigma/a1d74c28a49d42e6230c955242a998fe to your computer and use it in GitHub Desktop.
Save kianenigma/a1d74c28a49d42e6230c955242a998fe to your computer and use it in GitHub Desktop.
// 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