Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Rebase & review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinonard committed Dec 5, 2022
1 parent d6153c4 commit 0491fd6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion frame/assets/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,12 +750,12 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
break
}
}
T::CallbackHandle::destroyed(&id);
Self::deposit_event(Event::ApprovalsDestroyed {
asset_id: id,
approvals_destroyed: removed_approvals as u32,
approvals_remaining: details.approvals as u32,
});
T::CallbackHandle::destroyed(&id);
Ok(())
})?;
Ok(removed_approvals)
Expand Down
4 changes: 2 additions & 2 deletions frame/assets/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ impl pallet_balances::Config for Test {
pub struct AssetsCallbackHandle;
impl AssetsCallback<AssetId, AccountId> for AssetsCallbackHandle {
fn created(_id: &AssetId, _owner: &AccountId) {
storage::set(b"asset_created", &true.encode());
storage::set(b"asset_created", &().encode());
}

fn destroyed(_id: &AssetId) {
storage::set(b"asset_destroyed", &true.encode());
storage::set(b"asset_destroyed", &().encode());
}
}

Expand Down
6 changes: 3 additions & 3 deletions frame/assets/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1203,12 +1203,12 @@ fn normal_asset_create_and_destroy_callbacks_should_work() {
assert!(storage::get(b"asset_destroyed").is_none());

Balances::make_free_balance_be(&1, 100);
assert_ok!(Assets::create(Origin::signed(1), 0, 1, 1));
assert_ok!(Assets::create(RuntimeOrigin::signed(1), 0, 1, 1));
assert!(storage::get(b"asset_created").is_some());
assert!(storage::get(b"asset_destroyed").is_none());

let w = Asset::<Test>::get(0).unwrap().destroy_witness();
assert_ok!(Assets::destroy(Origin::signed(1), 0, w));
assert_ok!(Assets::destroy(RuntimeOrigin::signed(1), 0, w));
assert!(storage::get(b"asset_destroyed").is_some());
});
}
Expand All @@ -1217,7 +1217,7 @@ fn normal_asset_create_and_destroy_callbacks_should_work() {
fn root_asset_create_should_work() {
new_test_ext().execute_with(|| {
assert!(storage::get(b"asset_created").is_none());
assert_ok!(Assets::force_create(Origin::root(), 0, 1, true, 1));
assert_ok!(Assets::force_create(RuntimeOrigin::root(), 0, 1, true, 1));
assert!(storage::get(b"asset_created").is_some());
assert!(storage::get(b"asset_destroyed").is_none());
});
Expand Down

0 comments on commit 0491fd6

Please sign in to comment.