Skip to content

Commit

Permalink
chore: PR #207 is backported
Browse files Browse the repository at this point in the history
  • Loading branch information
khssnv authored and yahortsaryk committed Dec 20, 2023
1 parent bc71d5d commit a5ec218
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
12 changes: 11 additions & 1 deletion node/service/chain-specs/example.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
"mode": "Storage"
}
}
],
]
},
"ddcClusters": {
"clusters": [
Expand Down Expand Up @@ -233,6 +233,16 @@
]
]
]
},
"ddcPayouts": {
"authorisedCaller": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
"debtorCustomers": [
[
"0x0000000000000000000000000000000000000001",
"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
10000000000
]
]
}
}
}
Expand Down
27 changes: 27 additions & 0 deletions pallets/ddc-payouts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,33 @@ pub mod pallet {
Finalized = 7,
}

#[pallet::genesis_config]
pub struct GenesisConfig<T: Config> {
pub authorised_caller: Option<T::AccountId>,
pub debtor_customers: Vec<(ClusterId, T::AccountId, u128)>,
}

#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
GenesisConfig {
authorised_caller: Default::default(),
debtor_customers: Default::default(),
}
}
}

#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
AuthorisedCaller::<T>::set(self.authorised_caller.clone());

for (cluster_id, customer_id, debt) in &self.debtor_customers {
DebtorCustomers::<T>::insert(cluster_id, customer_id, debt);
}
}
}

#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::weight(T::WeightInfo::set_authorised_caller())]
Expand Down

0 comments on commit a5ec218

Please sign in to comment.