Skip to content

Commit

Permalink
All tests fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ndkazu committed Nov 3, 2024
1 parent 1dfcee6 commit 8323d0a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions substrate/frame/distribution/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,12 @@ impl<T: Config> Pallet<T> {
let infos = Spends::<T>::get(&project).ok_or(Error::<T>::InexistentSpend)?;
let now = T::BlockNumberProvider::current_block_number();
let when = now.saturating_add(T::BufferPeriod::get());
let origin: PalletsOriginOf<T> = RawOrigin::Root.into();
T::Scheduler::schedule_named(
(DISTRIBUTION_ID, "enactment", project).using_encoded(sp_io::hashing::blake2_256),
DispatchTime::At(when),
None,
63,
origin,
frame_system::RawOrigin::Root.into(),
call,
)?;

Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/distribution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ pub mod pallet {
#[pallet::weight(<T as pallet::Config>::WeightInfo::claim_reward_for(T::MaxProjects::get()))]
#[transactional]
pub fn execute_claim(origin: OriginFor<T>, project_id: ProjectId<T>) -> DispatchResult {
let _caller = ensure_signed(origin)?;
ensure_root(origin)?;
let now = T::BlockNumberProvider::current_block_number();
let pot = Self::pot_account();
let info = Spends::<T>::get(&project_id).ok_or(Error::<T>::InexistentSpend)?;
Expand Down
10 changes: 5 additions & 5 deletions substrate/frame/distribution/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,16 +218,16 @@ fn funds_claim_works() {
let balance_1 =
<<Test as Config>::NativeBalance as fungible::Inspect<u64>>::balance(&project_id);

/* expect_events(vec![
expect_events(vec![
RuntimeEvent::Distribution(Event::RewardClaimed {
when: now,
amount: project.amount,
project_id,
}),
]);*/
//assert!(balance_1 > balance_0);
// assert_eq!(Projects::<Test>::get().len(), 0);
]);
assert!(balance_1 > balance_0);
assert_eq!(Projects::<Test>::get().len(), 0);
// Spend has been removed from storage
// assert!(!Spends::<Test>::get(0).is_some());
assert!(!Spends::<Test>::get(0).is_some());
})
}

0 comments on commit 8323d0a

Please sign in to comment.