git.delta.rocks / unique-network / refs/commits / 7b90ee4fa348

difftreelog

add tests

Trubnikov Sergey2023-04-27parent: #e4de689.patch.diff
in: master

2 files changed

modifiedpallets/balances-adapter/src/common.rsdiffbeforeafterboth
before · pallets/balances-adapter/src/common.rs
1use alloc::{vec, vec::Vec};2use core::marker::PhantomData;3use crate::{Config, NativeFungibleHandle};4use frame_support::{5	traits::{Currency, ExistenceRequirement},6	fail,7};8use pallet_common::{erc::CrossAccountId, CommonCollectionOperations, CommonWeightInfo, with_weight};9use up_data_structs::TokenId;1011pub struct CommonWeights<T: Config>(PhantomData<T>);12impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {13	fn create_multiple_items(14		amount: &[up_data_structs::CreateItemData],15	) -> frame_support::weights::Weight {16		todo!()17	}1819	fn create_multiple_items_ex(20		cost: &up_data_structs::CreateItemExData<T::CrossAccountId>,21	) -> frame_support::weights::Weight {22		todo!()23	}2425	fn burn_item() -> frame_support::weights::Weight {26		todo!()27	}2829	fn set_collection_properties(amount: u32) -> frame_support::weights::Weight {30		todo!()31	}3233	fn delete_collection_properties(amount: u32) -> frame_support::weights::Weight {34		todo!()35	}3637	fn set_token_properties(amount: u32) -> frame_support::weights::Weight {38		todo!()39	}4041	fn delete_token_properties(amount: u32) -> frame_support::weights::Weight {42		todo!()43	}4445	fn set_token_property_permissions(amount: u32) -> frame_support::weights::Weight {46		todo!()47	}4849	fn transfer() -> frame_support::weights::Weight {50		todo!()51	}5253	fn approve() -> frame_support::weights::Weight {54		todo!()55	}5657	fn approve_from() -> frame_support::weights::Weight {58		todo!()59	}6061	fn transfer_from() -> frame_support::weights::Weight {62		todo!()63	}6465	fn burn_from() -> frame_support::weights::Weight {66		todo!()67	}6869	fn burn_recursively_self_raw() -> frame_support::weights::Weight {70		todo!()71	}7273	fn burn_recursively_breadth_raw(amount: u32) -> frame_support::weights::Weight {74		todo!()75	}7677	fn token_owner() -> frame_support::weights::Weight {78		todo!()79	}8081	fn set_allowance_for_all() -> frame_support::weights::Weight {82		todo!()83	}8485	fn force_repair_item() -> frame_support::weights::Weight {86		todo!()87	}88}8990/// Implementation of `CommonCollectionOperations` for `FungibleHandle`. It wraps FungibleHandle Pallete91/// methods and adds weight info.92impl<T: Config> CommonCollectionOperations<T> for NativeFungibleHandle<T> {93	fn create_item(94		&self,95		sender: <T>::CrossAccountId,96		to: <T>::CrossAccountId,97		data: up_data_structs::CreateItemData,98		nesting_budget: &dyn up_data_structs::budget::Budget,99	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {100		fail!(<pallet_common::Error<T>>::UnsupportedOperation);101	}102103	fn create_multiple_items(104		&self,105		sender: <T>::CrossAccountId,106		to: <T>::CrossAccountId,107		data: Vec<up_data_structs::CreateItemData>,108		nesting_budget: &dyn up_data_structs::budget::Budget,109	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {110		fail!(<pallet_common::Error<T>>::UnsupportedOperation);111	}112113	fn create_multiple_items_ex(114		&self,115		sender: <T>::CrossAccountId,116		data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,117		nesting_budget: &dyn up_data_structs::budget::Budget,118	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {119		fail!(<pallet_common::Error<T>>::UnsupportedOperation);120	}121122	fn burn_item(123		&self,124		sender: <T>::CrossAccountId,125		token: TokenId,126		amount: u128,127	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {128		fail!(<pallet_common::Error<T>>::UnsupportedOperation);129	}130131	fn burn_item_recursively(132		&self,133		sender: <T>::CrossAccountId,134		token: TokenId,135		self_budget: &dyn up_data_structs::budget::Budget,136		breadth_budget: &dyn up_data_structs::budget::Budget,137	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {138		fail!(<pallet_common::Error<T>>::UnsupportedOperation);139	}140141	fn set_collection_properties(142		&self,143		sender: <T>::CrossAccountId,144		properties: Vec<up_data_structs::Property>,145	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {146		fail!(<pallet_common::Error<T>>::UnsupportedOperation);147	}148149	fn delete_collection_properties(150		&self,151		sender: &<T>::CrossAccountId,152		property_keys: Vec<up_data_structs::PropertyKey>,153	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {154		fail!(<pallet_common::Error<T>>::UnsupportedOperation);155	}156157	fn set_token_properties(158		&self,159		sender: <T>::CrossAccountId,160		token_id: TokenId,161		properties: Vec<up_data_structs::Property>,162		budget: &dyn up_data_structs::budget::Budget,163	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {164		fail!(<pallet_common::Error<T>>::UnsupportedOperation);165	}166167	fn delete_token_properties(168		&self,169		sender: <T>::CrossAccountId,170		token_id: TokenId,171		property_keys: Vec<up_data_structs::PropertyKey>,172		budget: &dyn up_data_structs::budget::Budget,173	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {174		fail!(<pallet_common::Error<T>>::UnsupportedOperation);175	}176177	fn set_token_property_permissions(178		&self,179		sender: &<T>::CrossAccountId,180		property_permissions: Vec<up_data_structs::PropertyKeyPermission>,181	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {182		fail!(<pallet_common::Error<T>>::UnsupportedOperation);183	}184185	fn transfer(186		&self,187		sender: <T>::CrossAccountId,188		to: <T>::CrossAccountId,189		token: TokenId,190		amount: u128,191		budget: &dyn up_data_structs::budget::Budget,192	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {193		with_weight(194			<T as Config>::Currency::transfer(195				sender.as_sub(),196				to.as_sub(),197				amount.into(),198				ExistenceRequirement::KeepAlive,199			),200			Default::default(),201		)202	}203204	fn approve(205		&self,206		sender: <T>::CrossAccountId,207		spender: <T>::CrossAccountId,208		token: TokenId,209		amount: u128,210	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {211		fail!(<pallet_common::Error<T>>::UnsupportedOperation);212	}213214	fn approve_from(215		&self,216		sender: <T>::CrossAccountId,217		from: <T>::CrossAccountId,218		to: <T>::CrossAccountId,219		token: TokenId,220		amount: u128,221	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {222		fail!(<pallet_common::Error<T>>::UnsupportedOperation);223	}224225	fn transfer_from(226		&self,227		sender: <T>::CrossAccountId,228		from: <T>::CrossAccountId,229		to: <T>::CrossAccountId,230		token: TokenId,231		amount: u128,232		budget: &dyn up_data_structs::budget::Budget,233	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {234		with_weight(235			<T as Config>::Currency::transfer(236				sender.as_sub(),237				to.as_sub(),238				amount.into(),239				ExistenceRequirement::KeepAlive,240			),241			Default::default(),242		)243	}244245	fn burn_from(246		&self,247		sender: <T>::CrossAccountId,248		from: <T>::CrossAccountId,249		token: TokenId,250		amount: u128,251		budget: &dyn up_data_structs::budget::Budget,252	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {253		fail!(<pallet_common::Error<T>>::UnsupportedOperation);254	}255256	fn check_nesting(257		&self,258		sender: <T>::CrossAccountId,259		from: (up_data_structs::CollectionId, TokenId),260		under: TokenId,261		budget: &dyn up_data_structs::budget::Budget,262	) -> frame_support::sp_runtime::DispatchResult {263		fail!(<pallet_common::Error<T>>::UnsupportedOperation);264	}265266	fn nest(&self, under: TokenId, to_nest: (up_data_structs::CollectionId, TokenId)) {}267268	fn unnest(&self, under: TokenId, to_nest: (up_data_structs::CollectionId, TokenId)) {}269270	fn account_tokens(&self, account: <T>::CrossAccountId) -> Vec<TokenId> {271		let balance = <T as Config>::Currency::total_balance(account.as_sub());272		if balance != 0 {273			vec![TokenId::default()]274		} else {275			vec![]276		}277	}278279	fn collection_tokens(&self) -> Vec<TokenId> {280		vec![TokenId::default()]281	}282283	fn token_exists(&self, token: TokenId) -> bool {284		token == TokenId::default()285	}286287	fn last_token_id(&self) -> TokenId {288		TokenId::default()289	}290291	fn token_owner(292		&self,293		token: TokenId,294	) -> Result<<T>::CrossAccountId, up_data_structs::TokenOwnerError> {295		Err(up_data_structs::TokenOwnerError::MultipleOwners)296	}297298	fn token_owners(&self, token: TokenId) -> Vec<<T>::CrossAccountId> {299		vec![]300	}301302	fn token_property(303		&self,304		token_id: TokenId,305		key: &up_data_structs::PropertyKey,306	) -> Option<up_data_structs::PropertyValue> {307		None308	}309310	fn token_properties(311		&self,312		token: TokenId,313		keys: Option<Vec<up_data_structs::PropertyKey>>,314	) -> Vec<up_data_structs::Property> {315		vec![]316	}317318	fn total_supply(&self) -> u32 {319		1320	}321322	fn account_balance(&self, account: <T>::CrossAccountId) -> u32 {323		let balance: u128 = <T as Config>::Currency::free_balance(account.as_sub()).into();324		(balance != 0).into()325	}326327	fn balance(&self, account: <T>::CrossAccountId, token: TokenId) -> u128 {328		if token != TokenId::default() {329			return 0;330		}331		<T as Config>::Currency::free_balance(account.as_sub()).into()332	}333334	fn total_pieces(&self, token: TokenId) -> Option<u128> {335		if token != TokenId::default() {336			return None;337		}338		let total = <T as Config>::Currency::total_issuance();339		Some(total.into())340	}341342	fn allowance(343		&self,344		sender: <T>::CrossAccountId,345		spender: <T>::CrossAccountId,346		token: TokenId,347	) -> u128 {348		0349	}350351	fn refungible_extensions(&self) -> Option<&dyn pallet_common::RefungibleExtensions<T>> {352		None353	}354355	fn set_allowance_for_all(356		&self,357		owner: <T>::CrossAccountId,358		operator: <T>::CrossAccountId,359		approve: bool,360	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {361		fail!(<pallet_common::Error<T>>::UnsupportedOperation);362	}363364	fn allowance_for_all(&self, owner: <T>::CrossAccountId, operator: <T>::CrossAccountId) -> bool {365		false366	}367368	fn repair_item(369		&self,370		token: TokenId,371	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {372		fail!(<pallet_common::Error<T>>::UnsupportedOperation);373	}374}
after · pallets/balances-adapter/src/common.rs
1use alloc::{vec, vec::Vec};2use core::marker::PhantomData;3use crate::{Config, NativeFungibleHandle};4use frame_support::{5	traits::{Currency, ExistenceRequirement},6	fail,7};8use pallet_common::{erc::CrossAccountId, CommonCollectionOperations, CommonWeightInfo, with_weight};9use up_data_structs::TokenId;1011pub struct CommonWeights<T: Config>(PhantomData<T>);12impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {13	fn create_multiple_items(14		amount: &[up_data_structs::CreateItemData],15	) -> frame_support::weights::Weight {16		todo!()17	}1819	fn create_multiple_items_ex(20		cost: &up_data_structs::CreateItemExData<T::CrossAccountId>,21	) -> frame_support::weights::Weight {22		todo!()23	}2425	fn burn_item() -> frame_support::weights::Weight {26		todo!()27	}2829	fn set_collection_properties(amount: u32) -> frame_support::weights::Weight {30		todo!()31	}3233	fn delete_collection_properties(amount: u32) -> frame_support::weights::Weight {34		todo!()35	}3637	fn set_token_properties(amount: u32) -> frame_support::weights::Weight {38		todo!()39	}4041	fn delete_token_properties(amount: u32) -> frame_support::weights::Weight {42		todo!()43	}4445	fn set_token_property_permissions(amount: u32) -> frame_support::weights::Weight {46		todo!()47	}4849	fn transfer() -> frame_support::weights::Weight {50		todo!()51	}5253	fn approve() -> frame_support::weights::Weight {54		todo!()55	}5657	fn approve_from() -> frame_support::weights::Weight {58		todo!()59	}6061	fn transfer_from() -> frame_support::weights::Weight {62		todo!()63	}6465	fn burn_from() -> frame_support::weights::Weight {66		todo!()67	}6869	fn burn_recursively_self_raw() -> frame_support::weights::Weight {70		todo!()71	}7273	fn burn_recursively_breadth_raw(amount: u32) -> frame_support::weights::Weight {74		todo!()75	}7677	fn token_owner() -> frame_support::weights::Weight {78		todo!()79	}8081	fn set_allowance_for_all() -> frame_support::weights::Weight {82		todo!()83	}8485	fn force_repair_item() -> frame_support::weights::Weight {86		todo!()87	}88}8990/// Implementation of `CommonCollectionOperations` for `FungibleHandle`. It wraps FungibleHandle Pallete91/// methods and adds weight info.92impl<T: Config> CommonCollectionOperations<T> for NativeFungibleHandle<T> {93	fn create_item(94		&self,95		sender: <T>::CrossAccountId,96		to: <T>::CrossAccountId,97		data: up_data_structs::CreateItemData,98		nesting_budget: &dyn up_data_structs::budget::Budget,99	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {100		fail!(<pallet_common::Error<T>>::UnsupportedOperation);101	}102103	fn create_multiple_items(104		&self,105		sender: <T>::CrossAccountId,106		to: <T>::CrossAccountId,107		data: Vec<up_data_structs::CreateItemData>,108		nesting_budget: &dyn up_data_structs::budget::Budget,109	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {110		fail!(<pallet_common::Error<T>>::UnsupportedOperation);111	}112113	fn create_multiple_items_ex(114		&self,115		sender: <T>::CrossAccountId,116		data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,117		nesting_budget: &dyn up_data_structs::budget::Budget,118	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {119		fail!(<pallet_common::Error<T>>::UnsupportedOperation);120	}121122	fn burn_item(123		&self,124		sender: <T>::CrossAccountId,125		token: TokenId,126		amount: u128,127	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {128		fail!(<pallet_common::Error<T>>::UnsupportedOperation);129	}130131	fn burn_item_recursively(132		&self,133		sender: <T>::CrossAccountId,134		token: TokenId,135		self_budget: &dyn up_data_structs::budget::Budget,136		breadth_budget: &dyn up_data_structs::budget::Budget,137	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {138		fail!(<pallet_common::Error<T>>::UnsupportedOperation);139	}140141	fn set_collection_properties(142		&self,143		sender: <T>::CrossAccountId,144		properties: Vec<up_data_structs::Property>,145	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {146		fail!(<pallet_common::Error<T>>::UnsupportedOperation);147	}148149	fn delete_collection_properties(150		&self,151		sender: &<T>::CrossAccountId,152		property_keys: Vec<up_data_structs::PropertyKey>,153	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {154		fail!(<pallet_common::Error<T>>::UnsupportedOperation);155	}156157	fn set_token_properties(158		&self,159		sender: <T>::CrossAccountId,160		token_id: TokenId,161		properties: Vec<up_data_structs::Property>,162		budget: &dyn up_data_structs::budget::Budget,163	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {164		fail!(<pallet_common::Error<T>>::UnsupportedOperation);165	}166167	fn delete_token_properties(168		&self,169		sender: <T>::CrossAccountId,170		token_id: TokenId,171		property_keys: Vec<up_data_structs::PropertyKey>,172		budget: &dyn up_data_structs::budget::Budget,173	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {174		fail!(<pallet_common::Error<T>>::UnsupportedOperation);175	}176177	fn set_token_property_permissions(178		&self,179		sender: &<T>::CrossAccountId,180		property_permissions: Vec<up_data_structs::PropertyKeyPermission>,181	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {182		fail!(<pallet_common::Error<T>>::UnsupportedOperation);183	}184185	fn transfer(186		&self,187		sender: <T>::CrossAccountId,188		to: <T>::CrossAccountId,189		token: TokenId,190		amount: u128,191		budget: &dyn up_data_structs::budget::Budget,192	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {193		with_weight(194			<T as Config>::Currency::transfer(195				sender.as_sub(),196				to.as_sub(),197				amount.into(),198				ExistenceRequirement::KeepAlive,199			),200			Default::default(),201		)202	}203204	fn approve(205		&self,206		sender: <T>::CrossAccountId,207		spender: <T>::CrossAccountId,208		token: TokenId,209		amount: u128,210	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {211		fail!(<pallet_common::Error<T>>::UnsupportedOperation);212	}213214	fn approve_from(215		&self,216		sender: <T>::CrossAccountId,217		from: <T>::CrossAccountId,218		to: <T>::CrossAccountId,219		token: TokenId,220		amount: u128,221	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {222		fail!(<pallet_common::Error<T>>::UnsupportedOperation);223	}224225	fn transfer_from(226		&self,227		sender: <T>::CrossAccountId,228		from: <T>::CrossAccountId,229		to: <T>::CrossAccountId,230		token: TokenId,231		amount: u128,232		budget: &dyn up_data_structs::budget::Budget,233	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {234		if sender != from {235			fail!(<pallet_common::Error<T>>::NoPermission);236		}237		with_weight(238			<T as Config>::Currency::transfer(239				from.as_sub(),240				to.as_sub(),241				amount.into(),242				ExistenceRequirement::KeepAlive,243			),244			Default::default(),245		)246	}247248	fn burn_from(249		&self,250		sender: <T>::CrossAccountId,251		from: <T>::CrossAccountId,252		token: TokenId,253		amount: u128,254		budget: &dyn up_data_structs::budget::Budget,255	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {256		fail!(<pallet_common::Error<T>>::UnsupportedOperation);257	}258259	fn check_nesting(260		&self,261		sender: <T>::CrossAccountId,262		from: (up_data_structs::CollectionId, TokenId),263		under: TokenId,264		budget: &dyn up_data_structs::budget::Budget,265	) -> frame_support::sp_runtime::DispatchResult {266		fail!(<pallet_common::Error<T>>::UnsupportedOperation);267	}268269	fn nest(&self, under: TokenId, to_nest: (up_data_structs::CollectionId, TokenId)) {}270271	fn unnest(&self, under: TokenId, to_nest: (up_data_structs::CollectionId, TokenId)) {}272273	fn account_tokens(&self, account: <T>::CrossAccountId) -> Vec<TokenId> {274		let balance = <T as Config>::Currency::total_balance(account.as_sub());275		if balance != 0 {276			vec![TokenId::default()]277		} else {278			vec![]279		}280	}281282	fn collection_tokens(&self) -> Vec<TokenId> {283		vec![TokenId::default()]284	}285286	fn token_exists(&self, token: TokenId) -> bool {287		token == TokenId::default()288	}289290	fn last_token_id(&self) -> TokenId {291		TokenId::default()292	}293294	fn token_owner(295		&self,296		token: TokenId,297	) -> Result<<T>::CrossAccountId, up_data_structs::TokenOwnerError> {298		Err(up_data_structs::TokenOwnerError::MultipleOwners)299	}300301	fn token_owners(&self, token: TokenId) -> Vec<<T>::CrossAccountId> {302		vec![]303	}304305	fn token_property(306		&self,307		token_id: TokenId,308		key: &up_data_structs::PropertyKey,309	) -> Option<up_data_structs::PropertyValue> {310		None311	}312313	fn token_properties(314		&self,315		token: TokenId,316		keys: Option<Vec<up_data_structs::PropertyKey>>,317	) -> Vec<up_data_structs::Property> {318		vec![]319	}320321	fn total_supply(&self) -> u32 {322		1323	}324325	fn account_balance(&self, account: <T>::CrossAccountId) -> u32 {326		let balance: u128 = <T as Config>::Currency::free_balance(account.as_sub()).into();327		(balance != 0).into()328	}329330	fn balance(&self, account: <T>::CrossAccountId, token: TokenId) -> u128 {331		if token != TokenId::default() {332			return 0;333		}334		<T as Config>::Currency::free_balance(account.as_sub()).into()335	}336337	fn total_pieces(&self, token: TokenId) -> Option<u128> {338		if token != TokenId::default() {339			return None;340		}341		let total = <T as Config>::Currency::total_issuance();342		Some(total.into())343	}344345	fn allowance(346		&self,347		sender: <T>::CrossAccountId,348		spender: <T>::CrossAccountId,349		token: TokenId,350	) -> u128 {351		0352	}353354	fn refungible_extensions(&self) -> Option<&dyn pallet_common::RefungibleExtensions<T>> {355		None356	}357358	fn set_allowance_for_all(359		&self,360		owner: <T>::CrossAccountId,361		operator: <T>::CrossAccountId,362		approve: bool,363	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {364		fail!(<pallet_common::Error<T>>::UnsupportedOperation);365	}366367	fn allowance_for_all(&self, owner: <T>::CrossAccountId, operator: <T>::CrossAccountId) -> bool {368		false369	}370371	fn repair_item(372		&self,373		token: TokenId,374	) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {375		fail!(<pallet_common::Error<T>>::UnsupportedOperation);376	}377}
addedtests/src/NativeFungible.test.tsdiffbeforeafterboth
--- /dev/null
+++ b/tests/src/NativeFungible.test.ts
@@ -0,0 +1,210 @@
+// Copyright 2019-2023 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
+
+import {IKeyringPair} from '@polkadot/types/types';
+import {expect, itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds} from './util';
+import {ICollectionCreationOptions} from './util/playgrounds/types';
+
+describe.only('Native fungible', () => {
+  let alice: IKeyringPair;
+  let bob: IKeyringPair;
+
+  before(async () => {
+    await usingPlaygrounds(async (helper, privateKey) => {
+      const donor = await privateKey({url: import.meta.url});
+      [alice, bob] = await helper.arrange.createAccounts([10n, 10n], donor);
+    });
+  });
+
+  itSub('destroy_collection()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    await expect(collection.burn(alice)).to.be.rejectedWith('common.UnsupportedOperation');
+    await expect(helper.executeExtrinsic(alice, 'api.tx.unique.destroyCollection', [0])).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('add_to_allow_list()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    await expect(collection.addToAllowList(alice, {Substrate: bob.address})).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('remove_from_allow_list()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    await expect(collection.removeFromAllowList(alice, {Substrate: bob.address})).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('change_collection_owner()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    await expect(collection.changeOwner(alice, bob.address)).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('add_collection_admin()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    await expect(collection.addAdmin(alice, {Substrate: bob.address})).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('remove_collection_admin()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    await expect(collection.removeAdmin(alice, {Substrate: bob.address})).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('set_collection_sponsor()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    await expect(collection.setSponsor(alice, bob.address)).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('confirm_sponsorship()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    await expect(collection.confirmSponsorship(alice)).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('remove_collection_sponsor()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    await expect(collection.removeSponsor(alice)).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('create_item()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    await expect(collection.mint(alice, 100n, {Substrate: bob.address})).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('set_collection_properties()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    await expect(collection.setProperties(alice, [{key: 'value'}])).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('delete_collection_properties()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    await expect(collection.deleteProperties(alice, ['key'])).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('set_token_properties()', async ({helper}) => {
+    await expect(helper.executeExtrinsic(
+      alice,
+      'api.tx.unique.setTokenProperties',
+      [0, 0, [{key: 'value'}]],
+      true,
+    )).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('delete_token_properties()', async ({helper}) => {
+    await expect(helper.executeExtrinsic(
+      alice,
+      'api.tx.unique.deleteTokenProperties',
+      [0, 0, ['key']],
+      true,
+    )).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('set_transfers_enabled_flag()', async ({helper}) => {
+    await expect(helper.executeExtrinsic(
+      alice,
+      'api.tx.unique.setTransfersEnabledFlag',
+      [0, true],
+      true,
+    )).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('burn_item()', async ({helper}) => {
+    await expect(helper.executeExtrinsic(
+      alice,
+      'api.tx.unique.burnItem',
+      [0, 0, 100n],
+      true,
+    )).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('burn_from()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    await expect(collection.burnTokens(alice, 100n)).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('transfer()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    const balanceAliceBefore = await helper.balance.getSubstrate(alice.address);
+    const balanceBobBefore = await helper.balance.getSubstrate(bob.address);
+    await collection.transfer(alice, {Substrate: bob.address}, 100n);
+    const balanceAliceAfter = await helper.balance.getSubstrate(alice.address);
+    const balanceBobAfter = await helper.balance.getSubstrate(bob.address);
+    expect(balanceAliceBefore - balanceAliceAfter > 100n).to.be.true;
+    expect(balanceBobAfter - balanceBobBefore === 100n).to.be.true;
+  });
+
+  itSub('approve()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    await expect(collection.approveTokens(alice, {Substrate: bob.address}, 100n)).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('approve_from()', async ({helper}) => {
+    await expect(helper.executeExtrinsic(
+      alice,
+      'api.tx.unique.approveFrom',
+      [{Substrate: alice.address}, {Substrate: bob.address}, 0, 0, 100n],
+      true,
+    )).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('transfer_from()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    const balanceAliceBefore = await helper.balance.getSubstrate(alice.address);
+    const balanceBobBefore = await helper.balance.getSubstrate(bob.address);
+
+    await collection.transferFrom(alice, {Substrate: alice.address}, {Substrate: bob.address}, 100n);
+
+    const balanceAliceAfter = await helper.balance.getSubstrate(alice.address);
+    const balanceBobAfter = await helper.balance.getSubstrate(bob.address);
+    expect(balanceAliceBefore - balanceAliceAfter > 100n).to.be.true;
+    expect(balanceBobAfter - balanceBobBefore === 100n).to.be.true;
+
+    await expect(collection.transferFrom(alice, {Substrate: bob.address}, {Substrate: alice.address}, 100n)).to.be.rejectedWith('common.NoPermission');
+  });
+
+  itSub('set_collection_limits()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    await expect(collection.setLimits(alice, {accountTokenOwnershipLimit: 1})).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('set_collection_permissions()', async ({helper}) => {
+    const collection = helper.ft.getCollectionObject(0);
+    await expect(collection.setPermissions(alice, {access: 'AllowList'})).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('repartition()', async ({helper}) => {
+    await expect(helper.executeExtrinsic(
+      alice,
+      'api.tx.unique.repartition',
+      [0, 0, 100n],
+      true,
+    )).to.be.rejectedWith('unique.RepartitionCalledOnNonRefungibleCollection');
+  });
+
+  itSub('force_repair_collection()', async ({helper}) => {
+    await expect(helper.executeExtrinsic(
+      alice,
+      'api.tx.unique.forceRepairCollection',
+      [0],
+      true,
+    )).to.be.rejectedWith('common.UnsupportedOperation');
+  });
+
+  itSub('force_repair_item()', async ({helper}) => {
+    await expect(helper.executeExtrinsic(
+      alice,
+      'api.tx.unique.forceRepairItem',
+      [0, 0],
+      true,
+    )).to.be.rejectedWith('BadOrigin');
+  });
+});
\ No newline at end of file