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
before · pallets/common/CHANGELOG.md
1# Change Log23All notable changes to this project will be documented in this file.45<!-- bureaucrate goes here -->67## [0.1.13] - 2022-12-0589### Added1011- The error `ZeroTransferNotAllowed` to handling transactions with the transfer of a zero amount of tokens.1213## [0.1.12] - 2022-11-161415### Changed1617- Behavior of the `setCollectionLimit` method.18  Removed method overload: single signature `(string, uint256)`19  is used for both cases.2021## [0.1.11] - 2022-11-122223### Changed2425- In the `Collection` solidity interface,26  the `allowed` function has been renamed to `allow_listed_cross`.27  Also `EthCrossAccount` type is now used as `user` arg.2829## [0.1.10] - 2022-11-023031### Changed3233- Use named structure `EthCrossAccount` in eth functions.3435## [0.1.9] - 2022-10-133637## Added3839- EVM event for `destroy_collection`.4041## [0.1.8] - 2022-08-244243## Added4445- Eth methods for collection46  - set_collection_sponsor_substrate47  - has_collection_pending_sponsor48  - remove_collection_sponsor49  - get_collection_sponsor50- Add convert function from `uint256` to `CrossAccountId`.5152## [0.1.7] - 2022-08-195354### Added5556- Add convert funtion from `CrossAccountId` to eth `uint256`.5758## [0.1.6] - 2022-08-165960### Added6162- New Ethereum API methods: changeOwner, changeOwner(Substrate) and verifyOwnerOrAdmin(Substrate).6364## [v0.1.5] 2022-08-166566### Other changes6768- build: Upgrade polkadot to v0.9.27 2c498572636f2b34d53b1c51b7283a761a7dc90a6970- build: Upgrade polkadot to v0.9.26 85515e54c4ca1b82a2630034e55dcc804c643bf87172- refactor: Switch to new prefix removal methods 26734e9567589d75cdd99e404eabf11d5a97d9757374New methods allows to call `remove_prefix` with limit multiple times75in the same block76However, we don't use prefix removal limits, so upgrade is77straightforward7879Upstream-Change: https://github.com/paritytech/substrate/pull/114908081- build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b8283## [0.1.3] - 2022-07-258485### Add8687- Some static property keys and values.8889## [0.1.2] - 2022-07-209091### Fixed9293- Some methods in `#[solidity_interface]` for `CollectionHandle` had invalid94  mutability modifiers, causing invalid stub/abi generation.9596## [0.1.1] - 2022-07-149798### Added99100- Implementation of RPC method `token_owners` returning 10 owners in no particular order.101  This was an internal request to improve the web interface and support fractionalization event.
after · pallets/common/CHANGELOG.md
1# Change Log23All notable changes to this project will be documented in this file.45<!-- bureaucrate goes here -->67## [0.1.12] - 2022-11-1689### Changed1011- Behavior of the `setCollectionLimit` method.12  Removed method overload: single signature `(string, uint256)`13  is used for both cases.1415## [0.1.11] - 2022-11-121617### Changed1819- In the `Collection` solidity interface,20  the `allowed` function has been renamed to `allow_listed_cross`.21  Also `EthCrossAccount` type is now used as `user` arg.2223## [0.1.10] - 2022-11-022425### Changed2627- Use named structure `EthCrossAccount` in eth functions.2829## [0.1.9] - 2022-10-133031## Added3233- EVM event for `destroy_collection`.3435## [0.1.8] - 2022-08-243637## Added3839- Eth methods for collection40  - set_collection_sponsor_substrate41  - has_collection_pending_sponsor42  - remove_collection_sponsor43  - get_collection_sponsor44- Add convert function from `uint256` to `CrossAccountId`.4546## [0.1.7] - 2022-08-194748### Added4950- Add convert funtion from `CrossAccountId` to eth `uint256`.5152## [0.1.6] - 2022-08-165354### Added5556- New Ethereum API methods: changeOwner, changeOwner(Substrate) and verifyOwnerOrAdmin(Substrate).5758## [v0.1.5] 2022-08-165960### Other changes6162- build: Upgrade polkadot to v0.9.27 2c498572636f2b34d53b1c51b7283a761a7dc90a6364- build: Upgrade polkadot to v0.9.26 85515e54c4ca1b82a2630034e55dcc804c643bf86566- refactor: Switch to new prefix removal methods 26734e9567589d75cdd99e404eabf11d5a97d9756768New methods allows to call `remove_prefix` with limit multiple times69in the same block70However, we don't use prefix removal limits, so upgrade is71straightforward7273Upstream-Change: https://github.com/paritytech/substrate/pull/114907475- build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b7677## [0.1.3] - 2022-07-257879### Add8081- Some static property keys and values.8283## [0.1.2] - 2022-07-208485### Fixed8687- Some methods in `#[solidity_interface]` for `CollectionHandle` had invalid88  mutability modifiers, causing invalid stub/abi generation.8990## [0.1.1] - 2022-07-149192### Added9394- Implementation of RPC method `token_owners` returning 10 owners in no particular order.95  This was an internal request to improve the web interface and support fractionalization event.
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
--- a/pallets/refungible/CHANGELOG.md
+++ b/pallets/refungible/CHANGELOG.md
@@ -3,11 +3,6 @@
 All notable changes to this project will be documented in this file.
 
 <!-- bureaucrate goes here -->
-## [0.2.10] - 2022-12-05
-
-### Fixed
-
-- Transfer with zero pieces.
 
 ## [0.2.9] - 2022-11-18
 
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