diff --git a/node/service/chain-specs/example.json b/node/service/chain-specs/example.json index 6014d0a00..961ae7795 100644 --- a/node/service/chain-specs/example.json +++ b/node/service/chain-specs/example.json @@ -193,7 +193,7 @@ "mode": "Storage" } } - ], + ] }, "ddcClusters": { "clusters": [ @@ -233,6 +233,16 @@ ] ] ] + }, + "ddcPayouts": { + "authorisedCaller": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY", + "debtorCustomers": [ + [ + "0x0000000000000000000000000000000000000001", + "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY", + 10000000000 + ] + ] } } } diff --git a/pallets/ddc-payouts/src/lib.rs b/pallets/ddc-payouts/src/lib.rs index 9851394ea..01a8a67d3 100644 --- a/pallets/ddc-payouts/src/lib.rs +++ b/pallets/ddc-payouts/src/lib.rs @@ -310,6 +310,33 @@ pub mod pallet { Finalized = 7, } + #[pallet::genesis_config] + pub struct GenesisConfig { + pub authorised_caller: Option, + pub debtor_customers: Vec<(ClusterId, T::AccountId, u128)>, + } + + #[cfg(feature = "std")] + impl Default for GenesisConfig { + fn default() -> Self { + GenesisConfig { + authorised_caller: Default::default(), + debtor_customers: Default::default(), + } + } + } + + #[pallet::genesis_build] + impl GenesisBuild for GenesisConfig { + fn build(&self) { + AuthorisedCaller::::set(self.authorised_caller.clone()); + + for (cluster_id, customer_id, debt) in &self.debtor_customers { + DebtorCustomers::::insert(cluster_id, customer_id, debt); + } + } + } + #[pallet::call] impl Pallet { #[pallet::weight(T::WeightInfo::set_authorised_caller())]