git.delta.rocks / unique-network / refs/commits / 6b48a5a77b12

difftreelog

OwnerCanTransfer flag

Dev2022-06-14parent: #681a5b7.patch.diff
in: master

10 files changed

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -1164,6 +1164,7 @@
 		old_limit: &CollectionLimits,
 		mut new_limit: CollectionLimits,
 	) -> Result<CollectionLimits, DispatchError> {
+		let limits = old_limit;
 		limit_default!(old_limit, new_limit,
 			account_token_ownership_limit => ensure!(
 				new_limit <= MAX_TOKEN_OWNERSHIP,
@@ -1190,6 +1191,7 @@
 			),
 			sponsor_approve_timeout => {},
 			owner_can_transfer => ensure!(
+				!limits.owner_can_transfer_instaled() ||
 				old_limit || !new_limit,
 				<Error<T>>::OwnerPermissionsCantBeReverted,
 			),
modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -409,7 +409,10 @@
 			.min(MAX_SPONSOR_TIMEOUT)
 	}
 	pub fn owner_can_transfer(&self) -> bool {
-		self.owner_can_transfer.unwrap_or(true)
+		self.owner_can_transfer.unwrap_or(false)
+	}
+	pub fn owner_can_transfer_instaled(&self) -> bool {
+		self.owner_can_transfer.is_some()
 	}
 	pub fn owner_can_destroy(&self) -> bool {
 		self.owner_can_destroy.unwrap_or(true)
modifiedtests/src/approve.test.tsdiffbeforeafterboth
--- a/tests/src/approve.test.ts
+++ b/tests/src/approve.test.ts
@@ -28,7 +28,7 @@
   setCollectionLimitsExpectSuccess,
   transferExpectSuccess,
   addCollectionAdminExpectSuccess,
-  adminApproveFromExpectSuccess,
+  adminApproveFromExpectFail,
   getCreatedCollectionCount,
   transferFromExpectSuccess,
   transferFromExpectFail,
@@ -84,11 +84,11 @@
     await approveExpectSuccess(reFungibleCollectionId, newReFungibleTokenId, alice, bob.address, 0);
   });
 
-  it('can be called by collection owner on non-owned item when OwnerCanTransfer == true', async () => {
+  it('can`t be called by collection owner on non-owned item when OwnerCanTransfer == false', async () => {
     const collectionId = await createCollectionExpectSuccess();
     const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', bob.address);
 
-    await adminApproveFromExpectSuccess(collectionId, itemId, alice, bob.address, charlie.address);
+    await adminApproveFromExpectFail(collectionId, itemId, alice, bob.address, charlie.address);
   });
 });
 
@@ -292,7 +292,7 @@
   });
 });
 
-describe('Administrator and collection owner do not need approval in order to execute TransferFrom:', () => {
+describe('Administrator and collection owner do not need approval in order to execute TransferFrom (with owner_can_transfer_flag = true):', () => {
   let alice: IKeyringPair;
   let bob: IKeyringPair;
   let charlie: IKeyringPair;
@@ -309,6 +309,7 @@
 
   it('NFT', async () => {
     const collectionId = await createCollectionExpectSuccess();
+    await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});
     const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', charlie.address);
     await transferFromExpectSuccess(collectionId, itemId, alice, charlie, dave, 1, 'NFT');
     await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
@@ -317,6 +318,7 @@
 
   it('Fungible up to an approved amount', async () => {
     const collectionId = await createCollectionExpectSuccess({mode:{type: 'Fungible', decimalPoints: 0}});
+    await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});
     const itemId = await createItemExpectSuccess(alice, collectionId, 'Fungible', charlie.address); 
     await transferFromExpectSuccess(collectionId, itemId, alice, charlie, dave, 1, 'Fungible');
     await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
@@ -325,6 +327,7 @@
 
   it('ReFungible up to an approved amount', async () => {
     const collectionId = await createCollectionExpectSuccess({mode:{type: 'ReFungible'}});
+    await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});
     const itemId = await createItemExpectSuccess(alice, collectionId, 'ReFungible', charlie.address);
     await transferFromExpectSuccess(collectionId, itemId, alice, charlie, dave, 1, 'ReFungible');
     await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
@@ -402,7 +405,7 @@
     const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', alice.address);
 
     await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
-    await adminApproveFromExpectSuccess(collectionId, itemId, bob, alice.address, charlie.address);
+    await adminApproveFromExpectFail(collectionId, itemId, bob, alice.address, charlie.address);
   });
 });
 
