difftreelog
Revert "fix zero transfer"
in: master
This reverts commit 2880b7f76c032798bcf34e0b1b79ca02a267e201.
13 files changed
Cargo.lockdiffbeforeafterboth590159015902[[package]]5902[[package]]5903name = "pallet-common"5903name = "pallet-common"5904version = "0.1.13"5904version = "0.1.12"5905dependencies = [5905dependencies = [5906 "ethereum",5906 "ethereum",5907 "evm-coder",5907 "evm-coder",619161916192[[package]]6192[[package]]6193name = "pallet-fungible"6193name = "pallet-fungible"6194version = "0.1.8"6194version = "0.1.7"6195dependencies = [6195dependencies = [6196 "ethereum",6196 "ethereum",6197 "evm-coder",6197 "evm-coder",644664466447[[package]]6447[[package]]6448name = "pallet-nonfungible"6448name = "pallet-nonfungible"6449version = "0.1.10"6449version = "0.1.9"6450dependencies = [6450dependencies = [6451 "ethereum",6451 "ethereum",6452 "evm-coder",6452 "evm-coder",656865686569[[package]]6569[[package]]6570name = "pallet-refungible"6570name = "pallet-refungible"6571version = "0.2.9"6571version = "0.2.8"6572dependencies = [6572dependencies = [6573 "derivative",6573 "derivative",6574 "ethereum",6574 "ethereum",pallets/common/CHANGELOG.mddiffbeforeafterboth445<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->667## [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-167## [0.1.12] - 2022-11-1614815### Changed9### Changedpallets/common/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-common"2name = "pallet-common"3version = "0.1.13"3version = "0.1.12"4license = "GPLv3"4license = "GPLv3"5edition = "2021"5edition = "2021"66pallets/common/src/lib.rsdiffbeforeafterboth602 /// Tried to access an internal collection with an external API602 /// Tried to access an internal collection with an external API603 CollectionIsInternal,603 CollectionIsInternal,604605 /// Transfer operation with zero amount606 ZeroTransferNotAllowed,607 }604 }608605609 /// Storage of the count of created collections. Essentially contains the last collection ID.606 /// Storage of the count of created collections. Essentially contains the last collection ID.pallets/fungible/CHANGELOG.mddiffbeforeafterboth445<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->667## [0.1.9] - 2022-12-0589### Fixed 1011- Transfer with zero tokens.1213## [0.1.8] - 2022-11-187## [0.1.8] - 2022-11-1814815### Added9### Addedpallets/fungible/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-fungible"2name = "pallet-fungible"3version = "0.1.8"3version = "0.1.7"4license = "GPLv3"4license = "GPLv3"5edition = "2021"5edition = "2021"66pallets/fungible/src/lib.rsdiffbeforeafterboth365 amount: u128,365 amount: u128,366 nesting_budget: &dyn Budget,366 nesting_budget: &dyn Budget,367 ) -> DispatchResult {367 ) -> DispatchResult {368 ensure!(amount > 0, <CommonError<T>>::ZeroTransferNotAllowed);369370 ensure!(368 ensure!(371 collection.limits.transfers_enabled(),369 collection.limits.transfers_enabled(),pallets/nonfungible/CHANGELOG.mddiffbeforeafterboth445<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->667## [0.1.11] - 2022-12-0589### Fixed1011- Transfer with zero tokens.1213## [0.1.10] - 2022-11-187## [0.1.10] - 2022-11-1814815### Added9### Addedpallets/nonfungible/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-nonfungible"2name = "pallet-nonfungible"3version = "0.1.10"3version = "0.1.9"4license = "GPLv3"4license = "GPLv3"5edition = "2021"5edition = "2021"66pallets/nonfungible/src/common.rsdiffbeforeafterboth23};23};24use pallet_common::{24use pallet_common::{25 CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,25 CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,26 weights::WeightInfo as _, Error as CommonError,26 weights::WeightInfo as _,27};27};28use sp_runtime::DispatchError;28use sp_runtime::DispatchError;29use sp_std::{vec::Vec, vec};29use sp_std::{vec::Vec, vec};314 nesting_budget: &dyn Budget,314 nesting_budget: &dyn Budget,315 ) -> DispatchResultWithPostInfo {315 ) -> DispatchResultWithPostInfo {316 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);316 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);317 ensure!(amount > 0, <CommonError<T>>::ZeroTransferNotAllowed);317 if amount == 1 {318319 with_weight(318 with_weight(320 <Pallet<T>>::transfer(self, &from, &to, token, nesting_budget),319 <Pallet<T>>::transfer(self, &from, &to, token, nesting_budget),321 <CommonWeights<T>>::transfer(),320 <CommonWeights<T>>::transfer(),322 )321 )322 } else {323 Ok(().into())324 }323 }325 }324326325 fn approve(327 fn approve(352 ) -> DispatchResultWithPostInfo {354 ) -> DispatchResultWithPostInfo {353 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);355 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);356354 ensure!(amount > 0, <CommonError<T>>::ZeroTransferNotAllowed);357 if amount == 1 {355356 with_weight(358 with_weight(357 <Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget),359 <Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget),358 <CommonWeights<T>>::transfer_from(),360 <CommonWeights<T>>::transfer_from(),359 )361 )362 } else {363 Ok(().into())364 }360 }365 }361366362 fn burn_from(367 fn burn_from(pallets/refungible/CHANGELOG.mddiffbeforeafterboth3All notable changes to this project will be documented in this file.3All notable changes to this project will be documented in this file.445<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->6## [0.2.10] - 2022-12-05768### Fixed910- Transfer with zero pieces.1112## [0.2.9] - 2022-11-187## [0.2.9] - 2022-11-1813814### Added9### Addedpallets/refungible/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-refungible"2name = "pallet-refungible"3version = "0.2.9"3version = "0.2.8"4license = "GPLv3"4license = "GPLv3"5edition = "2021"5edition = "2021"66pallets/refungible/src/lib.rsdiffbeforeafterboth727 amount: u128,727 amount: u128,728 nesting_budget: &dyn Budget,728 nesting_budget: &dyn Budget,729 ) -> DispatchResult {729 ) -> DispatchResult {730 ensure!(amount > 0, <CommonError<T>>::ZeroTransferNotAllowed);731732 ensure!(730 ensure!(733 collection.limits.transfers_enabled(),731 collection.limits.transfers_enabled(),