Skip to content

Commit

Permalink
Migrate pallet-atomic-swap to umbrella crate (#6601)
Browse files Browse the repository at this point in the history
Part of #6504

---------

Co-authored-by: Giuseppe Re <giuseppe.re@parity.io>
  • Loading branch information
runcomet and re-gius authored Dec 20, 2024
1 parent e964644 commit 4e805ca
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 35 deletions.
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",
]
16 changes: 4 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,11 @@ 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::{
prelude::*,
traits::{BalanceStatus, Currency, ReservableCurrency},
};
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 +153,9 @@ where

pub use 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
8 changes: 3 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,11 @@

use super::*;
use crate as pallet_atomic_swap;

use frame_support::{derive_impl, traits::ConstU32};
use sp_runtime::BuildStorage;
use frame::testing_prelude::*;

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 +52,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

0 comments on commit 4e805ca

Please sign in to comment.