modifiedtests/src/burnItem.test.tsdiffbeforeafterboth
before · tests/src/burnItem.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync} from './substrate/substrate-api';18import {IKeyringPair} from '@polkadot/types/types';19import {20  createCollectionExpectSuccess,21  createItemExpectSuccess,22  getGenericResult,23  normalizeAccountId,24  addCollectionAdminExpectSuccess,25  getBalance,26  isTokenExists,27} from './util/helpers';2829import chai from 'chai';30import chaiAsPromised from 'chai-as-promised';31chai.use(chaiAsPromised);32const expect = chai.expect;3334let alice: IKeyringPair;35let bob: IKeyringPair;3637describe('integration test: ext. burnItem():', () => {38  before(async () => {39    await usingApi(async (api, privateKeyWrapper) => {40      alice = privateKeyWrapper('//Alice');41      bob = privateKeyWrapper('//Bob');42    });43  });4445  it('Burn item in NFT collection', async () => {46    const createMode = 'NFT';47    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});48    const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);4950    await usingApi(async (api) => {51      const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);52      const events = await submitTransactionAsync(alice, tx);53      const result = getGenericResult(events);5455      expect(result.success).to.be.true;56      // Get the item57      expect(await isTokenExists(api, collectionId, tokenId)).to.be.false;58    });59  });6061  it('Burn item in Fungible collection', async () => {62    const createMode = 'Fungible';63    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});64    await createItemExpectSuccess(alice, collectionId, createMode); // Helper creates 10 fungible tokens65    const tokenId = 0; // ignored6667    await usingApi(async (api) => {68      // Destroy 1 of 1069      const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);70      const events = await submitTransactionAsync(alice, tx);71      const result = getGenericResult(events);7273      // Get alice balance74      const balance = await getBalance(api, collectionId, alice.address, 0);7576      // What to expect77      expect(result.success).to.be.true;78      expect(balance).to.be.equal(9n);79    });80  });8182  it('Burn item in ReFungible collection', async () => {83    const createMode = 'ReFungible';84    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});85    const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);8687    await usingApi(async (api) => {88      const tx = api.tx.unique.burnItem(collectionId, tokenId, 100);89      const events = await submitTransactionAsync(alice, tx);90      const result = getGenericResult(events);9192      // Get alice balance93      const balance = await getBalance(api, collectionId, alice.address, tokenId);9495      // What to expect96      expect(result.success).to.be.true;97      expect(balance).to.be.equal(0n);98    });99  });100101  it('Burn owned portion of item in ReFungible collection', async () => {102    const createMode = 'ReFungible';103    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});104    const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);105106    await usingApi(async (api) => {107      // Transfer 1/100 of the token to Bob108      const transfertx = api.tx.unique.transfer(normalizeAccountId(bob.address), collectionId, tokenId, 1);109      const events1 = await submitTransactionAsync(alice, transfertx);110      const result1 = getGenericResult(events1);111112      // Get balances113      const bobBalanceBefore = await getBalance(api, collectionId, bob.address, tokenId);114      const aliceBalanceBefore = await getBalance(api, collectionId, alice.address, tokenId);115116      // Bob burns his portion117      const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);118      const events2 = await submitTransactionAsync(bob, tx);119      const result2 = getGenericResult(events2);120121      // Get balances122      const bobBalanceAfter = await getBalance(api, collectionId, bob.address, tokenId);123      const aliceBalanceAfter = await getBalance(api, collectionId, alice.address, tokenId);124      // console.log(balance);125126      // What to expect before burning127      expect(result1.success).to.be.true;128      expect(aliceBalanceBefore).to.be.equal(99n);129      expect(bobBalanceBefore).to.be.equal(1n);130131      // What to expect after burning132      expect(result2.success).to.be.true;133      expect(aliceBalanceAfter).to.be.equal(99n);134      expect(bobBalanceAfter).to.be.equal(0n);135    });136137  });138139});140141describe('integration test: ext. burnItem() with admin permissions:', () => {142  before(async () => {143    await usingApi(async (api, privateKeyWrapper) => {144      alice = privateKeyWrapper('//Alice');145      bob = privateKeyWrapper('//Bob');146    });147  });148149  it('Burn item in NFT collection', async () => {150    const createMode = 'NFT';151    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});152    const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);153    await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);154155    await usingApi(async (api) => {156      const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);157      const events = await submitTransactionAsync(bob, tx);158      const result = getGenericResult(events);159160      expect(result.success).to.be.true;161      // Get the item162      expect(await isTokenExists(api, collectionId, tokenId)).to.be.false;163    });164  });165166  // TODO: burnFrom167  it('Burn item in Fungible collection', async () => {168    const createMode = 'Fungible';169    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});170    const tokenId = await createItemExpectSuccess(alice, collectionId, createMode); // Helper creates 10 fungible tokens171    await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);172173    await usingApi(async (api) => {174      // Destroy 1 of 10175      const tx = api.tx.unique.burnFrom(collectionId, normalizeAccountId(alice.address), tokenId, 1);176      const events = await submitTransactionAsync(bob, tx);177      const result = getGenericResult(events);178179      // Get alice balance180      const balance = await getBalance(api, collectionId, alice.address, 0);181182      // What to expect183      expect(result.success).to.be.true;184      expect(balance).to.be.equal(9n);185    });186  });187188  // TODO: burnFrom189  it('Burn item in ReFungible collection', async () => {190    const createMode = 'ReFungible';191    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});192    const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);193    await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);194195    await usingApi(async (api) => {196      const tx = api.tx.unique.burnFrom(collectionId, normalizeAccountId(alice.address), tokenId, 100);197      const events = await submitTransactionAsync(bob, tx);198      const result = getGenericResult(events);199      // Get alice balance200      expect(result.success).to.be.true;201      // Get the item202      expect(await isTokenExists(api, collectionId, tokenId)).to.be.false;203    });204  });205});206207describe('Negative integration test: ext. burnItem():', () => {208  before(async () => {209    await usingApi(async (api, privateKeyWrapper) => {210      alice = privateKeyWrapper('//Alice');211      bob = privateKeyWrapper('//Bob');212    });213  });214215  it('Burn a token that was never created', async () => {216    const createMode = 'NFT';217    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});218    const tokenId = 10;219220    await usingApi(async (api) => {221      const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);222      const badTransaction = async function () {223        await submitTransactionExpectFailAsync(alice, tx);224      };225      await expect(badTransaction()).to.be.rejected;226    });227228  });229230  it('Burn a token using the address that does not own it', async () => {231    const createMode = 'NFT';232    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});233    const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);234235    await usingApi(async (api) => {236      const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);237      const badTransaction = async function () {238        await submitTransactionExpectFailAsync(bob, tx);239      };240      await expect(badTransaction()).to.be.rejected;241    });242243  });244245  it('Transfer a burned a token', async () => {246    const createMode = 'NFT';247    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});248    const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);249250    await usingApi(async (api) => {251252      const burntx = api.tx.unique.burnItem(collectionId, tokenId, 1);253      const events1 = await submitTransactionAsync(alice, burntx);254      const result1 = getGenericResult(events1);255      expect(result1.success).to.be.true;256257      const tx = api.tx.unique.transfer(normalizeAccountId(bob.address), collectionId, tokenId, 1);258      const badTransaction = async function () {259        await submitTransactionExpectFailAsync(alice, tx);260      };261      await expect(badTransaction()).to.be.rejected;262    });263264  });265266  it('Burn more than owned in Fungible collection', async () => {267    const createMode = 'Fungible';268    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});269    // Helper creates 10 fungible tokens270    await createItemExpectSuccess(alice, collectionId, createMode);271    const tokenId = 0; // ignored272273    await usingApi(async (api) => {274      // Destroy 11 of 10275      const tx = api.tx.unique.burnItem(collectionId, tokenId, 11);276      const badTransaction = async function () {277        await submitTransactionExpectFailAsync(alice, tx);278      };279      await expect(badTransaction()).to.be.rejected;280281      // Get alice balance282      const balance = await getBalance(api, collectionId, alice.address, 0);283284      // What to expect285      expect(balance).to.be.equal(10n);286    });287288  });289290});
after · tests/src/burnItem.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync} from './substrate/substrate-api';18import {IKeyringPair} from '@polkadot/types/types';19import {20  createCollectionExpectSuccess,21  createItemExpectSuccess,22  getGenericResult,23  normalizeAccountId,24  addCollectionAdminExpectSuccess,25  getBalance,26  setCollectionLimitsExpectSuccess,27  isTokenExists,28} from './util/helpers';2930import chai from 'chai';31import chaiAsPromised from 'chai-as-promised';32chai.use(chaiAsPromised);33const expect = chai.expect;3435let alice: IKeyringPair;36let bob: IKeyringPair;3738describe('integration test: ext. burnItem():', () => {39  before(async () => {40    await usingApi(async (api, privateKeyWrapper) => {41      alice = privateKeyWrapper('//Alice');42      bob = privateKeyWrapper('//Bob');43    });44  });4546  it('Burn item in NFT collection', async () => {47    const createMode = 'NFT';48    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});49    const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);5051    await usingApi(async (api) => {52      const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);53      const events = await submitTransactionAsync(alice, tx);54      const result = getGenericResult(events);5556      expect(result.success).to.be.true;57      // Get the item58      expect(await isTokenExists(api, collectionId, tokenId)).to.be.false;59    });60  });6162  it('Burn item in Fungible collection', async () => {63    const createMode = 'Fungible';64    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});65    await createItemExpectSuccess(alice, collectionId, createMode); // Helper creates 10 fungible tokens66    const tokenId = 0; // ignored6768    await usingApi(async (api) => {69      // Destroy 1 of 1070      const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);71      const events = await submitTransactionAsync(alice, tx);72      const result = getGenericResult(events);7374      // Get alice balance75      const balance = await getBalance(api, collectionId, alice.address, 0);7677      // What to expect78      expect(result.success).to.be.true;79      expect(balance).to.be.equal(9n);80    });81  });8283  it('Burn item in ReFungible collection', async () => {84    const createMode = 'ReFungible';85    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});86    const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);8788    await usingApi(async (api) => {89      const tx = api.tx.unique.burnItem(collectionId, tokenId, 100);90      const events = await submitTransactionAsync(alice, tx);91      const result = getGenericResult(events);9293      // Get alice balance94      const balance = await getBalance(api, collectionId, alice.address, tokenId);9596      // What to expect97      expect(result.success).to.be.true;98      expect(balance).to.be.equal(0n);99    });100  });101102  it('Burn owned portion of item in ReFungible collection', async () => {103    const createMode = 'ReFungible';104    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});105    const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);106107    await usingApi(async (api) => {108      // Transfer 1/100 of the token to Bob109      const transfertx = api.tx.unique.transfer(normalizeAccountId(bob.address), collectionId, tokenId, 1);110      const events1 = await submitTransactionAsync(alice, transfertx);111      const result1 = getGenericResult(events1);112113      // Get balances114      const bobBalanceBefore = await getBalance(api, collectionId, bob.address, tokenId);115      const aliceBalanceBefore = await getBalance(api, collectionId, alice.address, tokenId);116117      // Bob burns his portion118      const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);119      const events2 = await submitTransactionAsync(bob, tx);120      const result2 = getGenericResult(events2);121122      // Get balances123      const bobBalanceAfter = await getBalance(api, collectionId, bob.address, tokenId);124      const aliceBalanceAfter = await getBalance(api, collectionId, alice.address, tokenId);125      // console.log(balance);126127      // What to expect before burning128      expect(result1.success).to.be.true;129      expect(aliceBalanceBefore).to.be.equal(99n);130      expect(bobBalanceBefore).to.be.equal(1n);131132      // What to expect after burning133      expect(result2.success).to.be.true;134      expect(aliceBalanceAfter).to.be.equal(99n);135      expect(bobBalanceAfter).to.be.equal(0n);136    });137138  });139140});141142describe('integration test: ext. burnItem() with admin permissions:', () => {143  before(async () => {144    await usingApi(async (api, privateKeyWrapper) => {145      alice = privateKeyWrapper('//Alice');146      bob = privateKeyWrapper('//Bob');147    });148  });149150  it('Burn item in NFT collection', async () => {151    const createMode = 'NFT';152    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});153    await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});154    const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);155    await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);156157    await usingApi(async (api) => {158      const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);159      const events = await submitTransactionAsync(bob, tx);160      const result = getGenericResult(events);161162      expect(result.success).to.be.true;163      // Get the item164      expect(await isTokenExists(api, collectionId, tokenId)).to.be.false;165    });166  });167168  // TODO: burnFrom169  it('Burn item in Fungible collection', async () => {170    const createMode = 'Fungible';171    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});172    await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});173    const tokenId = await createItemExpectSuccess(alice, collectionId, createMode); // Helper creates 10 fungible tokens174    await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);175176    await usingApi(async (api) => {177      // Destroy 1 of 10178      const tx = api.tx.unique.burnFrom(collectionId, normalizeAccountId(alice.address), tokenId, 1);179      const events = await submitTransactionAsync(bob, tx);180      const result = getGenericResult(events);181182      // Get alice balance183      const balance = await getBalance(api, collectionId, alice.address, 0);184185      // What to expect186      expect(result.success).to.be.true;187      expect(balance).to.be.equal(9n);188    });189  });190191  // TODO: burnFrom192  it('Burn item in ReFungible collection', async () => {193    const createMode = 'ReFungible';194    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});195    await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});196    const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);197    await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);198199    await usingApi(async (api) => {200      const tx = api.tx.unique.burnFrom(collectionId, normalizeAccountId(alice.address), tokenId, 100);201      const events = await submitTransactionAsync(bob, tx);202      const result = getGenericResult(events);203      // Get alice balance204      expect(result.success).to.be.true;205      // Get the item206      expect(await isTokenExists(api, collectionId, tokenId)).to.be.false;207    });208  });209});210211describe('Negative integration test: ext. burnItem():', () => {212  before(async () => {213    await usingApi(async (api, privateKeyWrapper) => {214      alice = privateKeyWrapper('//Alice');215      bob = privateKeyWrapper('//Bob');216    });217  });218219  it('Burn a token that was never created', async () => {220    const createMode = 'NFT';221    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});222    const tokenId = 10;223224    await usingApi(async (api) => {225      const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);226      const badTransaction = async function () {227        await submitTransactionExpectFailAsync(alice, tx);228      };229      await expect(badTransaction()).to.be.rejected;230    });231232  });233234  it('Burn a token using the address that does not own it', async () => {235    const createMode = 'NFT';236    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});237    const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);238239    await usingApi(async (api) => {240      const tx = api.tx.unique.burnItem(collectionId, tokenId, 1);241      const badTransaction = async function () {242        await submitTransactionExpectFailAsync(bob, tx);243      };244      await expect(badTransaction()).to.be.rejected;245    });246247  });248249  it('Transfer a burned a token', async () => {250    const createMode = 'NFT';251    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});252    const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);253254    await usingApi(async (api) => {255256      const burntx = api.tx.unique.burnItem(collectionId, tokenId, 1);257      const events1 = await submitTransactionAsync(alice, burntx);258      const result1 = getGenericResult(events1);259      expect(result1.success).to.be.true;260261      const tx = api.tx.unique.transfer(normalizeAccountId(bob.address), collectionId, tokenId, 1);262      const badTransaction = async function () {263        await submitTransactionExpectFailAsync(alice, tx);264      };265      await expect(badTransaction()).to.be.rejected;266    });267268  });269270  it('Burn more than owned in Fungible collection', async () => {271    const createMode = 'Fungible';272    const collectionId = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});273    // Helper creates 10 fungible tokens274    await createItemExpectSuccess(alice, collectionId, createMode);275    const tokenId = 0; // ignored276277    await usingApi(async (api) => {278      // Destroy 11 of 10279      const tx = api.tx.unique.burnItem(collectionId, tokenId, 11);280      const badTransaction = async function () {281        await submitTransactionExpectFailAsync(alice, tx);282      };283      await expect(badTransaction()).to.be.rejected;284285      // Get alice balance286      const balance = await getBalance(api, collectionId, alice.address, 0);287288      // What to expect289      expect(balance).to.be.equal(10n);290    });291292  });293294});
modifiedtests/src/eth/crossTransfer.test.tsdiffbeforeafterboth
--- a/tests/src/eth/crossTransfer.test.ts
+++ b/tests/src/eth/crossTransfer.test.ts
@@ -18,6 +18,7 @@
   createFungibleItemExpectSuccess,
   transferExpectSuccess,
   transferFromExpectSuccess,
+  setCollectionLimitsExpectSuccess,
   createItemExpectSuccess} from '../util/helpers';
 import {collectionIdToAddress,
   createEthAccountWithBalance,
@@ -35,6 +36,7 @@
     const alice = privateKeyWrapper('//Alice');
     const bob = privateKeyWrapper('//Bob');
     const charlie = privateKeyWrapper('//Charlie');
+    await setCollectionLimitsExpectSuccess(alice, collection, {ownerCanTransfer: true});
     await createFungibleItemExpectSuccess(alice, collection, {Value: 200n}, {Substrate: alice.address});
     await transferExpectSuccess(collection, 0, alice, {Ethereum: subToEth(charlie.address)} , 200, 'Fungible');
     await transferFromExpectSuccess(collection, 0, alice, {Ethereum: subToEth(charlie.address)}, charlie, 50, 'Fungible');
@@ -48,6 +50,7 @@
     });
     const alice = privateKeyWrapper('//Alice');
     const bob = privateKeyWrapper('//Bob');
+    await setCollectionLimitsExpectSuccess(alice, collection, {ownerCanTransfer: true});
     const bobProxy = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const aliceProxy = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
 
@@ -71,6 +74,7 @@
     const alice = privateKeyWrapper('//Alice');
     const bob = privateKeyWrapper('//Bob');
     const charlie = privateKeyWrapper('//Charlie');
+    await setCollectionLimitsExpectSuccess(alice, collection, {ownerCanTransfer: true});
     const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: alice.address});
     await transferExpectSuccess(collection, tokenId, alice, {Ethereum: subToEth(charlie.address)}, 1, 'NFT');
     await transferFromExpectSuccess(collection, tokenId, alice, {Ethereum: subToEth(charlie.address)}, charlie, 1, 'NFT');
