difftreelog
fix zero transfer
in: master
13 files changed
Cargo.lockdiffbeforeafterboth590159015902[[package]]5902[[package]]5903name = "pallet-common"5903name = "pallet-common"5904version = "0.1.12"5904version = "0.1.13"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.7"6194version = "0.1.8"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.9"6449version = "0.1.10"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.8"6571version = "0.2.9"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.127## [0.1.12] - 2022-11-1613## [0.1.12] - 2022-11-168149### Changed15### Changedpallets/common/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-common"2name = "pallet-common"3version = "0.1.12"3version = "0.1.13"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,604 }607 }605608606 /// Storage of the count of created collections. Essentially contains the last collection ID.609 /// 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.127## [0.1.8] - 2022-11-1813## [0.1.8] - 2022-11-188149### Added15### Addedpallets/fungible/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-fungible"2name = "pallet-fungible"3version = "0.1.7"3version = "0.1.8"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);369368 ensure!(370 ensure!(369 collection.limits.transfers_enabled(),371 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.127## [0.1.10] - 2022-11-1813## [0.1.10] - 2022-11-188149### Added15### Addedpallets/nonfungible/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-nonfungible"2name = "pallet-nonfungible"3version = "0.1.9"3version = "0.1.10"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 _,26 weights::WeightInfo as _, Error as CommonError,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 if amount == 1 {317 ensure!(amount > 0, <CommonError<T>>::ZeroTransferNotAllowed);318318 with_weight(319 with_weight(319 <Pallet<T>>::transfer(self, &from, &to, token, nesting_budget),320 <Pallet<T>>::transfer(self, &from, &to, token, nesting_budget),320 <CommonWeights<T>>::transfer(),321 <CommonWeights<T>>::transfer(),321 )322 )322 } else {323 Ok(().into())324 }325 }323 }326324327 fn approve(325 fn approve(354 ) -> DispatchResultWithPostInfo {352 ) -> DispatchResultWithPostInfo {355 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);353 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);356357 if amount == 1 {354 ensure!(amount > 0, <CommonError<T>>::ZeroTransferNotAllowed);355358 with_weight(356 with_weight(359 <Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget),357 <Pallet<T>>::transfer_from(self, &sender, &from, &to, token, nesting_budget),360 <CommonWeights<T>>::transfer_from(),358 <CommonWeights<T>>::transfer_from(),361 )359 )362 } else {363 Ok(().into())364 }365 }360 }366361367 fn burn_from(362 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-05678### Fixed910- Transfer with zero pieces.117## [0.2.9] - 2022-11-1812## [0.2.9] - 2022-11-188139### Added14### Addedpallets/refungible/Cargo.tomldiffbeforeafterboth1[package]1[package]2name = "pallet-refungible"2name = "pallet-refungible"3version = "0.2.8"3version = "0.2.9"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);731730 ensure!(732 ensure!(731 collection.limits.transfers_enabled(),733 collection.limits.transfers_enabled(),