git.delta.rocks / unique-network / refs/commits / 2880b7f76c03

difftreelog

fix zero transfer

PraetorP2022-12-05parent: #1c47062.patch.diff
in: master

13 files changed

modifiedCargo.lockdiffbeforeafterboth
59015901
5902[[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",
61916191
6192[[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",
64466446
6447[[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",
65686568
6569[[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",
modifiedpallets/common/CHANGELOG.mddiffbeforeafterboth
44
5<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->
66
7## [0.1.13] - 2022-12-05
8
9### Added
10
11- The error `ZeroTransferNotAllowed` to handling transactions with the transfer of a zero amount of tokens.
12
7## [0.1.12] - 2022-11-1613## [0.1.12] - 2022-11-16
814
9### Changed15### Changed
modifiedpallets/common/Cargo.tomldiffbeforeafterboth
1[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"
66
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
602 /// Tried to access an internal collection with an external API602 /// Tried to access an internal collection with an external API
603 CollectionIsInternal,603 CollectionIsInternal,
604
605 /// Transfer operation with zero amount
606 ZeroTransferNotAllowed,
604 }607 }
605608
606 /// 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.
modifiedpallets/fungible/CHANGELOG.mddiffbeforeafterboth
44
5<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->
66
7## [0.1.9] - 2022-12-05
8
9### Fixed
10
11- Transfer with zero tokens.
12
7## [0.1.8] - 2022-11-1813## [0.1.8] - 2022-11-18
814
9### Added15### Added
modifiedpallets/fungible/Cargo.tomldiffbeforeafterboth
1[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"
66
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
365 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);
369
368 ensure!(370 ensure!(
369 collection.limits.transfers_enabled(),371 collection.limits.transfers_enabled(),
modifiedpallets/nonfungible/CHANGELOG.mddiffbeforeafterboth
44
5<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->
66
7## [0.1.11] - 2022-12-05
8
9### Fixed
10
11- Transfer with zero tokens.
12
7## [0.1.10] - 2022-11-1813## [0.1.10] - 2022-11-18
814
9### Added15### Added
modifiedpallets/nonfungible/Cargo.tomldiffbeforeafterboth
1[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"
66
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
23};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);
318
318 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 }
326324
327 fn approve(325 fn approve(
354 ) -> DispatchResultWithPostInfo {352 ) -> DispatchResultWithPostInfo {
355 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);353 ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);
356
357 if amount == 1 {354 ensure!(amount > 0, <CommonError<T>>::ZeroTransferNotAllowed);
355
358 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 }
366361
367 fn burn_from(362 fn burn_from(
modifiedpallets/refungible/CHANGELOG.mddiffbeforeafterboth
3All notable changes to this project will be documented in this file.3All notable changes to this project will be documented in this file.
44
5<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->
6## [0.2.10] - 2022-12-05
67
8### Fixed
9
10- Transfer with zero pieces.
11
7## [0.2.9] - 2022-11-1812## [0.2.9] - 2022-11-18
813
9### Added14### Added
modifiedpallets/refungible/Cargo.tomldiffbeforeafterboth
1[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"
66
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
727 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);
731
730 ensure!(732 ensure!(
731 collection.limits.transfers_enabled(),733 collection.limits.transfers_enabled(),