Skip to content

Commit

Permalink
Merge pull request #290 from justinphamnz/feature/nft-improvements
Browse files Browse the repository at this point in the history
Update era config to include more initial era setup
  • Loading branch information
justinphamnz authored Nov 27, 2023
2 parents 8ab1b0e + e035dda commit f2c6049
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pallets/spp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,13 @@ pub mod pallet {
},
/// Reward rate per era updated.
EstimatedRewardRatePerEraUpdated { reward_rate_per_era: Rate },
/// Unlock duration updated.
UnlockDurationUpdated {
currency_id: FungibleTokenId,
unlock_duration: StakingRound,
},
/// Iterator limit updated.
IterationLimitUpdated { new_limit: u32 },
}

#[pallet::error]
Expand Down Expand Up @@ -678,6 +685,8 @@ pub mod pallet {
frequency: Option<BlockNumberFor<T>>,
last_staking_round: StakingRound,
estimated_reward_rate_per_era: Option<Rate>,
unlock_duration: Option<(FungibleTokenId, StakingRound)>,
iteration_limit: Option<u32>,
) -> DispatchResult {
T::GovernanceOrigin::ensure_origin(origin)?;

Expand Down Expand Up @@ -709,6 +718,20 @@ pub mod pallet {
})?;
Self::deposit_event(Event::<T>::EstimatedRewardRatePerEraUpdated { reward_rate_per_era });
}

if let Some((currency_id, staking_round)) = unlock_duration {
UnlockDuration::<T>::insert(currency_id, staking_round);
Self::deposit_event(Event::<T>::UnlockDurationUpdated {
currency_id,
unlock_duration: staking_round,
})
}

if let Some(new_limit) = iteration_limit {
IterationLimit::<T>::put(new_limit);
Self::deposit_event(Event::<T>::IterationLimitUpdated { new_limit })
}

Ok(())
}

Expand Down

0 comments on commit f2c6049

Please sign in to comment.