@@ -85,6 +89,7 @@
     const alice = privateKeyWrapper('//Alice');
     const bob = privateKeyWrapper('//Bob');
     const charlie = privateKeyWrapper('//Charlie');
+    await setCollectionLimitsExpectSuccess(alice, collection, {ownerCanTransfer: true});
     const bobProxy = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const aliceProxy = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
     const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: alice.address});
modifiedtests/src/limits.test.tsdiffbeforeafterboth
--- a/tests/src/limits.test.ts
+++ b/tests/src/limits.test.ts
@@ -406,6 +406,7 @@
   it('Effective collection limits', async () => {
     await usingApi(async (api) => {
       const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
+      await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});
       
       { // Check that limits is undefined
         const collection = await api.rpc.unique.collectionById(collectionId);
@@ -419,7 +420,7 @@
         expect(limits.tokenLimit.toHuman()).to.be.null;
         expect(limits.sponsorTransferTimeout.toHuman()).to.be.null;
         expect(limits.sponsorApproveTimeout.toHuman()).to.be.null;
-        expect(limits.ownerCanTransfer.toHuman()).to.be.null;
+        expect(limits.ownerCanTransfer.toHuman()).to.be.true;
         expect(limits.ownerCanDestroy.toHuman()).to.be.null;
         expect(limits.transfersEnabled.toHuman()).to.be.null;
       }
modifiedtests/src/nesting/graphs.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/graphs.test.ts
+++ b/tests/src/nesting/graphs.test.ts
@@ -3,7 +3,7 @@
 import {expect} from 'chai';
 import {tokenIdToCross} from '../eth/util/helpers';
 import usingApi, {executeTransaction} from '../substrate/substrate-api';
-import {getCreateCollectionResult, transferExpectSuccess} from '../util/helpers';
+import {getCreateCollectionResult, transferExpectSuccess, setCollectionLimitsExpectSuccess} from '../util/helpers';
 
 /**
  * ```dot
@@ -36,6 +36,7 @@
     await usingApi(async (api, privateKeyWrapper) => {
       const alice = privateKeyWrapper('//Alice');
       const collection = await buildComplexObjectGraph(api, alice);
+      await setCollectionLimitsExpectSuccess(alice, collection, {ownerCanTransfer: true});
 
       // to self
       await expect(
modifiedtests/src/nesting/nest.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/nest.test.ts
+++ b/tests/src/nesting/nest.test.ts
@@ -15,6 +15,7 @@
   transferExpectFailure,
   transferExpectSuccess,
   transferFromExpectSuccess,
+  setCollectionLimitsExpectSuccess,
 } from '../util/helpers';
 import {IKeyringPair} from '@polkadot/types/types';
 
@@ -92,6 +93,7 @@
   it('Checks token children', async () => {
     await usingApi(async api => {
       const collectionA = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
+      await setCollectionLimitsExpectSuccess(alice, collectionA, {ownerCanTransfer: true});
       await setCollectionPermissionsExpectSuccess(alice, collectionA, {nesting: {tokenOwner: true}});
       const collectionB = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
 
modifiedtests/src/transferFrom.test.tsdiffbeforeafterboth
--- a/tests/src/transferFrom.test.ts
+++ b/tests/src/transferFrom.test.ts
@@ -99,6 +99,7 @@
 
   it('can be called by collection owner on non-owned item when OwnerCanTransfer == true', async () => {
     const collectionId = await createCollectionExpectSuccess();
+    await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});
     const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', bob.address);
 
     await transferFromExpectSuccess(collectionId, itemId, alice, bob, charlie);
@@ -257,6 +258,7 @@
     await usingApi(async () => {
       // nft
       const nftCollectionId = await createCollectionExpectSuccess();
+      await setCollectionLimitsExpectSuccess(alice, nftCollectionId, {ownerCanTransfer: true});
       const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');
       await burnItemExpectSuccess(alice, nftCollectionId, newNftTokenId, 1);
       await approveExpectFail(nftCollectionId, newNftTokenId, alice, bob);
@@ -266,6 +268,7 @@
   it('transferFrom burnt token before approve Fungible', async () => {
     await usingApi(async () => {
       const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
+      await setCollectionLimitsExpectSuccess(alice, fungibleCollectionId, {ownerCanTransfer: true});
       const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');
       await burnItemExpectSuccess(alice, fungibleCollectionId, newFungibleTokenId, 10);
       await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, alice, bob.address);
@@ -276,6 +279,7 @@
   it('transferFrom burnt token before approve ReFungible', async () => {
     await usingApi(async () => {
       const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
+      await setCollectionLimitsExpectSuccess(alice, reFungibleCollectionId, {ownerCanTransfer: true});
       const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');
       await burnItemExpectSuccess(alice, reFungibleCollectionId, newReFungibleTokenId, 100);
       await approveExpectFail(reFungibleCollectionId, newReFungibleTokenId, alice, bob);
modifiedtests/src/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -921,6 +921,18 @@
   });
 }
 
+export async function adminApproveFromExpectFail(
+  collectionId: number,
+  tokenId: number, admin: IKeyringPair, owner: CrossAccountId | string, approved: CrossAccountId | string, amount: number | bigint = 1,
+) {
+  await usingApi(async (api: ApiPromise) => {
+    const approveUniqueTx = api.tx.unique.approve(normalizeAccountId(approved), collectionId, tokenId, amount);
+    const events = await expect(submitTransactionAsync(admin, approveUniqueTx)).to.be.rejected;
+    const result = getGenericResult(events);
+    expect(result.success).to.be.false;
+  });
+}
+
 export async function
 getFreeBalance(account: IKeyringPair): Promise<bigint> {
   let balance = 0n;