Skip to content

Commit

Permalink
Revert "[Assets] Implement pallet-assets-holder (#4530)"
Browse files Browse the repository at this point in the history
This reverts commit 83db047.
  • Loading branch information
gui1117 committed Feb 19, 2025
1 parent f6226d2 commit a093944
Show file tree
Hide file tree
Showing 37 changed files with 67 additions and 1,877 deletions.
18 changes: 0 additions & 18 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ members = [
"substrate/frame/asset-rewards",
"substrate/frame/assets",
"substrate/frame/assets-freezer",
"substrate/frame/assets-holder",
"substrate/frame/atomic-swap",
"substrate/frame/aura",
"substrate/frame/authority-discovery",
Expand Down Expand Up @@ -903,7 +902,6 @@ pallet-asset-rewards = { path = "substrate/frame/asset-rewards", default-feature
pallet-asset-tx-payment = { path = "substrate/frame/transaction-payment/asset-tx-payment", default-features = false }
pallet-assets = { path = "substrate/frame/assets", default-features = false }
pallet-assets-freezer = { path = "substrate/frame/assets-freezer", default-features = false }
pallet-assets-holder = { path = "substrate/frame/assets-holder", default-features = false }
pallet-atomic-swap = { default-features = false, path = "substrate/frame/atomic-swap" }
pallet-aura = { path = "substrate/frame/aura", default-features = false }
pallet-authority-discovery = { path = "substrate/frame/authority-discovery", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ impl pallet_assets::Config<TrustBackedAssetsInstance> for Runtime {
type MetadataDepositPerByte = MetadataDepositPerByte;
type ApprovalDeposit = ApprovalDeposit;
type StringLimit = AssetsStringLimit;
type Holder = ();
type Freezer = AssetsFreezer;
type Extra = ();
type WeightInfo = weights::pallet_assets_local::WeightInfo<Runtime>;
Expand Down Expand Up @@ -319,7 +318,6 @@ impl pallet_assets::Config<PoolAssetsInstance> for Runtime {
type MetadataDepositPerByte = ConstU128<0>;
type ApprovalDeposit = ApprovalDeposit;
type StringLimit = ConstU32<50>;
type Holder = ();
type Freezer = PoolAssetsFreezer;
type Extra = ();
type WeightInfo = weights::pallet_assets_pool::WeightInfo<Runtime>;
Expand Down Expand Up @@ -496,7 +494,6 @@ impl pallet_assets::Config<ForeignAssetsInstance> for Runtime {
type MetadataDepositPerByte = ForeignAssetsMetadataDepositPerByte;
type ApprovalDeposit = ForeignAssetsApprovalDeposit;
type StringLimit = ForeignAssetsAssetsStringLimit;
type Holder = ();
type Freezer = ForeignAssetsFreezer;
type Extra = ();
type WeightInfo = weights::pallet_assets_foreign::WeightInfo<Runtime>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ impl pallet_assets::Config<TrustBackedAssetsInstance> for Runtime {
type MetadataDepositPerByte = MetadataDepositPerByte;
type ApprovalDeposit = ApprovalDeposit;
type StringLimit = AssetsStringLimit;
type Holder = ();
type Freezer = AssetsFreezer;
type Extra = ();
type WeightInfo = weights::pallet_assets_local::WeightInfo<Runtime>;
Expand Down Expand Up @@ -322,7 +321,6 @@ impl pallet_assets::Config<PoolAssetsInstance> for Runtime {
type MetadataDepositPerByte = ConstU128<0>;
type ApprovalDeposit = ConstU128<0>;
type StringLimit = ConstU32<50>;
type Holder = ();
type Freezer = PoolAssetsFreezer;
type Extra = ();
type WeightInfo = weights::pallet_assets_pool::WeightInfo<Runtime>;
Expand Down Expand Up @@ -548,7 +546,6 @@ impl pallet_assets::Config<ForeignAssetsInstance> for Runtime {
type MetadataDepositPerByte = ForeignAssetsMetadataDepositPerByte;
type ApprovalDeposit = ForeignAssetsApprovalDeposit;
type StringLimit = ForeignAssetsAssetsStringLimit;
type Holder = ();
type Freezer = ForeignAssetsFreezer;
type Extra = ();
type WeightInfo = weights::pallet_assets_foreign::WeightInfo<Runtime>;
Expand Down
3 changes: 0 additions & 3 deletions cumulus/parachains/runtimes/testing/penpal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,6 @@ impl pallet_assets::Config<TrustBackedAssetsInstance> for Runtime {
type MetadataDepositPerByte = MetadataDepositPerByte;
type ApprovalDeposit = ApprovalDeposit;
type StringLimit = AssetsStringLimit;
type Holder = ();
type Freezer = ();
type Extra = ();
type WeightInfo = pallet_assets::weights::SubstrateWeight<Runtime>;
Expand Down Expand Up @@ -523,7 +522,6 @@ impl pallet_assets::Config<ForeignAssetsInstance> for Runtime {
type MetadataDepositPerByte = ForeignAssetsMetadataDepositPerByte;
type ApprovalDeposit = ForeignAssetsApprovalDeposit;
type StringLimit = ForeignAssetsAssetsStringLimit;
type Holder = ();
type Freezer = ();
type Extra = ();
type WeightInfo = pallet_assets::weights::SubstrateWeight<Runtime>;
Expand Down Expand Up @@ -563,7 +561,6 @@ impl pallet_assets::Config<PoolAssetsInstance> for Runtime {
type MetadataDepositPerByte = ConstU128<0>;
type ApprovalDeposit = ConstU128<0>;
type StringLimit = ConstU32<50>;
type Holder = ();
type Freezer = ();
type Extra = ();
type WeightInfo = pallet_assets::weights::SubstrateWeight<Runtime>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,6 @@ impl pallet_assets::Config for Runtime {
type MetadataDepositPerByte = MetadataDepositPerByte;
type ApprovalDeposit = ApprovalDeposit;
type StringLimit = AssetsStringLimit;
type Holder = ();
type Freezer = ();
type Extra = ();
type WeightInfo = pallet_assets::weights::SubstrateWeight<Runtime>;
Expand Down
1 change: 0 additions & 1 deletion polkadot/xcm/pallet-xcm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ impl pallet_assets::Config for Test {
type MetadataDepositPerByte = ConstU128<1>;
type ApprovalDeposit = ConstU128<1>;
type StringLimit = ConstU32<50>;
type Holder = ();
type Freezer = ();
type WeightInfo = ();
type CallbackHandle = ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ impl pallet_assets::Config<TrustBackedAssetsInstance> for Runtime {
type CreateOrigin = AsEnsureOriginWithArg<frame_system::EnsureSigned<AccountId>>;
type ForceOrigin = frame_system::EnsureRoot<AccountId>;
type Freezer = ();
type Holder = ();
type CallbackHandle = ();
}

Expand All @@ -98,7 +97,6 @@ impl pallet_assets::Config<PoolAssetsInstance> for Runtime {
type CreateOrigin = AsEnsureOriginWithArg<frame_system::EnsureSigned<AccountId>>;
type ForceOrigin = frame_system::EnsureRoot<AccountId>;
type Freezer = ();
type Holder = ();
type CallbackHandle = ();
}

Expand Down
1 change: 0 additions & 1 deletion polkadot/xcm/xcm-builder/src/tests/pay/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ impl pallet_assets::Config for Test {
type AssetAccountDeposit = AssetAccountDeposit;
type ApprovalDeposit = ApprovalDeposit;
type StringLimit = AssetsStringLimit;
type Holder = ();
type Freezer = ();
type Extra = ();
type WeightInfo = ();
Expand Down
1 change: 0 additions & 1 deletion polkadot/xcm/xcm-runtime-apis/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ impl pallet_assets::Config for TestRuntime {
type Currency = Balances;
type CreateOrigin = AsEnsureOriginWithArg<frame_system::EnsureSigned<AccountId>>;
type ForceOrigin = frame_system::EnsureRoot<AccountId>;
type Holder = ();
type Freezer = ();
type AssetDeposit = ConstU128<1>;
type AssetAccountDeposit = ConstU128<10>;
Expand Down
107 changes: 0 additions & 107 deletions prdoc/stable2503/pr_4530.prdoc

This file was deleted.

2 changes: 0 additions & 2 deletions substrate/bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2029,7 +2029,6 @@ impl pallet_assets::Config<Instance1> for Runtime {
type MetadataDepositPerByte = MetadataDepositPerByte;
type ApprovalDeposit = ApprovalDeposit;
type StringLimit = StringLimit;
type Holder = ();
type Freezer = ();
type Extra = ();
type CallbackHandle = ();
Expand Down Expand Up @@ -2057,7 +2056,6 @@ impl pallet_assets::Config<Instance2> for Runtime {
type MetadataDepositPerByte = MetadataDepositPerByte;
type ApprovalDeposit = ApprovalDeposit;
type StringLimit = StringLimit;
type Holder = ();
type Freezer = ();
type Extra = ();
type WeightInfo = pallet_assets::weights::SubstrateWeight<Runtime>;
Expand Down
2 changes: 0 additions & 2 deletions substrate/frame/asset-conversion/ops/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ impl pallet_assets::Config<Instance1> for Test {
type Currency = Balances;
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<Self::AccountId>>;
type ForceOrigin = frame_system::EnsureRoot<Self::AccountId>;
type Holder = ();
type Freezer = ();
}

Expand All @@ -77,7 +76,6 @@ impl pallet_assets::Config<Instance2> for Test {
type CreateOrigin =
AsEnsureOriginWithArg<EnsureSignedBy<AssetConversionOrigin, Self::AccountId>>;
type ForceOrigin = frame_system::EnsureRoot<Self::AccountId>;
type Holder = ();
type Freezer = ();
}

Expand Down
2 changes: 0 additions & 2 deletions substrate/frame/asset-conversion/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ impl pallet_assets::Config<Instance1> for Test {
type MetadataDepositPerByte = ConstU128<1>;
type ApprovalDeposit = ConstU128<1>;
type StringLimit = ConstU32<50>;
type Holder = ();
type Freezer = ();
type Extra = ();
type WeightInfo = ();
Expand All @@ -109,7 +108,6 @@ impl pallet_assets::Config<Instance2> for Test {
type MetadataDepositPerByte = ConstU128<0>;
type ApprovalDeposit = ConstU128<0>;
type StringLimit = ConstU32<50>;
type Holder = ();
type Freezer = ();
type Extra = ();
type WeightInfo = ();
Expand Down
1 change: 0 additions & 1 deletion substrate/frame/asset-rewards/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ impl pallet_assets::Config<Instance1> for MockRuntime {
type ApprovalDeposit = ConstU128<1>;
type StringLimit = ConstU32<50>;
type Freezer = AssetsFreezer;
type Holder = ();
type Extra = ();
type WeightInfo = ();
type CallbackHandle = ();
Expand Down
6 changes: 4 additions & 2 deletions substrate/frame/asset-rewards/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,8 @@ mod stake {
Preservation::Expendable,
Fortitude::Force,
),
initial_balance - 1000
// - extra 1 for ed
initial_balance - 1000 - 1
);

// User stakes more tokens
Expand All @@ -459,7 +460,8 @@ mod stake {
Preservation::Expendable,
Fortitude::Force,
),
initial_balance - 1500
// - extra 1 for ed
initial_balance - 1500 - 1
);

// Event is emitted.
Expand Down
14 changes: 0 additions & 14 deletions substrate/frame/assets-freezer/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
// SOFTWARE.

use super::*;
use frame::prelude::storage::StorageDoubleMap;
use pallet_assets::FrozenBalance;

// Implements [`FrozenBalance`] from [`pallet-assets`], so it can understand how much of an
Expand All @@ -36,22 +35,9 @@ impl<T: Config<I>, I: 'static> FrozenBalance<T::AssetId, T::AccountId, T::Balanc
}

fn died(asset: T::AssetId, who: &T::AccountId) {
defensive_assert!(
Freezes::<T, I>::get(asset.clone(), who).is_empty(),
"The list of Freezes should be empty before allowing an account to die"
);
defensive_assert!(
FrozenBalances::<T, I>::get(asset.clone(), who).is_none(),
"There should not be a frozen balance before allowing to die"
);

FrozenBalances::<T, I>::remove(asset.clone(), who);
Freezes::<T, I>::remove(asset, who);
}

fn contains_freezes(asset: T::AssetId) -> bool {
Freezes::<T, I>::contains_prefix(asset)
}
}

// Implement [`fungibles::Inspect`](frame_support::traits::fungibles::Inspect) as it is bound by
Expand Down
1 change: 0 additions & 1 deletion substrate/frame/assets-freezer/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ impl pallet_assets::Config for Test {
type RemoveItemsLimit = ConstU32<10>;
type CallbackHandle = ();
type Currency = Balances;
type Holder = ();
type Freezer = AssetsFreezer;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
Expand Down
Loading

0 comments on commit a093944

Please sign in to comment.