Skip to content
Snippets Groups Projects
Commit dcc9d473 authored by Éloïs's avatar Éloïs
Browse files

remove all try_get in pallet ud

parent c816592d
No related branches found
No related tags found
1 merge request!83feat(runtime): create UDs manually with new call universalDividend.claim_uds
This commit is part of merge request !83. Comments created here will be created in the context of that merge request.
......@@ -225,8 +225,8 @@ pub mod pallet {
fn create_ud(members_count: BalanceOf<T>) -> Weight {
let total_weight: Weight = 0;
let ud_amount = <CurrentUd<T>>::try_get().expect("corrupted storage");
let monetary_mass = <MonetaryMass<T>>::try_get().expect("corrupted storage");
let ud_amount = <CurrentUd<T>>::get();
let monetary_mass = <MonetaryMass<T>>::get();
// TODO inc ud index
let ud_index = CurrentUdIndex::<T>::mutate(|next_ud_index| {
......@@ -287,8 +287,7 @@ pub mod pallet {
) -> DispatchResultWithPostInfo {
let who = ensure_signed(origin)?;
let dest = T::Lookup::lookup(dest)?;
let ud_amount =
<CurrentUd<T>>::try_get().map_err(|_| DispatchError::Other("corrupted storage"))?;
let ud_amount = <CurrentUd<T>>::get();
T::Currency::transfer(
&who,
&dest,
......@@ -300,9 +299,9 @@ pub mod pallet {
fn reeval_ud(members_count: BalanceOf<T>) -> Weight {
let total_weight: Weight = 0;
let ud_amount = <CurrentUd<T>>::try_get().expect("corrupted storage");
let ud_amount = <CurrentUd<T>>::get();
let monetary_mass = <MonetaryMass<T>>::try_get().expect("corrupted storage");
let monetary_mass = <MonetaryMass<T>>::get();
let new_ud_amount = Self::reeval_ud_formula(
ud_amount,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment