git.delta.rocks / unique-network / refs/commits / cfd4b613ae66

difftreelog

Revert "fix zero transfer"

Daniel Shiposha2022-12-06parent: #2f762b2.patch.diff
in: master
This reverts commit 2880b7f76c032798bcf34e0b1b79ca02a267e201.

13 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5901,7 +5901,7 @@
 
 [[package]]
 name = "pallet-common"
-version = "0.1.13"
+version = "0.1.12"
 dependencies = [
  "ethereum",
  "evm-coder",
@@ -6191,7 +6191,7 @@
 
 [[package]]
 name = "pallet-fungible"
-version = "0.1.8"
+version = "0.1.7"
 dependencies = [
  "ethereum",
  "evm-coder",
@@ -6446,7 +6446,7 @@
 
 [[package]]
 name = "pallet-nonfungible"
-version = "0.1.10"
+version = "0.1.9"
 dependencies = [
  "ethereum",
  "evm-coder",
@@ -6568,7 +6568,7 @@
 
 [[package]]
 name = "pallet-refungible"
-version = "0.2.9"
+version = "0.2.8"
 dependencies = [
  "derivative",
  "ethereum",
modifiedpallets/common/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/common/CHANGELOG.md
+++ b/pallets/common/CHANGELOG.md
@@ -4,12 +4,6 @@
 
 <!-- bureaucrate goes here -->
 
-## [0.1.13] - 2022-12-05
-
-### Added
-
-- The error `ZeroTransferNotAllowed` to handling transactions with the transfer of a zero amount of tokens.
-
 ## [0.1.12] - 2022-11-16
 
 ### Changed
modifiedpallets/common/Cargo.tomldiffbeforeafterboth
--- a/pallets/common/Cargo.toml
+++ b/pallets/common/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "pallet-common"
-version = "0.1.13"
+version = "0.1.12"
 license = "GPLv3"
 edition = "2021"
 
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -601,9 +601,6 @@
 
 		/// Tried to access an internal collection with an external API
 		CollectionIsInternal,
-
-		/// Transfer operation with zero amount
-		ZeroTransferNotAllowed,
 	}
 
 	/// Storage of the count of created collections. Essentially contains the last collection ID.
modifiedpallets/fungible/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/fungible/CHANGELOG.md
+++ b/pallets/fungible/CHANGELOG.md
@@ -4,12 +4,6 @@
 
 <!-- bureaucrate goes here -->
 
-## [0.1.9] - 2022-12-05
-
-### Fixed 
-
-- Transfer with zero tokens.
-
 ## [0.1.8] - 2022-11-18
 
 ### Added
modifiedpallets/fungible/Cargo.tomldiffbeforeafterboth
--- a/pallets/fungible/Cargo.toml
+++ b/pallets/fungible/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "pallet-fungible"
-version = "0.1.8"
+version = "0.1.7"
 license = "GPLv3"
 edition = "2021"
 
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -365,8 +365,6 @@
 		amount: u128,
 		nesting_budget: &dyn Budget,
 	) -> DispatchResult {
-		ensure!(amount > 0, <CommonError<T>>::ZeroTransferNotAllowed);
-
 		ensure!(
 			collection.limits.transfers_enabled(),
 			<CommonError<T>>::TransferNotAllowed,
modifiedpallets/nonfungible/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/nonfungible/CHANGELOG.md
+++ b/pallets/nonfungible/CHANGELOG.md
@@ -4,12 +4,6 @@
 
 <!-- bureaucrate goes here -->
 
-## [0.1.11] - 2022-12-05
-
-### Fixed
-
-- Transfer with zero tokens.
-
 ## [0.1.10] - 2022-11-18
 
 ### Added
modifiedpallets/nonfungible/Cargo.tomldiffbeforeafterboth
--- a/pallets/nonfungible/Cargo.toml
+++ b/pallets/nonfungible/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "pallet-nonfungible"
-version = "0.1.10"
+version = "0.1.9"
 license = "GPLv3"
 edition = "2021"
 
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -23,7 +23,7 @@
 };
 use pallet_common::{
 	CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,
-	weights::WeightInfo as _, Error as CommonError,
+	weights::WeightInfo as _,
 };
 use sp_runtime::DispatchError;
 use sp_std::{vec::Vec, vec};
@@ -314,12 +314,14 @@
 		nesting_budget: &dyn Budget,
 	) -> DispatchResultWithPostInfo {
 		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);
-		ensure!(amount > 0, <CommonError<T>>::ZeroTransferNotAllowed);
-
-		with_weight(
-			<Pallet<T>>::transfer(self, &from, &to, token, nesting_budget),
-			<CommonWeights<T>>::transfer(),
-		)
+		if amount == 1 {
+			with_weight(
+				<Pallet<T>>::transfer(self, &from, &to, token, nesting_budget),
+				<CommonWeights<T>>::transfer(),
+			)
+		} else {
+			Ok(().into())
+		}
 	}
 
 	fn approve(
@@ -351,12 +353,15 @@
 		nesting_budget: &dyn Budget,
 	) -> DispatchResultWithPostInfo {
 		ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);
-		ensure!(amount > 0, <CommonError<T>>::ZeroTransferNotAllowed);
 
-		with_weight(
-			<Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget),
-			<CommonWeights<T>>::transfer_from(),
-		)
+		if amount == 1 {
+			with_weight(
+				<Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget),
+				<CommonWeights<T>>::transfer_from(),
+			)
+		} else {
+			Ok(().into())
+		}
 	}
 
 	fn burn_from(
modifiedpallets/refungible/CHANGELOG.mddiffbeforeafterboth
before · pallets/refungible/CHANGELOG.md
1# Change Log23All notable changes to this project will be documented in this file.45<!-- bureaucrate goes here -->6## [0.2.10] - 2022-12-0578### Fixed910- Transfer with zero pieces.1112## [0.2.9] - 2022-11-181314### Added1516- The functions `description`, `crossOwnerOf`, `tokenProperties` to `ERC721UniqueExtensions` interface.1718## [0.2.8] - 2022-11-141920### Changed2122- Added `transfer_cross` in eth functions.2324## [v0.2.7] - 2022-11-112526### Changed2728- Added `delete_properties` in eth functions. The `delete_property` function is now deprecated.2930## [v0.2.6] - 2022-11-023132### Changed3334- Use named structure `EthCrossAccount` in eth functions.3536## [v0.2.5] - 2022-20-103738### Change3940- Added `set_properties` method for `TokenProperties` interface.4142## [v0.2.4] - 2022-08-244344### Change4546- Add bound `AsRef<[u8; 32]>` to `T::CrossAccountId`.4748## [v0.2.3] 2022-08-164950### Other changes5152- build: Upgrade polkadot to v0.9.27 2c498572636f2b34d53b1c51b7283a761a7dc90a5354- build: Upgrade polkadot to v0.9.26 85515e54c4ca1b82a2630034e55dcc804c643bf85556- refactor: Switch to new prefix removal methods 26734e9567589d75cdd99e404eabf11d5a97d9755758New methods allows to call `remove_prefix` with limit multiple times59in the same block60However, we don't use prefix removal limits, so upgrade is61straightforward6263Upstream-Change: https://github.com/paritytech/substrate/pull/114906465- build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b6667## [v0.2.2] 2022-08-046869### Product changes7071- Now RefungibleMultipleItems may only receive single user on type level.7273### Added features7475- Implement property RPC 7bf45b532e32daa91f03c157b58874d21b42ae1f7677### Other changes7879- refactor: Disallow invalid bulk mints 53fec71cf728dddd012257b407ea30441e699f888081`create_multiple_items_ex` was allowing invalid (that will be always82rejected at runtime level) refungible mint extrinsics, by passing83multiple users into `RefungibleMultipleItems` call.8485## [v0.2.1] - 2022-07-278687### New features8889Implementation of ERC-721 EVM API ([#452](https://github.com/UniqueNetwork/unique-chain/pull/452))9091## [v0.2.0] - 2022-08-019293### Deprecated9495`const_data` field is removed9697- `ItemData`98- `TokenData`99100## [v0.1.2] - 2022-07-14101102### Other changes103104feat(refungible-pallet): add ERC-20 EVM API for RFT token pieces ([#413](https://github.com/UniqueNetwork/unique-chain/pull/413))105test(refungible-pallet): add tests for ERC-20 EVM API for RFT token pieces ([#413](https://github.com/UniqueNetwork/unique-chain/pull/413))106107## [v0.1.1] - 2022-07-14108109### Added features110111- Support for properties for RFT collections and tokens.112113### Other changes114115- feat: RPC method `token_owners` returning 10 owners in no particular order.116117This was an internal request to improve the web interface and support fractionalization event.
after · pallets/refungible/CHANGELOG.md
1# Change Log23All notable changes to this project will be documented in this file.45<!-- bureaucrate goes here -->67## [0.2.9] - 2022-11-1889### Added1011- The functions `description`, `crossOwnerOf`, `tokenProperties` to `ERC721UniqueExtensions` interface.1213## [0.2.8] - 2022-11-141415### Changed1617- Added `transfer_cross` in eth functions.1819## [v0.2.7] - 2022-11-112021### Changed2223- Added `delete_properties` in eth functions. The `delete_property` function is now deprecated.2425## [v0.2.6] - 2022-11-022627### Changed2829- Use named structure `EthCrossAccount` in eth functions.3031## [v0.2.5] - 2022-20-103233### Change3435- Added `set_properties` method for `TokenProperties` interface.3637## [v0.2.4] - 2022-08-243839### Change4041- Add bound `AsRef<[u8; 32]>` to `T::CrossAccountId`.4243## [v0.2.3] 2022-08-164445### Other changes4647- build: Upgrade polkadot to v0.9.27 2c498572636f2b34d53b1c51b7283a761a7dc90a4849- build: Upgrade polkadot to v0.9.26 85515e54c4ca1b82a2630034e55dcc804c643bf85051- refactor: Switch to new prefix removal methods 26734e9567589d75cdd99e404eabf11d5a97d9755253New methods allows to call `remove_prefix` with limit multiple times54in the same block55However, we don't use prefix removal limits, so upgrade is56straightforward5758Upstream-Change: https://github.com/paritytech/substrate/pull/114905960- build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b6162## [v0.2.2] 2022-08-046364### Product changes6566- Now RefungibleMultipleItems may only receive single user on type level.6768### Added features6970- Implement property RPC 7bf45b532e32daa91f03c157b58874d21b42ae1f7172### Other changes7374- refactor: Disallow invalid bulk mints 53fec71cf728dddd012257b407ea30441e699f887576`create_multiple_items_ex` was allowing invalid (that will be always77rejected at runtime level) refungible mint extrinsics, by passing78multiple users into `RefungibleMultipleItems` call.7980## [v0.2.1] - 2022-07-278182### New features8384Implementation of ERC-721 EVM API ([#452](https://github.com/UniqueNetwork/unique-chain/pull/452))8586## [v0.2.0] - 2022-08-018788### Deprecated8990`const_data` field is removed9192- `ItemData`93- `TokenData`9495## [v0.1.2] - 2022-07-149697### Other changes9899feat(refungible-pallet): add ERC-20 EVM API for RFT token pieces ([#413](https://github.com/UniqueNetwork/unique-chain/pull/413))100test(refungible-pallet): add tests for ERC-20 EVM API for RFT token pieces ([#413](https://github.com/UniqueNetwork/unique-chain/pull/413))101102## [v0.1.1] - 2022-07-14103104### Added features105106- Support for properties for RFT collections and tokens.107108### Other changes109110- feat: RPC method `token_owners` returning 10 owners in no particular order.111112This was an internal request to improve the web interface and support fractionalization event.
modifiedpallets/refungible/Cargo.tomldiffbeforeafterboth
--- a/pallets/refungible/Cargo.toml
+++ b/pallets/refungible/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "pallet-refungible"
-version = "0.2.9"
+version = "0.2.8"
 license = "GPLv3"
 edition = "2021"
 
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -727,8 +727,6 @@
 		amount: u128,
 		nesting_budget: &dyn Budget,
 	) -> DispatchResult {
-		ensure!(amount > 0, <CommonError<T>>::ZeroTransferNotAllowed);
-
 		ensure!(
 			collection.limits.transfers_enabled(),
 			<CommonError<T>>::TransferNotAllowed