Skip to content
This repository was archived by the owner on Dec 1, 2025. It is now read-only.
Merged
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
14 changes: 10 additions & 4 deletions pallets/phala-world/src/incubation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ pub mod pallet {
#[pallet::call]
impl<T: Config> Pallet<T>
where
T: pallet_uniques::Config<ClassId = CollectionId, InstanceId = NftId>,
T: pallet_uniques::Config<CollectionId = CollectionId, ItemId = NftId>,
{
/// Once users have received their origin_of_shells and the start incubation event has been
/// triggered, they can start the incubation process and a timer will start for the
Expand Down Expand Up @@ -252,7 +252,7 @@ pub mod pallet {
);
// Check if account owns an Origin of Shell NFT
ensure!(
pallet_uniques::pallet::Pallet::<T>::owned_in_class(&collection_id, &sender)
pallet_uniques::pallet::Pallet::<T>::owned_in_collection(&collection_id, &sender)
.count() > 0,
Error::<T>::CannotSendFoodToOriginOfShell
);
Expand Down Expand Up @@ -375,7 +375,7 @@ pub mod pallet {
let rarity_type: RarityType = Decode::decode(&mut rarity_type_value.as_slice())
.expect("[rarity] should not fail");
let generation_id: GenerationId =
Decode::decode(&mut generation.as_slice()).expect("[generation should not fail");
Decode::decode(&mut generation.as_slice()).expect("[generation] should not fail");
// Get Shell Collection next NFT ID
let shell_nft_id = pallet_rmrk_core::NextNftId::<T>::get(shell_collection_id);
// Burn Origin of Shell NFT then Mint Shell NFT
Expand Down Expand Up @@ -403,6 +403,12 @@ pub mod pallet {
Some(nft_id),
rarity_type_key,
)?;
pallet_uniques::Pallet::<T>::clear_attribute(
origin.clone(),
collection_id,
Some(nft_id),
generation_key,
)?;
// Mint Shell NFT to Overlord to add attributes and resource before sending to owner
pallet_rmrk_core::Pallet::<T>::mint_nft(
origin.clone(),
Expand Down Expand Up @@ -532,7 +538,7 @@ pub mod pallet {

impl<T: Config> Pallet<T>
where
T: pallet_uniques::Config<ClassId = CollectionId, InstanceId = NftId>,
T: pallet_uniques::Config<CollectionId = CollectionId, ItemId = NftId>,
{
/// Helper function to ensure that the sender owns the origin of shell NFT.
///
Expand Down
12 changes: 6 additions & 6 deletions pallets/phala-world/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ impl pallet_rmrk_core::Config for Test {
}

parameter_types! {
pub const ClassDeposit: Balance = 10_000 * PHA; // 1 UNIT deposit to create asset class
pub const InstanceDeposit: Balance = 100 * PHA; // 1/100 UNIT deposit to create asset instance
pub const CollectionDeposit: Balance = 10_000 * PHA; // 1 UNIT deposit to create collection
pub const ItemDeposit: Balance = 100 * PHA; // 1/100 UNIT deposit to create item
pub const KeyLimit: u32 = 32; // Max 32 bytes per key
pub const ValueLimit: u32 = 64; // Max 64 bytes per value
pub const UniquesMetadataDepositBase: Balance = 1000 * PHA;
Expand All @@ -127,14 +127,14 @@ parameter_types! {

impl pallet_uniques::Config for Test {
type Event = Event;
type ClassId = u32;
type InstanceId = u32;
type CollectionId = u32;
type ItemId = u32;
type Currency = Balances;
type ForceOrigin = EnsureRoot<AccountId>;
type CreateOrigin = AsEnsureOriginWithArg<frame_system::EnsureSigned<AccountId>>;
type Locker = pallet_rmrk_core::Pallet<Test>;
type ClassDeposit = ClassDeposit;
type InstanceDeposit = InstanceDeposit;
type CollectionDeposit = CollectionDeposit;
type ItemDeposit = ItemDeposit;
type MetadataDepositBase = UniquesMetadataDepositBase;
type AttributeDepositBase = AttributeDepositBase;
type DepositPerByte = DepositPerByte;
Expand Down
8 changes: 4 additions & 4 deletions pallets/phala-world/src/nft_sale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ pub mod pallet {
#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<T>
where
T: pallet_uniques::Config<ClassId = CollectionId, InstanceId = NftId>,
T: pallet_uniques::Config<CollectionId = CollectionId, ItemId = NftId>,
{
fn build(&self) {
if let Some(ref zero_day) = self.zero_day {
Expand Down Expand Up @@ -384,7 +384,7 @@ pub mod pallet {
#[pallet::call]
impl<T: Config> Pallet<T>
where
T: pallet_uniques::Config<ClassId = CollectionId, InstanceId = NftId>,
T: pallet_uniques::Config<CollectionId = CollectionId, ItemId = NftId>,
{
/// Claim a spirit for any account with at least 10 PHA in their account
///
Expand Down Expand Up @@ -1047,7 +1047,7 @@ pub mod pallet {

impl<T: Config> Pallet<T>
where
T: pallet_uniques::Config<ClassId = CollectionId, InstanceId = NftId>,
T: pallet_uniques::Config<CollectionId = CollectionId, ItemId = NftId>,
{
/// Verify the sender making the claim is the Account signed by the Overlord admin account and
/// verify the purpose of the `OverlordMessage` which will be either `RedeemSpirit` or
Expand Down Expand Up @@ -1628,7 +1628,7 @@ where
/// `collection_id`: Collection id to check if sender owns a NFT in the collection
/// `error`: Error type to throw if there is an error detected
pub fn owns_nft_in_collection(sender: &T::AccountId, collection_id: CollectionId) -> bool {
pallet_uniques::Pallet::<T>::owned_in_class(&collection_id, sender).count() > 0
pallet_uniques::Pallet::<T>::owned_in_collection(&collection_id, sender).count() > 0
}

pub fn to_boundedvec_key(name: &str) -> Result<BoundedVec<u8, T::KeyLimit>, Error<T>> {
Expand Down
18 changes: 9 additions & 9 deletions runtime/khala/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,18 +315,18 @@ impl Contains<Call> for BaseCallFilter {
pallet_uniques::Call::approve_transfer { .. }
| pallet_uniques::Call::burn { .. }
| pallet_uniques::Call::cancel_approval { .. }
| pallet_uniques::Call::clear_class_metadata { .. }
| pallet_uniques::Call::clear_collection_metadata { .. }
| pallet_uniques::Call::clear_metadata { .. }
| pallet_uniques::Call::create { .. }
| pallet_uniques::Call::destroy { .. }
| pallet_uniques::Call::force_asset_status { .. }
| pallet_uniques::Call::force_item_status { .. }
| pallet_uniques::Call::force_create { .. }
| pallet_uniques::Call::freeze_class { .. }
| pallet_uniques::Call::freeze_collection { .. }
| pallet_uniques::Call::mint { .. }
| pallet_uniques::Call::redeposit { .. }
| pallet_uniques::Call::set_class_metadata { .. }
| pallet_uniques::Call::set_collection_metadata { .. }
| pallet_uniques::Call::set_metadata { .. }
| pallet_uniques::Call::thaw_class { .. }
| pallet_uniques::Call::thaw_collection { .. }
| pallet_uniques::Call::transfer { .. }
| pallet_uniques::Call::transfer_ownership { .. }
| pallet_uniques::Call::__Ignore { .. } => false,
Expand Down Expand Up @@ -821,8 +821,8 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
}

parameter_types! {
pub const ClassDeposit: Balance = 100 * DOLLARS;
pub const InstanceDeposit: Balance = 1 * DOLLARS;
pub const CollectionDeposit: Balance = 100 * DOLLARS;
pub const ItemDeposit: Balance = 1 * DOLLARS;
pub const KeyLimit: u32 = 32;
pub const ValueLimit: u32 = 256;
pub const StringLimit: u32 = 50;
Expand All @@ -836,8 +836,8 @@ impl pallet_uniques::Config for Runtime {
type ForceOrigin = EnsureRoot<AccountId>;
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
type Locker = ();
type CollectionDeposit = ClassDeposit;
type ItemDeposit = InstanceDeposit;
type CollectionDeposit = CollectionDeposit;
type ItemDeposit = ItemDeposit;
type MetadataDepositBase = MetadataDepositBase;
type AttributeDepositBase = MetadataDepositBase;
type DepositPerByte = MetadataDepositPerByte;
Expand Down
18 changes: 9 additions & 9 deletions runtime/rhala/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,18 +316,18 @@ impl Contains<Call> for BaseCallFilter {
pallet_uniques::Call::approve_transfer { .. }
| pallet_uniques::Call::burn { .. }
| pallet_uniques::Call::cancel_approval { .. }
| pallet_uniques::Call::clear_class_metadata { .. }
| pallet_uniques::Call::clear_collection_metadata { .. }
| pallet_uniques::Call::clear_metadata { .. }
| pallet_uniques::Call::create { .. }
| pallet_uniques::Call::destroy { .. }
| pallet_uniques::Call::force_asset_status { .. }
| pallet_uniques::Call::force_item_status { .. }
| pallet_uniques::Call::force_create { .. }
| pallet_uniques::Call::freeze_class { .. }
| pallet_uniques::Call::freeze_collection { .. }
| pallet_uniques::Call::mint { .. }
| pallet_uniques::Call::redeposit { .. }
| pallet_uniques::Call::set_class_metadata { .. }
| pallet_uniques::Call::set_collection_metadata { .. }
| pallet_uniques::Call::set_metadata { .. }
| pallet_uniques::Call::thaw_class { .. }
| pallet_uniques::Call::thaw_collection { .. }
| pallet_uniques::Call::transfer { .. }
| pallet_uniques::Call::transfer_ownership { .. }
| pallet_uniques::Call::__Ignore { .. } => false,
Expand Down Expand Up @@ -828,8 +828,8 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
}

parameter_types! {
pub const ClassDeposit: Balance = 100 * DOLLARS;
pub const InstanceDeposit: Balance = 1 * DOLLARS;
pub const CollectionDeposit: Balance = 100 * DOLLARS;
pub const ItemDeposit: Balance = 1 * DOLLARS;
pub const KeyLimit: u32 = 32;
pub const ValueLimit: u32 = 256;
pub const StringLimit: u32 = 50;
Expand All @@ -843,8 +843,8 @@ impl pallet_uniques::Config for Runtime {
type ForceOrigin = EnsureRoot<AccountId>;
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
type Locker = ();
type CollectionDeposit = ClassDeposit;
type ItemDeposit = InstanceDeposit;
type CollectionDeposit = CollectionDeposit;
type ItemDeposit = ItemDeposit;
type MetadataDepositBase = MetadataDepositBase;
type AttributeDepositBase = MetadataDepositBase;
type DepositPerByte = MetadataDepositPerByte;
Expand Down
18 changes: 9 additions & 9 deletions runtime/thala/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,18 +323,18 @@ impl Contains<Call> for BaseCallFilter {
pallet_uniques::Call::approve_transfer { .. }
| pallet_uniques::Call::burn { .. }
| pallet_uniques::Call::cancel_approval { .. }
| pallet_uniques::Call::clear_class_metadata { .. }
| pallet_uniques::Call::clear_collection_metadata { .. }
| pallet_uniques::Call::clear_metadata { .. }
| pallet_uniques::Call::create { .. }
| pallet_uniques::Call::destroy { .. }
| pallet_uniques::Call::force_asset_status { .. }
| pallet_uniques::Call::force_item_status { .. }
| pallet_uniques::Call::force_create { .. }
| pallet_uniques::Call::freeze_class { .. }
| pallet_uniques::Call::freeze_collection { .. }
| pallet_uniques::Call::mint { .. }
| pallet_uniques::Call::redeposit { .. }
| pallet_uniques::Call::set_class_metadata { .. }
| pallet_uniques::Call::set_collection_metadata { .. }
| pallet_uniques::Call::set_metadata { .. }
| pallet_uniques::Call::thaw_class { .. }
| pallet_uniques::Call::thaw_collection { .. }
| pallet_uniques::Call::transfer { .. }
| pallet_uniques::Call::transfer_ownership { .. } => {
return false;
Expand Down Expand Up @@ -843,8 +843,8 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
}

parameter_types! {
pub const ClassDeposit: Balance = 100 * DOLLARS;
pub const InstanceDeposit: Balance = 1 * DOLLARS;
pub const CollectionDeposit: Balance = 100 * DOLLARS;
pub const ItemDeposit: Balance = 1 * DOLLARS;
pub const KeyLimit: u32 = 32;
pub const ValueLimit: u32 = 256;
pub const StringLimit: u32 = 50;
Expand All @@ -858,8 +858,8 @@ impl pallet_uniques::Config for Runtime {
type ForceOrigin = EnsureRoot<AccountId>;
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
type Locker = ();
type CollectionDeposit = ClassDeposit;
type ItemDeposit = InstanceDeposit;
type CollectionDeposit = CollectionDeposit;
type ItemDeposit = ItemDeposit;
type MetadataDepositBase = MetadataDepositBase;
type AttributeDepositBase = MetadataDepositBase;
type DepositPerByte = MetadataDepositPerByte;
Expand Down