Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Use Incrementable from frame_support::traits (#14367)
Browse files Browse the repository at this point in the history
* Use Incrementable from frame_support::traits

* Chore
  • Loading branch information
jsidorenko authored Jun 13, 2023
1 parent a57508e commit 50bb1c7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 26 deletions.
3 changes: 2 additions & 1 deletion frame/nfts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ pub mod weights;

use codec::{Decode, Encode};
use frame_support::traits::{
tokens::Locker, BalanceStatus::Reserved, Currency, EnsureOriginWithArg, ReservableCurrency,
tokens::Locker, BalanceStatus::Reserved, Currency, EnsureOriginWithArg, Incrementable,
ReservableCurrency,
};
use frame_system::Config as SystemConfig;
use sp_runtime::{
Expand Down
19 changes: 0 additions & 19 deletions frame/nfts/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

macro_rules! impl_incrementable {
($($type:ty),+) => {
$(
impl Incrementable for $type {
fn increment(&self) -> Self {
let mut val = self.clone();
val.saturating_inc();
val
}

fn initial_value() -> Self {
0
}
}
)+
};
}
pub(crate) use impl_incrementable;

macro_rules! impl_codec_bitflags {
($wrapper:ty, $size:ty, $bitflag_enum:ty) => {
impl MaxEncodedLen for $wrapper {
Expand Down
6 changes: 0 additions & 6 deletions frame/nfts/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,6 @@ pub(super) type PreSignedAttributesOf<T, I = ()> = PreSignedAttributes<
<T as SystemConfig>::BlockNumber,
>;

pub trait Incrementable {
fn increment(&self) -> Self;
fn initial_value() -> Self;
}
impl_incrementable!(u8, u16, u32, u64, u128, i8, i16, i32, i64, i128);

/// Information about a collection.
#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
pub struct CollectionDetails<AccountId, DepositBalance> {
Expand Down

0 comments on commit 50bb1c7

Please sign in to comment.