difftreelog
Revert "fix zero transfer"
in: master
This reverts commit 2880b7f76c032798bcf34e0b1b79ca02a267e201.
13 files changed
Cargo.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",
pallets/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
pallets/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"
pallets/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.
pallets/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
pallets/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"
pallets/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,
pallets/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
pallets/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"
pallets/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(
pallets/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
pallets/refungible/Cargo.tomldiffbeforeafterboth1[package]2name = "pallet-refungible"3version = "0.2.9"4license = "GPLv3"5edition = "2021"67[dependencies.codec]8default-features = false9features = ['derive']10package = 'parity-scale-codec'11version = '3.1.2'1213[dependencies]14frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }15frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }16sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }17sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }18sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }19pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.30-2" }20evm-coder = { default-features = false, path = '../../crates/evm-coder' }21pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }22pallet-common = { default-features = false, path = '../common' }23pallet-structure = { default-features = false, path = '../structure' }24frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }2526struct-versioning = { path = "../../crates/struct-versioning" }27up-data-structs = { default-features = false, path = '../../primitives/data-structs' }28ethereum = { version = "0.12.0", default-features = false }29scale-info = { version = "2.0.1", default-features = false, features = [30 "derive",31] }32derivative = { version = "2.2.0", features = ["use_core"] }3334[features]35default = ["std"]36std = [37 "ethereum/std",38 "evm-coder/std",39 'frame-benchmarking/std',40 "frame-support/std",41 "frame-system/std",42 "pallet-common/std",43 "pallet-evm/std",44 "pallet-evm-coder-substrate/std",45 "pallet-structure/std",46 "sp-runtime/std",47 "sp-std/std",48 "up-data-structs/std",49]50runtime-benchmarks = [51 'frame-benchmarking',52 'frame-support/runtime-benchmarks',53 'frame-system/runtime-benchmarks',54 'up-data-structs/runtime-benchmarks',55]56try-runtime = ["frame-support/try-runtime"]57stubgen = ["evm-coder/stubgen", "pallet-common/stubgen"]1[package]2name = "pallet-refungible"3version = "0.2.8"4license = "GPLv3"5edition = "2021"67[dependencies.codec]8default-features = false9features = ['derive']10package = 'parity-scale-codec'11version = '3.1.2'1213[dependencies]14frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }15frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }16sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }17sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }18sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }19pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.30-2" }20evm-coder = { default-features = false, path = '../../crates/evm-coder' }21pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }22pallet-common = { default-features = false, path = '../common' }23pallet-structure = { default-features = false, path = '../structure' }24frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }2526struct-versioning = { path = "../../crates/struct-versioning" }27up-data-structs = { default-features = false, path = '../../primitives/data-structs' }28ethereum = { version = "0.12.0", default-features = false }29scale-info = { version = "2.0.1", default-features = false, features = [30 "derive",31] }32derivative = { version = "2.2.0", features = ["use_core"] }3334[features]35default = ["std"]36std = [37 "ethereum/std",38 "evm-coder/std",39 'frame-benchmarking/std',40 "frame-support/std",41 "frame-system/std",42 "pallet-common/std",43 "pallet-evm/std",44 "pallet-evm-coder-substrate/std",45 "pallet-structure/std",46 "sp-runtime/std",47 "sp-std/std",48 "up-data-structs/std",49]50runtime-benchmarks = [51 'frame-benchmarking',52 'frame-support/runtime-benchmarks',53 'frame-system/runtime-benchmarks',54 'up-data-structs/runtime-benchmarks',55]56try-runtime = ["frame-support/try-runtime"]57stubgen = ["evm-coder/stubgen", "pallet-common/stubgen"]pallets/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