Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate pallet-atomic-swap to umbrella crate #6601

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions Cargo.lock

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

16 changes: 3 additions & 13 deletions substrate/frame/atomic-swap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { workspace = true }
scale-info = { features = ["derive"], workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-core = { 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 }
Expand All @@ -31,17 +27,11 @@ pallet-balances = { workspace = true, default-features = true }
default = ["std"]
std = [
"codec/std",
"frame-support/std",
"frame-system/std",
"frame/std",
"pallet-balances/std",
"scale-info/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"frame/try-runtime",
"pallet-balances/try-runtime",
"sp-runtime/try-runtime",
]
26 changes: 14 additions & 12 deletions substrate/frame/atomic-swap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,20 @@ use core::{
marker::PhantomData,
ops::{Deref, DerefMut},
};
use frame_support::{
dispatch::DispatchResult,
pallet_prelude::MaxEncodedLen,
traits::{BalanceStatus, Currency, Get, ReservableCurrency},
weights::Weight,
RuntimeDebugNoBound,
use frame::{
deps::{
frame_support::{
dispatch::DispatchResult,
pallet_prelude::MaxEncodedLen,
traits::{BalanceStatus, Currency, Get, ReservableCurrency},
weights::Weight,
},
sp_io::hashing::blake2_256,
},
derive::{RuntimeDebug, RuntimeDebugNoBound},
prelude::*,
};
use frame_system::pallet_prelude::BlockNumberFor;
use scale_info::TypeInfo;
use sp_io::hashing::blake2_256;
use sp_runtime::RuntimeDebug;

/// Pending atomic swap operation.
#[derive(Clone, Eq, PartialEq, RuntimeDebugNoBound, Encode, Decode, TypeInfo, MaxEncodedLen)]
Expand Down Expand Up @@ -159,11 +162,10 @@ where

pub use pallet::*;

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

/// Atomic swap's pallet configuration trait.
#[pallet::config]
Expand Down
14 changes: 9 additions & 5 deletions substrate/frame/atomic-swap/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@

use super::*;
use crate as pallet_atomic_swap;

use frame_support::{derive_impl, traits::ConstU32};
use sp_runtime::BuildStorage;
use frame::{
runtime::{
prelude::{construct_runtime, derive_impl, ConstU32},
testing_prelude::BuildStorage,
},
testing_prelude::TestExternalities,
};

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

frame_support::construct_runtime!(
construct_runtime!(
pub enum Test
{
System: frame_system,
Expand Down Expand Up @@ -54,7 +58,7 @@ impl Config for Test {
const A: u64 = 1;
const B: u64 = 2;

pub fn new_test_ext() -> sp_io::TestExternalities {
pub fn new_test_ext() -> TestExternalities {
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
let genesis = pallet_balances::GenesisConfig::<Test> { balances: vec![(A, 100), (B, 200)] };
genesis.assimilate_storage(&mut t).unwrap();
Expand Down