Skip to content

Commit

Permalink
first draft
Browse files Browse the repository at this point in the history
  • Loading branch information
Krayt78 committed Dec 13, 2024
1 parent 8d4138f commit ca063b7
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 51 deletions.
7 changes: 1 addition & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 4 additions & 20 deletions substrate/frame/recovery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,24 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { features = ["derive"], workspace = true }
scale-info = { features = ["derive"], workspace = true }
frame-benchmarking = { optional = true, workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }
frame = { workspace = true, features = ["experimental", "runtime"] }

[dev-dependencies]
pallet-balances = { workspace = true, default-features = true }
sp-core = { workspace = true, default-features = true }

[features]
default = ["std"]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
'frame-benchmarking',
"frame/runtime-benchmarks",
]
std = [
"codec/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"pallet-balances/std",
"scale-info/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"frame/std",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"frame/try-runtime",
"pallet-balances/try-runtime",
"sp-runtime/try-runtime",
]
5 changes: 1 addition & 4 deletions substrate/frame/recovery/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ use super::*;

use crate::Pallet;
use alloc::{boxed::Box, vec, vec::Vec};
use frame_benchmarking::v2::*;
use frame_support::traits::{Currency, Get};
use frame_system::RawOrigin;
use sp_runtime::traits::Bounded;
use frame::{traits::Currency, benchmarking::prelude::*};

const SEED: u32 = 0;
const DEFAULT_DELAY: u32 = 0;
Expand Down
18 changes: 5 additions & 13 deletions substrate/frame/recovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,8 @@ extern crate alloc;
use alloc::{boxed::Box, vec::Vec};
use codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_runtime::{
traits::{CheckedAdd, CheckedMul, Dispatchable, SaturatedConversion, StaticLookup},
RuntimeDebug,
};

use frame_support::{
dispatch::{GetDispatchInfo, PostDispatchInfo},
traits::{BalanceStatus, Currency, ReservableCurrency},
BoundedVec,
};
use frame::{prelude::*, arithmetic::ArithmeticError,traits::{ReservableCurrency,Currency,BalanceStatus}};

pub use pallet::*;
pub use weights::WeightInfo;
Expand Down Expand Up @@ -211,12 +203,12 @@ pub struct RecoveryConfig<BlockNumber, Balance, Friends> {
threshold: u16,
}

#[frame_support::pallet]
#[frame::pallet]
pub mod pallet {
use super::*;
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use sp_runtime::ArithmeticError;
// use frame_support::pallet_prelude::*;
// use frame_system::pallet_prelude::*;
// use sp_runtime::ArithmeticError;

#[pallet::pallet]
pub struct Pallet<T>(_);
Expand Down
6 changes: 1 addition & 5 deletions substrate/frame/recovery/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
use super::*;

use crate as recovery;
use frame_support::{
derive_impl, parameter_types,
traits::{OnFinalize, OnInitialize},
};
use sp_runtime::BuildStorage;
use frame::testing_prelude::*;

type Block = frame_system::mocking::MockBlock<Test>;

Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/recovery/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
//! Tests for the module.
use super::*;
use frame_support::{assert_noop, assert_ok, traits::Currency};

use frame::testing_prelude::*;
use mock::{
new_test_ext, run_to_block, Balances, BalancesCall, MaxFriends, Recovery, RecoveryCall,
RuntimeCall, RuntimeOrigin, Test,
};
use sp_runtime::{bounded_vec, traits::BadOrigin};

#[test]
fn basic_setup_works() {
Expand Down
3 changes: 2 additions & 1 deletion substrate/frame/recovery/src/weights.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ca063b7

Please sign in to comment.