Skip to content

Commit dcbe6d8

Browse files
authored
- Enhanced the remove_all function in the Fund Admin Records pallet. When invoked, it now clears out the Signer Account and All Records storage items in addition to the existing removal process. This ensures a clean state reset when removing all records. (#9)
- Extended the `RecordType` enum in the Fund Admin Records pallet to include a new variant `Confirm`. This addition caters to a new category of records, enhancing the classification and understanding of the record data. - Refactored multiple test cases in the Fund Admin Records pallet to use `RuntimeOrigin` instead of `Origin` for the function calls. This aligns with the recent change in the type definition for `RuntimeOrigin` in the mock implementation. - Extended the `RecordType` enum in the Fund Admin Records pallet to include a new variant `Confirm`. This addition caters to a new category of records, enhancing the classification and understanding of the record data.
1 parent 04dbeca commit dcbe6d8

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

pallets/fund-admin-records/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ pub mod pallet {
168168
origin: OriginFor<T>,
169169
) -> DispatchResult{
170170
T::RemoveOrigin::ensure_origin(origin.clone())?;
171-
171+
let _ = <SignerAccount<T>>::kill();
172+
let _ = <Records<T>>::clear(1000, None);
172173
Ok(())
173174
}
174175
}

pallets/fund-admin-records/src/mock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl system::Config for Test {
3535
type BlockLength = ();
3636
type DbWeight = ();
3737
type RuntimeOrigin = RuntimeOrigin;
38-
type Call = Call;
38+
type RuntimeCall = RuntimeCall;
3939
type Index = u64;
4040
type BlockNumber = u64;
4141
type Hash = H256;

pallets/fund-admin-records/src/tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fn make_array_record_collection(num: u16) -> RecordCollection<Test> {
5454
fn set_signer_account_works() {
5555
new_test_ext().execute_with(|| {
5656
let signer_account = 1;
57-
assert_ok!(FundAdminRecords::set_signer_account(Origin::root(), signer_account));
57+
assert_ok!(FundAdminRecords::set_signer_account(RuntimeOrigin::root(), signer_account));
5858
assert_eq!(FundAdminRecords::signer_account(), Some(signer_account));
5959
});
6060
}
@@ -69,7 +69,7 @@ fn cannot_add_record_if_signer_account_is_not_set() {
6969
let recod_request = make_record_collection(project_id, hashed_info, table, record_type);
7070

7171
assert_noop!(
72-
FundAdminRecords::add_record(Origin::signed(1), recod_request),
72+
FundAdminRecords::add_record(RuntimeOrigin::signed(1), recod_request),
7373
Error::<Test>::SignerAccountNotSet
7474
);
7575
});
@@ -90,10 +90,10 @@ fn add_drawdown_record_works() {
9090
record_type
9191
);
9292

93-
assert_ok!(FundAdminRecords::set_signer_account(Origin::root(), signer_account));
93+
assert_ok!(FundAdminRecords::set_signer_account(RuntimeOrigin::root(), signer_account));
9494

9595
assert_ok!(FundAdminRecords::add_record(
96-
Origin::signed(signer_account),
96+
RuntimeOrigin::signed(signer_account),
9797
recod_request
9898
));
9999

pallets/fund-admin-records/src/types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ pub enum RecordType {
3939
Reject,
4040
Recovery,
4141
Cancel,
42+
Confirm
4243
}

0 commit comments

Comments
 (0)