fix: Complete snowbridge pezpallet rebrand and critical bug fixes

- snowbridge-pezpallet-* → pezsnowbridge-pezpallet-* (201 refs)
- pallet/ directories → pezpallet/ (4 locations)
- Fixed pezpallet.rs self-include recursion bug
- Fixed sc-chain-spec hardcoded crate name in derive macro
- Reverted .pezpallet_by_name() to .pallet_by_name() (subxt API)
- Added BizinikiwiConfig type alias for zombienet tests
- Deleted obsolete session state files

Verified: pezsnowbridge-pezpallet-*, pezpallet-staking,
pezpallet-staking-async, pezframe-benchmarking-cli all pass cargo check
This commit is contained in:
2025-12-16 09:57:23 +03:00
parent eea003e14d
commit 3139ffa25e
3022 changed files with 42157 additions and 23579 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ edition.workspace = true
license = "Apache-2.0"
homepage.workspace = true
repository.workspace = true
description = "FRAME asset management pallet"
description = "FRAME asset management pezpallet"
readme = "README.md"
documentation = "https://docs.rs/pezpallet-assets"
+10 -10
View File
@@ -11,10 +11,10 @@ The Assets module provides functionality for asset management of fungible asset
* Asset Destruction
To use it in your runtime, you need to implement the assets
[`assets::Config`](https://docs.rs/pezpallet-assets/latest/pallet_assets/pallet/trait.Config.html).
[`assets::Config`](https://docs.rs/pezpallet-assets/latest/pallet_assets/pezpallet/trait.Config.html).
The supported dispatchable functions are documented in the
[`assets::Call`](https://docs.rs/pezpallet-assets/latest/pallet_assets/pallet/enum.Call.html) enum.
[`assets::Call`](https://docs.rs/pezpallet-assets/latest/pallet_assets/pezpallet/enum.Call.html) enum.
### Terminology
@@ -50,7 +50,7 @@ variants for documentation on each function.
* `balance` - Get the asset `id` balance of `who`.
* `total_supply` - Get the total supply of an asset `id`.
Please refer to the [`Pallet`](https://docs.rs/pezpallet-assets/latest/pallet_assets/pallet/struct.Pallet.html) struct for
Please refer to the [`Pezpallet`](https://docs.rs/pezpallet-assets/latest/pallet_assets/pezpallet/struct.Pezpallet.html) struct for
details on publicly available functions.
## Usage
@@ -71,20 +71,20 @@ Import the Assets module and types and derive your runtime's configuration trait
use pallet_assets as assets;
use sp_runtime::ArithmeticError;
#[frame_support::pallet]
pub mod pallet {
#[frame_support::pezpallet]
pub mod pezpallet {
use super::*;
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
#[pallet::pallet]
pub struct Pallet<T>(_);
#[pezpallet::pezpallet]
pub struct Pezpallet<T>(_);
#[pallet::config]
#[pezpallet::config]
pub trait Config: frame_system::Config + assets::Config {}
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pezpallet::call]
impl<T: Config> Pezpallet<T> {
pub fn issue_token_airdrop(origin: OriginFor<T>) -> DispatchResult {
let sender = ensure_signed(origin)?;
@@ -145,7 +145,7 @@ where
.map_err(|_| Error::Revert(Revert { reason: ERR_INVALID_CALLER.into() }))
}
/// Convert a `U256` value to the balance type of the pallet.
/// Convert a `U256` value to the balance type of the pezpallet.
fn to_balance(
value: alloy::primitives::U256,
) -> Result<<Runtime as Config<Instance>>::Balance, Error> {
@@ -189,7 +189,7 @@ where
);
let f = TransferFlags { keep_alive: false, best_effort: false, burn_dust: false };
pezpallet_assets::Pallet::<Runtime, Instance>::do_transfer(
pezpallet_assets::Pezpallet::<Runtime, Instance>::do_transfer(
asset_id,
&<Runtime as pezpallet_revive::Config>::AddressMapper::to_account_id(&from),
&dest,
@@ -219,7 +219,7 @@ where
env.charge(<Runtime as Config<Instance>>::WeightInfo::total_issuance())?;
let value =
Self::to_u256(pezpallet_assets::Pallet::<Runtime, Instance>::total_issuance(asset_id))?;
Self::to_u256(pezpallet_assets::Pezpallet::<Runtime, Instance>::total_issuance(asset_id))?;
return Ok(IERC20::totalSupplyCall::abi_encode_returns(&value));
}
@@ -233,7 +233,7 @@ where
let account = call.account.into_array().into();
let account = <Runtime as pezpallet_revive::Config>::AddressMapper::to_account_id(&account);
let value =
Self::to_u256(pezpallet_assets::Pallet::<Runtime, Instance>::balance(asset_id, account))?;
Self::to_u256(pezpallet_assets::Pezpallet::<Runtime, Instance>::balance(asset_id, account))?;
return Ok(IERC20::balanceOfCall::abi_encode_returns(&value));
}
@@ -250,7 +250,7 @@ where
let spender = call.spender.into_array().into();
let spender = <Runtime as pezpallet_revive::Config>::AddressMapper::to_account_id(&spender);
let value = Self::to_u256(pezpallet_assets::Pallet::<Runtime, Instance>::allowance(
let value = Self::to_u256(pezpallet_assets::Pezpallet::<Runtime, Instance>::allowance(
asset_id, &owner, &spender,
))?;
@@ -268,7 +268,7 @@ where
let spender = call.spender.into_array().into();
let spender = <Runtime as pezpallet_revive::Config>::AddressMapper::to_account_id(&spender);
pezpallet_assets::Pallet::<Runtime, Instance>::do_approve_transfer(
pezpallet_assets::Pezpallet::<Runtime, Instance>::do_approve_transfer(
asset_id,
&<Runtime as pezpallet_revive::Config>::AddressMapper::to_account_id(&owner),
&spender,
@@ -303,7 +303,7 @@ where
let to = call.to.into_array().into();
let to = <Runtime as pezpallet_revive::Config>::AddressMapper::to_account_id(&to);
pezpallet_assets::Pallet::<Runtime, Instance>::do_transfer_approved(
pezpallet_assets::Pezpallet::<Runtime, Instance>::do_transfer_approved(
asset_id,
&from,
&spender,
@@ -72,7 +72,7 @@ fn precompile_transfer_works() {
let data =
IERC20::transferCall { to: to_addr.0.into(), value: U256::from(10) }.abi_encode();
pezpallet_revive::Pallet::<Test>::bare_call(
pezpallet_revive::Pezpallet::<Test>::bare_call(
RuntimeOrigin::signed(from),
H160::from(asset_addr),
0u32.into(),
@@ -111,7 +111,7 @@ fn total_supply_works() {
let data = IERC20::totalSupplyCall {}.abi_encode();
let data = pezpallet_revive::Pallet::<Test>::bare_call(
let data = pezpallet_revive::Pezpallet::<Test>::bare_call(
RuntimeOrigin::signed(owner),
H160::from(asset_addr),
0u32.into(),
@@ -144,7 +144,7 @@ fn balance_of_works() {
let account = <Test as pezpallet_revive::Config>::AddressMapper::to_address(&owner).0.into();
let data = IERC20::balanceOfCall { account }.abi_encode();
let data = pezpallet_revive::Pallet::<Test>::bare_call(
let data = pezpallet_revive::Pezpallet::<Test>::bare_call(
RuntimeOrigin::signed(owner),
H160::from(asset_addr),
0u32.into(),
@@ -190,7 +190,7 @@ fn approval_works() {
let data = IERC20::approveCall { spender: spender_addr.0.into(), value: U256::from(25) }
.abi_encode();
pezpallet_revive::Pallet::<Test>::bare_call(
pezpallet_revive::Pezpallet::<Test>::bare_call(
RuntimeOrigin::signed(owner),
H160::from(asset_addr),
0u32.into(),
@@ -213,7 +213,7 @@ fn approval_works() {
IERC20::allowanceCall { owner: owner_addr.0.into(), spender: spender_addr.0.into() }
.abi_encode();
let data = pezpallet_revive::Pallet::<Test>::bare_call(
let data = pezpallet_revive::Pezpallet::<Test>::bare_call(
RuntimeOrigin::signed(owner),
H160::from(asset_addr),
0u32.into(),
@@ -236,7 +236,7 @@ fn approval_works() {
}
.abi_encode();
pezpallet_revive::Pallet::<Test>::bare_call(
pezpallet_revive::Pezpallet::<Test>::bare_call(
RuntimeOrigin::signed(spender),
H160::from(asset_addr),
0u32.into(),
+10 -10
View File
@@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! Assets pallet benchmarking.
//! Assets pezpallet benchmarking.
#![cfg(feature = "runtime-benchmarks")]
@@ -31,7 +31,7 @@ use pezframe_support::traits::{EnsureOrigin, Get, UnfilteredDispatchable};
use pezframe_system::RawOrigin as SystemOrigin;
use pezsp_runtime::{traits::Bounded, Weight};
use crate::Pallet as Assets;
use crate::Pezpallet as Assets;
const SEED: u32 = 0;
const MIN_BALANCE: u32 = 1;
@@ -147,11 +147,11 @@ fn add_approvals<T: Config<I>, I: 'static>(minter: T::AccountId, n: u32) {
}
fn assert_last_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::RuntimeEvent) {
pezframe_system::Pallet::<T>::assert_last_event(generic_event.into());
pezframe_system::Pezpallet::<T>::assert_last_event(generic_event.into());
}
fn assert_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::RuntimeEvent) {
pezframe_system::Pallet::<T>::assert_has_event(generic_event.into());
pezframe_system::Pezpallet::<T>::assert_has_event(generic_event.into());
}
benchmarks_instance_pallet! {
@@ -272,7 +272,7 @@ benchmarks_instance_pallet! {
let target_lookup = T::Lookup::unlookup(target.clone());
}: _(SystemOrigin::Signed(caller.clone()), asset_id.clone(), target_lookup, amount)
verify {
assert!(pezframe_system::Pallet::<T>::account_exists(&caller));
assert!(pezframe_system::Pezpallet::<T>::account_exists(&caller));
assert_last_event::<T, I>(Event::Transferred { asset_id: asset_id.into(), from: caller, to: target, amount }.into());
}
@@ -592,7 +592,7 @@ benchmarks_instance_pallet! {
let (asset_id, _, _) = create_default_minted_asset::<T, I>(true, 100u32.into());
let amount;
}: {
amount = Pallet::<T, I>::total_issuance(asset_id.into());
amount = Pezpallet::<T, I>::total_issuance(asset_id.into());
} verify {
assert_eq!(amount, 100u32.into());
}
@@ -601,7 +601,7 @@ benchmarks_instance_pallet! {
let (asset_id, caller, _) = create_default_minted_asset::<T, I>(true, 100u32.into());
let amount;
}: {
amount = Pallet::<T, I>::balance(asset_id.into(), caller);
amount = Pezpallet::<T, I>::balance(asset_id.into(), caller);
} verify {
assert_eq!(amount, 100u32.into());
}
@@ -613,20 +613,20 @@ benchmarks_instance_pallet! {
let delegate: T::AccountId = account("approval", 0, SEED);
let amount;
}: {
amount = Pallet::<T, I>::allowance(asset_id.into(), &caller, &delegate);
amount = Pezpallet::<T, I>::allowance(asset_id.into(), &caller, &delegate);
} verify {
assert_eq!(amount, 100u32.into());
}
migration_v2_foreign_asset_set_reserve_weight {
let (id, _, _) = create_default_asset::<T, I>(true);
let id: <T as pallet::Config<I>>::AssetId = id.into();
let id: <T as pezpallet::Config<I>>::AssetId = id.into();
let reserve = T::BenchmarkHelper::create_reserve_id_parameter(42);
}: {
let asset_id = Asset::<T, I>::iter_keys().next()
.ok_or_else(|| BenchmarkError::Override(BenchmarkResult::from_weight(Weight::MAX)))?;
assert_eq!(id, asset_id);
Pallet::<T, I>::unchecked_update_reserves(asset_id, vec![reserve.clone()]).unwrap();
Pezpallet::<T, I>::unchecked_update_reserves(asset_id, vec![reserve.clone()]).unwrap();
}
verify {
assert_eq!(Reserves::<T, I>::get(id)[0], reserve);
@@ -21,7 +21,7 @@ use super::*;
/// A mutator type allowing inspection and possible modification of the extra "sidecar" data.
///
/// This may be used as a `Deref` for the pallet's extra data. If mutated (using `DerefMut`), then
/// This may be used as a `Deref` for the pezpallet's extra data. If mutated (using `DerefMut`), then
/// any uncommitted changes (see `commit` function) will be automatically committed to storage when
/// dropped. Changes, even after committed, may be reverted to their original values with the
/// `revert` function.
+9 -9
View File
@@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! Functions for the Assets pallet.
//! Functions for the Assets pezpallet.
use super::*;
use alloc::vec;
@@ -30,7 +30,7 @@ pub(super) enum DeadConsequence {
use DeadConsequence::*;
// The main implementation block for the module.
impl<T: Config<I>, I: 'static> Pallet<T, I> {
impl<T: Config<I>, I: 'static> Pezpallet<T, I> {
// Public immutables
/// Return the extra "sid-car" data for `id`/`who`, or `None` if the account doesn't exist.
@@ -77,16 +77,16 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
ExistenceReason::DepositFrom(depositor.clone(), deposit)
}
} else if d.is_sufficient {
pezframe_system::Pallet::<T>::inc_sufficients(who);
pezframe_system::Pezpallet::<T>::inc_sufficients(who);
d.sufficients.saturating_inc();
ExistenceReason::Sufficient
} else {
pezframe_system::Pallet::<T>::inc_consumers(who)
pezframe_system::Pezpallet::<T>::inc_consumers(who)
.map_err(|_| Error::<T, I>::UnavailableConsumer)?;
// We ensure that we can still increment consumers once more because we could otherwise
// allow accidental usage of all consumer references which could cause grief.
if !pezframe_system::Pallet::<T>::can_inc_consumer(who) {
pezframe_system::Pallet::<T>::dec_consumers(who);
if !pezframe_system::Pezpallet::<T>::can_inc_consumer(who) {
pezframe_system::Pezpallet::<T>::dec_consumers(who);
return Err(Error::<T, I>::UnavailableConsumer.into());
}
ExistenceReason::Consumer
@@ -113,10 +113,10 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
use ExistenceReason::*;
match *reason {
Consumer => pezframe_system::Pallet::<T>::dec_consumers(who),
Consumer => pezframe_system::Pezpallet::<T>::dec_consumers(who),
Sufficient => {
d.sufficients = d.sufficients.saturating_sub(1);
pezframe_system::Pallet::<T>::dec_sufficients(who);
pezframe_system::Pezpallet::<T>::dec_sufficients(who);
},
DepositRefunded => {},
DepositHeld(_) | DepositFrom(..) if !force => return Keep,
@@ -160,7 +160,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
if amount < details.min_balance {
return DepositConsequence::BelowMinimum;
}
if !details.is_sufficient && !pezframe_system::Pallet::<T>::can_accrue_consumers(who, 2) {
if !details.is_sufficient && !pezframe_system::Pezpallet::<T>::can_accrue_consumers(who, 2) {
return DepositConsequence::CannotCreate;
}
if details.is_sufficient && details.sufficients.checked_add(1).is_none() {
@@ -30,7 +30,7 @@ use pezframe_support::{
use super::*;
impl<T: Config<I>, I: 'static> fungibles::Inspect<<T as SystemConfig>::AccountId> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> fungibles::Inspect<<T as SystemConfig>::AccountId> for Pezpallet<T, I> {
type AssetId = T::AssetId;
type Balance = T::Balance;
@@ -43,11 +43,11 @@ impl<T: Config<I>, I: 'static> fungibles::Inspect<<T as SystemConfig>::AccountId
}
fn balance(asset: Self::AssetId, who: &<T as SystemConfig>::AccountId) -> Self::Balance {
Pallet::<T, I>::balance(asset, who)
Pezpallet::<T, I>::balance(asset, who)
}
fn total_balance(asset: Self::AssetId, who: &<T as SystemConfig>::AccountId) -> Self::Balance {
Pallet::<T, I>::balance(asset.clone(), who)
Pezpallet::<T, I>::balance(asset.clone(), who)
.saturating_add(T::Holder::balance_on_hold(asset, who).unwrap_or_default())
}
@@ -57,7 +57,7 @@ impl<T: Config<I>, I: 'static> fungibles::Inspect<<T as SystemConfig>::AccountId
preservation: Preservation,
_: Fortitude,
) -> Self::Balance {
Pallet::<T, I>::reducible_balance(asset, who, !matches!(preservation, Expendable))
Pezpallet::<T, I>::reducible_balance(asset, who, !matches!(preservation, Expendable))
.unwrap_or(Zero::zero())
}
@@ -67,7 +67,7 @@ impl<T: Config<I>, I: 'static> fungibles::Inspect<<T as SystemConfig>::AccountId
amount: Self::Balance,
provenance: Provenance,
) -> DepositConsequence {
Pallet::<T, I>::can_increase(asset, who, amount, provenance == Minted)
Pezpallet::<T, I>::can_increase(asset, who, amount, provenance == Minted)
}
fn can_withdraw(
@@ -75,7 +75,7 @@ impl<T: Config<I>, I: 'static> fungibles::Inspect<<T as SystemConfig>::AccountId
who: &<T as SystemConfig>::AccountId,
amount: Self::Balance,
) -> WithdrawConsequence<Self::Balance> {
Pallet::<T, I>::can_decrease(asset, who, amount, false)
Pezpallet::<T, I>::can_decrease(asset, who, amount, false)
}
fn asset_exists(asset: Self::AssetId) -> bool {
@@ -83,7 +83,7 @@ impl<T: Config<I>, I: 'static> fungibles::Inspect<<T as SystemConfig>::AccountId
}
}
impl<T: Config<I>, I: 'static> fungibles::Mutate<<T as SystemConfig>::AccountId> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> fungibles::Mutate<<T as SystemConfig>::AccountId> for Pezpallet<T, I> {
fn done_mint_into(
asset_id: Self::AssetId,
beneficiary: &<T as SystemConfig>::AccountId,
@@ -116,7 +116,7 @@ impl<T: Config<I>, I: 'static> fungibles::Mutate<<T as SystemConfig>::AccountId>
}
impl<T: Config<I>, I: 'static> fungibles::Balanced<<T as SystemConfig>::AccountId>
for Pallet<T, I>
for Pezpallet<T, I>
{
type OnDropCredit = fungibles::DecreaseIssuance<T::AccountId, Self>;
type OnDropDebt = fungibles::IncreaseIssuance<T::AccountId, Self>;
@@ -138,7 +138,7 @@ impl<T: Config<I>, I: 'static> fungibles::Balanced<<T as SystemConfig>::AccountI
}
}
impl<T: Config<I>, I: 'static> fungibles::Unbalanced<T::AccountId> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> fungibles::Unbalanced<T::AccountId> for Pezpallet<T, I> {
fn handle_raw_dust(_: Self::AssetId, _: Self::Balance) {}
fn handle_dust(_: fungibles::Dust<T::AccountId, Self>) {
defensive!("`decrease_balance` and `increase_balance` have non-default impls; nothing else calls this; qed");
@@ -185,7 +185,7 @@ impl<T: Config<I>, I: 'static> fungibles::Unbalanced<T::AccountId> for Pallet<T,
// TODO: #13196 implement deactivate/reactivate once we have inactive balance tracking.
}
impl<T: Config<I>, I: 'static> fungibles::Create<T::AccountId> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> fungibles::Create<T::AccountId> for Pezpallet<T, I> {
fn create(
id: T::AssetId,
admin: T::AccountId,
@@ -196,7 +196,7 @@ impl<T: Config<I>, I: 'static> fungibles::Create<T::AccountId> for Pallet<T, I>
}
}
impl<T: Config<I>, I: 'static> fungibles::Destroy<T::AccountId> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> fungibles::Destroy<T::AccountId> for Pezpallet<T, I> {
fn start_destroy(id: T::AssetId, maybe_check_owner: Option<T::AccountId>) -> DispatchResult {
Self::do_start_destroy(id, maybe_check_owner)
}
@@ -215,7 +215,7 @@ impl<T: Config<I>, I: 'static> fungibles::Destroy<T::AccountId> for Pallet<T, I>
}
impl<T: Config<I>, I: 'static> fungibles::metadata::Inspect<<T as SystemConfig>::AccountId>
for Pallet<T, I>
for Pezpallet<T, I>
{
fn name(asset: T::AssetId) -> Vec<u8> {
Metadata::<T, I>::get(asset).name.to_vec()
@@ -231,7 +231,7 @@ impl<T: Config<I>, I: 'static> fungibles::metadata::Inspect<<T as SystemConfig>:
}
impl<T: Config<I>, I: 'static> fungibles::metadata::Mutate<<T as SystemConfig>::AccountId>
for Pallet<T, I>
for Pezpallet<T, I>
{
fn set(
asset: T::AssetId,
@@ -247,7 +247,7 @@ impl<T: Config<I>, I: 'static> fungibles::metadata::Mutate<<T as SystemConfig>::
impl<T: Config<I>, I: 'static>
fungibles::metadata::MetadataDeposit<
<T::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance,
> for Pallet<T, I>
> for Pezpallet<T, I>
{
fn calc_metadata_deposit(
name: &[u8],
@@ -258,7 +258,7 @@ impl<T: Config<I>, I: 'static>
}
impl<T: Config<I>, I: 'static> fungibles::approvals::Inspect<<T as SystemConfig>::AccountId>
for Pallet<T, I>
for Pezpallet<T, I>
{
// Check the amount approved to be spent by an owner to a delegate
fn allowance(
@@ -273,7 +273,7 @@ impl<T: Config<I>, I: 'static> fungibles::approvals::Inspect<<T as SystemConfig>
}
impl<T: Config<I>, I: 'static> fungibles::approvals::Mutate<<T as SystemConfig>::AccountId>
for Pallet<T, I>
for Pezpallet<T, I>
{
// Approve spending tokens from a given account
fn approve(
@@ -297,7 +297,7 @@ impl<T: Config<I>, I: 'static> fungibles::approvals::Mutate<<T as SystemConfig>:
}
impl<T: Config<I>, I: 'static> fungibles::roles::Inspect<<T as SystemConfig>::AccountId>
for Pallet<T, I>
for Pezpallet<T, I>
{
fn owner(asset: T::AssetId) -> Option<<T as SystemConfig>::AccountId> {
Asset::<T, I>::get(asset).map(|x| x.owner)
@@ -316,7 +316,7 @@ impl<T: Config<I>, I: 'static> fungibles::roles::Inspect<<T as SystemConfig>::Ac
}
}
impl<T: Config<I>, I: 'static> fungibles::InspectEnumerable<T::AccountId> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> fungibles::InspectEnumerable<T::AccountId> for Pezpallet<T, I> {
type AssetsIterator = KeyPrefixIterator<<T as Config<I>>::AssetId>;
/// Returns an iterator of the assets in existence.
@@ -327,7 +327,7 @@ impl<T: Config<I>, I: 'static> fungibles::InspectEnumerable<T::AccountId> for Pa
}
}
impl<T: Config<I>, I: 'static> fungibles::roles::ResetTeam<T::AccountId> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> fungibles::roles::ResetTeam<T::AccountId> for Pezpallet<T, I> {
fn reset_team(
id: T::AssetId,
owner: T::AccountId,
@@ -339,7 +339,7 @@ impl<T: Config<I>, I: 'static> fungibles::roles::ResetTeam<T::AccountId> for Pal
}
}
impl<T: Config<I>, I: 'static> fungibles::Refund<T::AccountId> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> fungibles::Refund<T::AccountId> for Pezpallet<T, I> {
type AssetId = T::AssetId;
type Balance = DepositBalanceOf<T, I>;
fn deposit_held(id: Self::AssetId, who: T::AccountId) -> Option<(T::AccountId, Self::Balance)> {
@@ -15,11 +15,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! Assets pallet's `StoredMap` implementation.
//! Assets pezpallet's `StoredMap` implementation.
use super::*;
impl<T: Config<I>, I: 'static> StoredMap<(T::AssetId, T::AccountId), T::Extra> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> StoredMap<(T::AssetId, T::AccountId), T::Extra> for Pezpallet<T, I> {
fn get(id_who: &(T::AssetId, T::AccountId)) -> T::Extra {
let (id, who) = id_who;
Account::<T, I>::get(id, who).map(|a| a.extra).unwrap_or_default()
+104 -104
View File
@@ -15,17 +15,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! # Assets Pallet
//! # Assets Pezpallet
//!
//! A simple, secure module for dealing with sets of assets implementing
//! [`fungible`](pezframe_support::traits::fungible) traits, via [`fungibles`] traits.
//!
//! The pallet makes heavy use of concepts such as Holds and Freezes from the
//! The pezpallet makes heavy use of concepts such as Holds and Freezes from the
//! [`pezframe_support::traits::fungible`] traits, therefore you should read and understand those docs
//! as a prerequisite to understanding this pallet.
//! as a prerequisite to understanding this pezpallet.
//!
//! See the [`frame_tokens`] reference docs for more information about the place of the
//! Assets pallet in FRAME.
//! Assets pezpallet in FRAME.
//!
//! ## Overview
//!
@@ -131,7 +131,7 @@
//! * `balance` - Get the asset `id` balance of `who`.
//! * `total_supply` - Get the total supply of an asset `id`.
//!
//! Please refer to the [`Pallet`] struct for details on publicly available functions.
//! Please refer to the [`Pezpallet`] struct for details on publicly available functions.
//!
//! ### Callbacks
//!
@@ -196,7 +196,7 @@ use pezframe_support::{
};
use pezframe_system::Config as SystemConfig;
pub use pallet::*;
pub use pezpallet::*;
pub use weights::WeightInfo;
type AccountIdLookupOf<T> = <<T as pezframe_system::Config>::Lookup as StaticLookup>::Source;
@@ -247,8 +247,8 @@ where
}
}
#[pezframe_support::pallet]
pub mod pallet {
#[pezframe_support::pezpallet]
pub mod pezpallet {
use super::*;
use codec::HasCompact;
use pezframe_support::{
@@ -263,9 +263,9 @@ pub mod pallet {
/// The maximum number of configurable reserve locations for one asset class.
pub const MAX_RESERVES: u32 = 5;
#[pallet::pallet]
#[pallet::storage_version(STORAGE_VERSION)]
pub struct Pallet<T, I = ()>(_);
#[pezpallet::pezpallet]
#[pezpallet::storage_version(STORAGE_VERSION)]
pub struct Pezpallet<T, I = ()>(_);
#[cfg(feature = "runtime-benchmarks")]
pub trait BenchmarkHelper<AssetIdParameter, ReserveIdParameter> {
@@ -316,11 +316,11 @@ pub mod pallet {
}
}
#[pallet::config(with_default)]
#[pezpallet::config(with_default)]
/// The module configuration trait.
pub trait Config<I: 'static = ()>: pezframe_system::Config {
/// The overarching event type.
#[pallet::no_default_bounds]
#[pezpallet::no_default_bounds]
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
@@ -339,14 +339,14 @@ pub mod pallet {
/// Max number of items to destroy per `destroy_accounts` and `destroy_approvals` call.
///
/// Must be configured to result in a weight that makes each call fit in a block.
#[pallet::constant]
#[pezpallet::constant]
type RemoveItemsLimit: Get<u32>;
/// Identifier for the class of asset.
type AssetId: Member + Parameter + Clone + MaybeSerializeDeserialize + MaxEncodedLen;
/// Wrapper around `Self::AssetId` to use in dispatchable call signatures. Allows the use
/// of compact encoding in instances of the pallet, which will prevent breaking changes
/// of compact encoding in instances of the pezpallet, which will prevent breaking changes
/// resulting from the removal of `HasCompact` from `Self::AssetId`.
///
/// This type includes the `From<Self::AssetId>` bound, since tightly coupled pallets may
@@ -358,12 +358,12 @@ pub mod pallet {
type ReserveData: Debug + Parameter + MaybeSerializeDeserialize + MaxEncodedLen;
/// The currency mechanism.
#[pallet::no_default]
#[pezpallet::no_default]
type Currency: ReservableCurrency<Self::AccountId>;
/// Standard asset class creation is only allowed if the origin attempting it and the
/// asset class are in this set.
#[pallet::no_default]
#[pezpallet::no_default]
type CreateOrigin: EnsureOriginWithArg<
Self::RuntimeOrigin,
Self::AssetId,
@@ -372,38 +372,38 @@ pub mod pallet {
/// The origin which may forcibly create or destroy an asset or otherwise alter privileged
/// attributes.
#[pallet::no_default]
#[pezpallet::no_default]
type ForceOrigin: EnsureOrigin<Self::RuntimeOrigin>;
/// The basic amount of funds that must be reserved for an asset.
#[pallet::constant]
#[pallet::no_default_bounds]
#[pezpallet::constant]
#[pezpallet::no_default_bounds]
type AssetDeposit: Get<DepositBalanceOf<Self, I>>;
/// The amount of funds that must be reserved for a non-provider asset account to be
/// maintained.
#[pallet::constant]
#[pallet::no_default_bounds]
#[pezpallet::constant]
#[pezpallet::no_default_bounds]
type AssetAccountDeposit: Get<DepositBalanceOf<Self, I>>;
/// The basic amount of funds that must be reserved when adding metadata to your asset.
#[pallet::constant]
#[pallet::no_default_bounds]
#[pezpallet::constant]
#[pezpallet::no_default_bounds]
type MetadataDepositBase: Get<DepositBalanceOf<Self, I>>;
/// The additional funds that must be reserved for the number of bytes you store in your
/// metadata.
#[pallet::constant]
#[pallet::no_default_bounds]
#[pezpallet::constant]
#[pezpallet::no_default_bounds]
type MetadataDepositPerByte: Get<DepositBalanceOf<Self, I>>;
/// The amount of funds that must be reserved when creating a new approval.
#[pallet::constant]
#[pallet::no_default_bounds]
#[pezpallet::constant]
#[pezpallet::no_default_bounds]
type ApprovalDeposit: Get<DepositBalanceOf<Self, I>>;
/// The maximum length of a name or symbol stored on-chain.
#[pallet::constant]
#[pezpallet::constant]
type StringLimit: Get<u32>;
/// A hook to allow a per-asset, per-account minimum balance to be enforced. This must be
@@ -425,7 +425,7 @@ pub mod pallet {
/// used to set up auto-incrementing asset IDs for this collection.
type CallbackHandle: AssetsCallback<Self::AssetId, Self::AccountId>;
/// Weight information for extrinsics in this pallet.
/// Weight information for extrinsics in this pezpallet.
type WeightInfo: WeightInfo;
/// Helper trait for benchmarks.
@@ -433,7 +433,7 @@ pub mod pallet {
type BenchmarkHelper: BenchmarkHelper<Self::AssetIdParameter, Self::ReserveData>;
}
#[pallet::storage]
#[pezpallet::storage]
/// Details of an asset.
pub type Asset<T: Config<I>, I: 'static = ()> = StorageMap<
_,
@@ -442,7 +442,7 @@ pub mod pallet {
AssetDetails<T::Balance, T::AccountId, DepositBalanceOf<T, I>>,
>;
#[pallet::storage]
#[pezpallet::storage]
/// The holdings of a specific account for a specific asset.
pub type Account<T: Config<I>, I: 'static = ()> = StorageDoubleMap<
_,
@@ -453,7 +453,7 @@ pub mod pallet {
AssetAccountOf<T, I>,
>;
#[pallet::storage]
#[pezpallet::storage]
/// Approved balance transfers. First balance is the amount approved for transfer. Second
/// is the amount of `T::Currency` reserved for storing this.
/// First key is the asset ID, second key is the owner and third key is the delegate.
@@ -467,7 +467,7 @@ pub mod pallet {
Approval<T::Balance, DepositBalanceOf<T, I>>,
>;
#[pallet::storage]
#[pezpallet::storage]
/// Metadata of an asset.
pub type Metadata<T: Config<I>, I: 'static = ()> = StorageMap<
_,
@@ -478,7 +478,7 @@ pub mod pallet {
>;
/// Maps an asset to a list of its configured reserve information.
#[pallet::storage]
#[pezpallet::storage]
pub type Reserves<T: Config<I>, I: 'static = ()> = StorageMap<
_,
Blake2_128Concat,
@@ -496,10 +496,10 @@ pub mod pallet {
///
/// The initial next asset ID can be set using the [`GenesisConfig`] or the
/// [SetNextAssetId](`migration::next_asset_id::SetNextAssetId`) migration.
#[pallet::storage]
#[pezpallet::storage]
pub type NextAssetId<T: Config<I>, I: 'static = ()> = StorageValue<_, T::AssetId, OptionQuery>;
#[pallet::genesis_config]
#[pezpallet::genesis_config]
#[derive(pezframe_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
/// Genesis assets: id, owner, is_sufficient, min_balance
@@ -519,7 +519,7 @@ pub mod pallet {
pub reserves: Vec<(T::AssetId, Vec<T::ReserveData>)>,
}
#[pallet::genesis_build]
#[pezpallet::genesis_build]
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
fn build(&self) {
for (id, owner, is_sufficient, min_balance) in &self.assets {
@@ -563,7 +563,7 @@ pub mod pallet {
}
for (id, account_id, amount) in &self.accounts {
let result = <Pallet<T, I>>::increase_balance(
let result = <Pezpallet<T, I>>::increase_balance(
id.clone(),
account_id,
*amount,
@@ -591,8 +591,8 @@ pub mod pallet {
}
}
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
#[pezpallet::event]
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config<I>, I: 'static = ()> {
/// Some asset class was created.
Created { asset_id: T::AssetId, creator: T::AccountId, owner: T::AccountId },
@@ -684,7 +684,7 @@ pub mod pallet {
ReservesRemoved { asset_id: T::AssetId },
}
#[pallet::error]
#[pezpallet::error]
pub enum Error<T, I = ()> {
/// Account balance must be greater than or equal to the transfer amount.
BalanceLow,
@@ -739,8 +739,8 @@ pub mod pallet {
TooManyReserves,
}
#[pallet::call(weight(<T as Config<I>>::WeightInfo))]
impl<T: Config<I>, I: 'static> Pallet<T, I> {
#[pezpallet::call(weight(<T as Config<I>>::WeightInfo))]
impl<T: Config<I>, I: 'static> Pezpallet<T, I> {
/// Issue a new class of fungible assets from a public origin.
///
/// This new asset class has no assets initially and its owner is the origin.
@@ -760,7 +760,7 @@ pub mod pallet {
/// Emits `Created` event when successful.
///
/// Weight: `O(1)`
#[pallet::call_index(0)]
#[pezpallet::call_index(0)]
pub fn create(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -827,13 +827,13 @@ pub mod pallet {
/// Emits `ForceCreated` event when successful.
///
/// Weight: `O(1)`
#[pallet::call_index(1)]
#[pezpallet::call_index(1)]
pub fn force_create(
origin: OriginFor<T>,
id: T::AssetIdParameter,
owner: AccountIdLookupOf<T>,
is_sufficient: bool,
#[pallet::compact] min_balance: T::Balance,
#[pezpallet::compact] min_balance: T::Balance,
) -> DispatchResult {
T::ForceOrigin::ensure_origin(origin)?;
let owner = T::Lookup::lookup(owner)?;
@@ -853,7 +853,7 @@ pub mod pallet {
///
/// It will fail with either [`Error::ContainsHolds`] or [`Error::ContainsFreezes`] if
/// an account contains holds or freezes in place.
#[pallet::call_index(2)]
#[pezpallet::call_index(2)]
pub fn start_destroy(origin: OriginFor<T>, id: T::AssetIdParameter) -> DispatchResult {
let maybe_check_owner = match T::ForceOrigin::try_origin(origin) {
Ok(_) => None,
@@ -875,8 +875,8 @@ pub mod pallet {
/// asset.
///
/// Each call emits the `Event::DestroyedAccounts` event.
#[pallet::call_index(3)]
#[pallet::weight(T::WeightInfo::destroy_accounts(T::RemoveItemsLimit::get()))]
#[pezpallet::call_index(3)]
#[pezpallet::weight(T::WeightInfo::destroy_accounts(T::RemoveItemsLimit::get()))]
pub fn destroy_accounts(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -899,8 +899,8 @@ pub mod pallet {
/// asset.
///
/// Each call emits the `Event::DestroyedApprovals` event.
#[pallet::call_index(4)]
#[pallet::weight(T::WeightInfo::destroy_approvals(T::RemoveItemsLimit::get()))]
#[pezpallet::call_index(4)]
#[pezpallet::weight(T::WeightInfo::destroy_approvals(T::RemoveItemsLimit::get()))]
pub fn destroy_approvals(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -921,7 +921,7 @@ pub mod pallet {
/// asset.
///
/// Each successful call emits the `Event::Destroyed` event.
#[pallet::call_index(5)]
#[pezpallet::call_index(5)]
pub fn finish_destroy(origin: OriginFor<T>, id: T::AssetIdParameter) -> DispatchResult {
ensure_signed(origin)?;
let id: T::AssetId = id.into();
@@ -940,12 +940,12 @@ pub mod pallet {
///
/// Weight: `O(1)`
/// Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`.
#[pallet::call_index(6)]
#[pezpallet::call_index(6)]
pub fn mint(
origin: OriginFor<T>,
id: T::AssetIdParameter,
beneficiary: AccountIdLookupOf<T>,
#[pallet::compact] amount: T::Balance,
#[pezpallet::compact] amount: T::Balance,
) -> DispatchResult {
let origin = ensure_signed(origin)?;
let beneficiary = T::Lookup::lookup(beneficiary)?;
@@ -969,12 +969,12 @@ pub mod pallet {
///
/// Weight: `O(1)`
/// Modes: Post-existence of `who`; Pre & post Zombie-status of `who`.
#[pallet::call_index(7)]
#[pezpallet::call_index(7)]
pub fn burn(
origin: OriginFor<T>,
id: T::AssetIdParameter,
who: AccountIdLookupOf<T>,
#[pallet::compact] amount: T::Balance,
#[pezpallet::compact] amount: T::Balance,
) -> DispatchResult {
let origin = ensure_signed(origin)?;
let who = T::Lookup::lookup(who)?;
@@ -1003,12 +1003,12 @@ pub mod pallet {
/// Weight: `O(1)`
/// Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of
/// `target`.
#[pallet::call_index(8)]
#[pezpallet::call_index(8)]
pub fn transfer(
origin: OriginFor<T>,
id: T::AssetIdParameter,
target: AccountIdLookupOf<T>,
#[pallet::compact] amount: T::Balance,
#[pezpallet::compact] amount: T::Balance,
) -> DispatchResult {
let origin = ensure_signed(origin)?;
let dest = T::Lookup::lookup(target)?;
@@ -1036,12 +1036,12 @@ pub mod pallet {
/// Weight: `O(1)`
/// Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of
/// `target`.
#[pallet::call_index(9)]
#[pezpallet::call_index(9)]
pub fn transfer_keep_alive(
origin: OriginFor<T>,
id: T::AssetIdParameter,
target: AccountIdLookupOf<T>,
#[pallet::compact] amount: T::Balance,
#[pezpallet::compact] amount: T::Balance,
) -> DispatchResult {
let source = ensure_signed(origin)?;
let dest = T::Lookup::lookup(target)?;
@@ -1070,13 +1070,13 @@ pub mod pallet {
/// Weight: `O(1)`
/// Modes: Pre-existence of `dest`; Post-existence of `source`; Account pre-existence of
/// `dest`.
#[pallet::call_index(10)]
#[pezpallet::call_index(10)]
pub fn force_transfer(
origin: OriginFor<T>,
id: T::AssetIdParameter,
source: AccountIdLookupOf<T>,
dest: AccountIdLookupOf<T>,
#[pallet::compact] amount: T::Balance,
#[pezpallet::compact] amount: T::Balance,
) -> DispatchResult {
let origin = ensure_signed(origin)?;
let source = T::Lookup::lookup(source)?;
@@ -1099,7 +1099,7 @@ pub mod pallet {
/// Emits `Frozen`.
///
/// Weight: `O(1)`
#[pallet::call_index(11)]
#[pezpallet::call_index(11)]
pub fn freeze(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -1136,7 +1136,7 @@ pub mod pallet {
/// Emits `Thawed`.
///
/// Weight: `O(1)`
#[pallet::call_index(12)]
#[pezpallet::call_index(12)]
pub fn thaw(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -1172,7 +1172,7 @@ pub mod pallet {
/// Emits `Frozen`.
///
/// Weight: `O(1)`
#[pallet::call_index(13)]
#[pezpallet::call_index(13)]
pub fn freeze_asset(origin: OriginFor<T>, id: T::AssetIdParameter) -> DispatchResult {
let origin = ensure_signed(origin)?;
let id: T::AssetId = id.into();
@@ -1198,7 +1198,7 @@ pub mod pallet {
/// Emits `Thawed`.
///
/// Weight: `O(1)`
#[pallet::call_index(14)]
#[pezpallet::call_index(14)]
pub fn thaw_asset(origin: OriginFor<T>, id: T::AssetIdParameter) -> DispatchResult {
let origin = ensure_signed(origin)?;
let id: T::AssetId = id.into();
@@ -1225,7 +1225,7 @@ pub mod pallet {
/// Emits `OwnerChanged`.
///
/// Weight: `O(1)`
#[pallet::call_index(15)]
#[pezpallet::call_index(15)]
pub fn transfer_ownership(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -1268,7 +1268,7 @@ pub mod pallet {
/// Emits `TeamChanged`.
///
/// Weight: `O(1)`
#[pallet::call_index(16)]
#[pezpallet::call_index(16)]
pub fn set_team(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -1312,8 +1312,8 @@ pub mod pallet {
/// Emits `MetadataSet`.
///
/// Weight: `O(1)`
#[pallet::call_index(17)]
#[pallet::weight(T::WeightInfo::set_metadata(name.len() as u32, symbol.len() as u32))]
#[pezpallet::call_index(17)]
#[pezpallet::weight(T::WeightInfo::set_metadata(name.len() as u32, symbol.len() as u32))]
pub fn set_metadata(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -1337,7 +1337,7 @@ pub mod pallet {
/// Emits `MetadataCleared`.
///
/// Weight: `O(1)`
#[pallet::call_index(18)]
#[pezpallet::call_index(18)]
pub fn clear_metadata(origin: OriginFor<T>, id: T::AssetIdParameter) -> DispatchResult {
let origin = ensure_signed(origin)?;
let id: T::AssetId = id.into();
@@ -1368,8 +1368,8 @@ pub mod pallet {
/// Emits `MetadataSet`.
///
/// Weight: `O(N + S)` where N and S are the length of the name and symbol respectively.
#[pallet::call_index(19)]
#[pallet::weight(T::WeightInfo::force_set_metadata(name.len() as u32, symbol.len() as u32))]
#[pezpallet::call_index(19)]
#[pezpallet::weight(T::WeightInfo::force_set_metadata(name.len() as u32, symbol.len() as u32))]
pub fn force_set_metadata(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -1420,7 +1420,7 @@ pub mod pallet {
/// Emits `MetadataCleared`.
///
/// Weight: `O(1)`
#[pallet::call_index(20)]
#[pezpallet::call_index(20)]
pub fn force_clear_metadata(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -1451,7 +1451,7 @@ pub mod pallet {
/// - `is_sufficient`: Whether a non-zero balance of this asset is deposit of sufficient
/// value to account for the state bloat associated with its balance storage. If set to
/// `true`, then non-zero balances may be stored without a `consumer` reference (and thus
/// an ED in the Balances pallet or whatever else is used to control user-account state
/// an ED in the Balances pezpallet or whatever else is used to control user-account state
/// growth).
/// - `is_frozen`: Whether this asset class is frozen except for permissioned/admin
/// instructions.
@@ -1459,7 +1459,7 @@ pub mod pallet {
/// Emits `AssetStatusChanged` with the identity of the asset.
///
/// Weight: `O(1)`
#[pallet::call_index(21)]
#[pezpallet::call_index(21)]
pub fn force_asset_status(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -1467,7 +1467,7 @@ pub mod pallet {
issuer: AccountIdLookupOf<T>,
admin: AccountIdLookupOf<T>,
freezer: AccountIdLookupOf<T>,
#[pallet::compact] min_balance: T::Balance,
#[pezpallet::compact] min_balance: T::Balance,
is_sufficient: bool,
is_frozen: bool,
) -> DispatchResult {
@@ -1515,12 +1515,12 @@ pub mod pallet {
/// Emits `ApprovedTransfer` on success.
///
/// Weight: `O(1)`
#[pallet::call_index(22)]
#[pezpallet::call_index(22)]
pub fn approve_transfer(
origin: OriginFor<T>,
id: T::AssetIdParameter,
delegate: AccountIdLookupOf<T>,
#[pallet::compact] amount: T::Balance,
#[pezpallet::compact] amount: T::Balance,
) -> DispatchResult {
let owner = ensure_signed(origin)?;
let delegate = T::Lookup::lookup(delegate)?;
@@ -1541,7 +1541,7 @@ pub mod pallet {
/// Emits `ApprovalCancelled` on success.
///
/// Weight: `O(1)`
#[pallet::call_index(23)]
#[pezpallet::call_index(23)]
pub fn cancel_approval(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -1577,7 +1577,7 @@ pub mod pallet {
/// Emits `ApprovalCancelled` on success.
///
/// Weight: `O(1)`
#[pallet::call_index(24)]
#[pezpallet::call_index(24)]
pub fn force_cancel_approval(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -1626,13 +1626,13 @@ pub mod pallet {
/// Emits `TransferredApproved` on success.
///
/// Weight: `O(1)`
#[pallet::call_index(25)]
#[pezpallet::call_index(25)]
pub fn transfer_approved(
origin: OriginFor<T>,
id: T::AssetIdParameter,
owner: AccountIdLookupOf<T>,
destination: AccountIdLookupOf<T>,
#[pallet::compact] amount: T::Balance,
#[pezpallet::compact] amount: T::Balance,
) -> DispatchResult {
let delegate = ensure_signed(origin)?;
let owner = T::Lookup::lookup(owner)?;
@@ -1650,8 +1650,8 @@ pub mod pallet {
/// - `id`: The identifier of the asset for the account to be created.
///
/// Emits `Touched` event when successful.
#[pallet::call_index(26)]
#[pallet::weight(T::WeightInfo::touch())]
#[pezpallet::call_index(26)]
#[pezpallet::weight(T::WeightInfo::touch())]
pub fn touch(origin: OriginFor<T>, id: T::AssetIdParameter) -> DispatchResult {
let who = ensure_signed(origin)?;
let id: T::AssetId = id.into();
@@ -1671,8 +1671,8 @@ pub mod pallet {
/// the asset account contains holds or freezes in place.
///
/// Emits `Refunded` event when successful.
#[pallet::call_index(27)]
#[pallet::weight(T::WeightInfo::refund())]
#[pezpallet::call_index(27)]
#[pezpallet::weight(T::WeightInfo::refund())]
pub fn refund(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -1694,7 +1694,7 @@ pub mod pallet {
/// - `min_balance`: The new value of `min_balance`.
///
/// Emits `AssetMinBalanceChanged` event when successful.
#[pallet::call_index(28)]
#[pezpallet::call_index(28)]
pub fn set_min_balance(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -1739,8 +1739,8 @@ pub mod pallet {
/// - `who`: The account to be created.
///
/// Emits `Touched` event when successful.
#[pallet::call_index(29)]
#[pallet::weight(T::WeightInfo::touch_other())]
#[pezpallet::call_index(29)]
#[pezpallet::weight(T::WeightInfo::touch_other())]
pub fn touch_other(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -1765,8 +1765,8 @@ pub mod pallet {
/// the asset account contains holds or freezes in place.
///
/// Emits `Refunded` event when successful.
#[pallet::call_index(30)]
#[pallet::weight(T::WeightInfo::refund_other())]
#[pezpallet::call_index(30)]
#[pezpallet::weight(T::WeightInfo::refund_other())]
pub fn refund_other(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -1788,7 +1788,7 @@ pub mod pallet {
/// Emits `Blocked`.
///
/// Weight: `O(1)`
#[pallet::call_index(31)]
#[pezpallet::call_index(31)]
pub fn block(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -1831,8 +1831,8 @@ pub mod pallet {
/// of the funds the asset account has, causing the sender asset account to be killed
/// (false), or transfer everything except at least the minimum balance, which will
/// guarantee to keep the sender asset account alive (true).
#[pallet::call_index(32)]
#[pallet::weight(T::WeightInfo::transfer_all())]
#[pezpallet::call_index(32)]
#[pezpallet::weight(T::WeightInfo::transfer_all())]
pub fn transfer_all(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -1867,8 +1867,8 @@ pub mod pallet {
/// - `reserves`: The full list of trusted reserves information.
///
/// Emits `AssetMinBalanceChanged` event when successful.
#[pallet::call_index(33)]
#[pallet::weight(T::WeightInfo::set_reserves())]
#[pezpallet::call_index(33)]
#[pezpallet::weight(T::WeightInfo::set_reserves())]
pub fn set_reserves(
origin: OriginFor<T>,
id: T::AssetIdParameter,
@@ -1886,8 +1886,8 @@ pub mod pallet {
}
}
#[pallet::view_functions]
impl<T: Config<I>, I: 'static> Pallet<T, I> {
#[pezpallet::view_functions]
impl<T: Config<I>, I: 'static> Pezpallet<T, I> {
/// Provide the asset details for asset `id`.
pub fn asset_details(
id: T::AssetId,
@@ -1915,7 +1915,7 @@ pub mod pallet {
/// Implements [`AccountTouch`] trait.
/// Note that a depositor can be any account, without any specific privilege.
impl<T: Config<I>, I: 'static> AccountTouch<T::AssetId, T::AccountId> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> AccountTouch<T::AssetId, T::AccountId> for Pezpallet<T, I> {
type Balance = DepositBalanceOf<T, I>;
fn deposit_required(_: T::AssetId) -> Self::Balance {
@@ -1926,7 +1926,7 @@ pub mod pallet {
match Asset::<T, I>::get(&asset) {
// refer to the [`Self::new_account`] function for more details.
Some(info) if info.is_sufficient => false,
Some(_) if pezframe_system::Pallet::<T>::can_accrue_consumers(who, 2) => false,
Some(_) if pezframe_system::Pezpallet::<T>::can_accrue_consumers(who, 2) => false,
Some(_) => !Account::<T, I>::contains_key(asset, who),
_ => true,
}
@@ -1942,7 +1942,7 @@ pub mod pallet {
}
/// Implements [`ContainsPair`] trait for a pair of asset and account IDs.
impl<T: Config<I>, I: 'static> ContainsPair<T::AssetId, T::AccountId> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> ContainsPair<T::AssetId, T::AccountId> for Pezpallet<T, I> {
/// Check if an account with the given asset ID and account address exists.
fn contains(asset: &T::AssetId, who: &T::AccountId) -> bool {
Account::<T, I>::contains_key(asset, who)
@@ -1951,7 +1951,7 @@ pub mod pallet {
/// Implements [`ProvideAssetReserves`] trait for getting the list of trusted reserves for a
/// given asset.
impl<T: Config<I>, I: 'static> ProvideAssetReserves<T::AssetId, T::ReserveData> for Pallet<T, I> {
impl<T: Config<I>, I: 'static> ProvideAssetReserves<T::AssetId, T::ReserveData> for Pezpallet<T, I> {
/// Provide the configured reserves for asset `id`.
fn reserves(id: &T::AssetId) -> Vec<T::ReserveData> {
Reserves::<T, I>::get(id).into_inner()
+6 -6
View File
@@ -91,8 +91,8 @@ pub mod v1 {
pub struct MigrateToV1<T>(core::marker::PhantomData<T>);
impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> {
fn on_runtime_upgrade() -> Weight {
let in_code_version = Pallet::<T>::in_code_storage_version();
let on_chain_version = Pallet::<T>::on_chain_storage_version();
let in_code_version = Pezpallet::<T>::in_code_storage_version();
let on_chain_version = Pezpallet::<T>::on_chain_storage_version();
if on_chain_version == 0 && in_code_version == 1 {
let mut translated = 0u64;
Asset::<T>::translate::<
@@ -102,7 +102,7 @@ pub mod v1 {
translated.saturating_inc();
Some(old_value.migrate_to_v1())
});
in_code_version.put::<Pallet<T>>();
in_code_version.put::<Pezpallet<T>>();
log::info!(
target: LOG_TARGET,
"Upgraded {} pools, storage to version {:?}",
@@ -122,7 +122,7 @@ pub mod v1 {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, TryRuntimeError> {
pezframe_support::ensure!(
Pallet::<T>::on_chain_storage_version() == 0,
Pezpallet::<T>::on_chain_storage_version() == 0,
"must upgrade linearly"
);
let prev_count = Asset::<T>::iter().count();
@@ -140,8 +140,8 @@ pub mod v1 {
"the asset count before and after the migration should be the same"
);
let in_code_version = Pallet::<T>::in_code_storage_version();
let on_chain_version = Pallet::<T>::on_chain_storage_version();
let in_code_version = Pezpallet::<T>::in_code_storage_version();
let on_chain_version = Pezpallet::<T>::on_chain_storage_version();
pezframe_support::ensure!(in_code_version == 1, "must_upgrade");
ensure!(
+1 -1
View File
@@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! Test environment for Assets pallet.
//! Test environment for Assets pezpallet.
use super::*;
use crate as pezpallet_assets;
+4 -4
View File
@@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! Tests for Assets pallet.
//! Tests for Assets pezpallet.
use super::*;
use crate::{mock::*, Error};
@@ -2049,8 +2049,8 @@ fn asset_create_and_destroy_is_reverted_if_callback_fails() {
#[test]
fn multiple_transfer_alls_work_ok() {
new_test_ext().execute_with(|| {
// Only run PoC when the system pallet is enabled, since the underlying bug is in the
// system pallet it won't work with BalancesAccountStore
// Only run PoC when the system pezpallet is enabled, since the underlying bug is in the
// system pezpallet it won't work with BalancesAccountStore
// Start with a balance of 100
Balances::force_set_balance(RuntimeOrigin::root(), 1, 100).unwrap();
// Emulate a sufficient, in reality this could be reached by transferring a sufficient
@@ -2160,7 +2160,7 @@ fn asset_id_cannot_be_reused() {
assert!(!Asset::<Test>::contains_key(0));
// Enable auto increment. Next asset id must be 5.
pallet::NextAssetId::<Test>::put(5);
pezpallet::NextAssetId::<Test>::put(5);
assert_noop!(Assets::create(RuntimeOrigin::signed(1), 0, 1, 1), Error::<Test>::BadAssetId);
assert_noop!(Assets::create(RuntimeOrigin::signed(1), 1, 1, 1), Error::<Test>::BadAssetId);
+1 -1
View File
@@ -70,7 +70,7 @@ type LeftFungibles<T> = fungibles::UnionOf<RightFungible<T>, T, ConvertToValue<L
///
/// By using this type, we can navigate through each branch of [`fungible::UnionOf`],
/// [`fungibles::UnionOf`], and [`ItemOf`] to access the underlying `fungibles::*`
/// implementation provided by the pallet.
/// implementation provided by the pezpallet.
type First<T> = fungibles::UnionOf<T, LeftFungibles<T>, ConvertToValue<RightAsset>, (), u64>;
#[test]
+3 -3
View File
@@ -15,7 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//! Various basic types for use in the assets pallet.
//! Various basic types for use in the assets pezpallet.
use super::*;
use pezframe_support::{
@@ -183,7 +183,7 @@ pub struct AssetAccount<Balance, DepositBalance, Extra, AccountId> {
pub status: AccountStatus,
/// The reason for the existence of the account.
pub reason: ExistenceReason<DepositBalance, AccountId>,
/// Additional "sidecar" data, in case some other pallet wants to use this storage item.
/// Additional "sidecar" data, in case some other pezpallet wants to use this storage item.
pub extra: Extra,
}
@@ -319,7 +319,7 @@ pub enum ConversionError {
// Type alias for `pezframe_system`'s account id.
type AccountIdOf<T> = <T as pezframe_system::Config>::AccountId;
// This pallet's asset id and balance type.
// This pezpallet's asset id and balance type.
type AssetIdOf<T, I> = <T as Config<I>>::AssetId;
type AssetBalanceOf<T, I> = <T as Config<I>>::Balance;
// Generic fungible balance type.
+2 -2
View File
@@ -44,10 +44,10 @@
// frame-omni-bencher
// v1
// benchmark
// pallet
// pezpallet
// --extrinsic=*
// --runtime=target/production/wbuild/pez-kitchensink-runtime/pez_kitchensink_runtime.wasm
// --pallet=pezpallet_assets
// --pezpallet=pezpallet_assets
// --header=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/HEADER-APACHE2
// --output=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/pezframe/assets/src/weights.rs
// --wasm-execution=compiled