mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 16:57:58 +00:00
Add and implement MaxEncodedLen to token traits (#11945)
* Add and implement MaxEncodedLen bounds to token traits * cargo fmt * Update UI test expectations
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
//! Miscellaneous types.
|
||||
|
||||
use codec::{Decode, Encode, FullCodec};
|
||||
use codec::{Decode, Encode, FullCodec, MaxEncodedLen};
|
||||
use sp_arithmetic::traits::{AtLeast32BitUnsigned, Zero};
|
||||
use sp_core::RuntimeDebug;
|
||||
use sp_runtime::{ArithmeticError, DispatchError, TokenError};
|
||||
@@ -116,7 +116,9 @@ pub enum ExistenceRequirement {
|
||||
}
|
||||
|
||||
/// Status of funds.
|
||||
#[derive(PartialEq, Eq, Clone, Copy, Encode, Decode, RuntimeDebug, scale_info::TypeInfo)]
|
||||
#[derive(
|
||||
PartialEq, Eq, Clone, Copy, Encode, Decode, RuntimeDebug, scale_info::TypeInfo, MaxEncodedLen,
|
||||
)]
|
||||
pub enum BalanceStatus {
|
||||
/// Funds are free, as corresponding to `free` item in Balances.
|
||||
Free,
|
||||
@@ -126,7 +128,7 @@ pub enum BalanceStatus {
|
||||
|
||||
bitflags::bitflags! {
|
||||
/// Reasons for moving funds out of an account.
|
||||
#[derive(Encode, Decode)]
|
||||
#[derive(Encode, Decode, MaxEncodedLen)]
|
||||
pub struct WithdrawReasons: u8 {
|
||||
/// In order to pay for (system) transaction costs.
|
||||
const TRANSACTION_PAYMENT = 0b00000001;
|
||||
@@ -161,16 +163,29 @@ impl WithdrawReasons {
|
||||
}
|
||||
|
||||
/// Simple amalgamation trait to collect together properties for an AssetId under one roof.
|
||||
pub trait AssetId: FullCodec + Copy + Eq + PartialEq + Debug + scale_info::TypeInfo {}
|
||||
impl<T: FullCodec + Copy + Eq + PartialEq + Debug + scale_info::TypeInfo> AssetId for T {}
|
||||
pub trait AssetId:
|
||||
FullCodec + Copy + Eq + PartialEq + Debug + scale_info::TypeInfo + MaxEncodedLen
|
||||
{
|
||||
}
|
||||
impl<T: FullCodec + Copy + Eq + PartialEq + Debug + scale_info::TypeInfo + MaxEncodedLen> AssetId
|
||||
for T
|
||||
{
|
||||
}
|
||||
|
||||
/// Simple amalgamation trait to collect together properties for a Balance under one roof.
|
||||
pub trait Balance:
|
||||
AtLeast32BitUnsigned + FullCodec + Copy + Default + Debug + scale_info::TypeInfo
|
||||
AtLeast32BitUnsigned + FullCodec + Copy + Default + Debug + scale_info::TypeInfo + MaxEncodedLen
|
||||
{
|
||||
}
|
||||
impl<T: AtLeast32BitUnsigned + FullCodec + Copy + Default + Debug + scale_info::TypeInfo> Balance
|
||||
for T
|
||||
impl<
|
||||
T: AtLeast32BitUnsigned
|
||||
+ FullCodec
|
||||
+ Copy
|
||||
+ Default
|
||||
+ Debug
|
||||
+ scale_info::TypeInfo
|
||||
+ MaxEncodedLen,
|
||||
> Balance for T
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user