git.delta.rocks / unique-network / refs/commits / e8a3a23736b5

difftreelog

fix create collection properties length

Daniel Shiposha2022-05-25parent: #f2ae03c.patch.diff
in: master

1 file changed

modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
105pub const MAX_PROPERTY_VALUE_LENGTH: u32 = 32768;105pub const MAX_PROPERTY_VALUE_LENGTH: u32 = 32768;
106pub const MAX_PROPERTIES_PER_ITEM: u32 = 64;106pub const MAX_PROPERTIES_PER_ITEM: u32 = 64;
107107
108// pub const MAX_PROPERTY_KEYS_OVERALL_LENGTH: u32 = MAX_PROPERTY_KEY_LENGTH * MAX_PROPERTIES_PER_ITEM;
109pub const MAX_COLLECTION_PROPERTIES_SIZE: u32 = 40960;108pub const MAX_COLLECTION_PROPERTIES_SIZE: u32 = 40960;
110pub const MAX_TOKEN_PROPERTIES_SIZE: u32 = 32768;109pub const MAX_TOKEN_PROPERTIES_SIZE: u32 = 32768;
111
112pub const MAX_COLLECTION_PROPERTIES_ENCODE_LEN: u32 =
113 MAX_PROPERTIES_PER_ITEM * MAX_PROPERTY_KEY_LENGTH + MAX_COLLECTION_PROPERTIES_SIZE;
114110
115// RMRK constants111// RMRK constants
116pub const RMRK_STRING_LIMIT: u32 = 128;112pub const RMRK_STRING_LIMIT: u32 = 128;
119pub const RMRK_KEY_LIMIT: u32 = 32;115pub const RMRK_KEY_LIMIT: u32 = 32;
120pub const RMRK_VALUE_LIMIT: u32 = 256;116pub const RMRK_VALUE_LIMIT: u32 = 256;
121
122pub struct MaxPropertiesPermissionsEncodeLen;
123
124impl Get<u32> for MaxPropertiesPermissionsEncodeLen {
125 fn get() -> u32 {
126 MAX_PROPERTIES_PER_ITEM * MAX_PROPERTY_KEY_LENGTH
127 + <PropertyPermission as MaxEncodedLen>::max_encoded_len() as u32
128 }
129}
130117
131/// How much items can be created per single118/// How much items can be created per single
132/// create_many call119/// create_many call
381}368}
382369
383pub type CollectionPropertiesPermissionsVec =370pub type CollectionPropertiesPermissionsVec =
384 BoundedVec<PropertyKeyPermission, MaxPropertiesPermissionsEncodeLen>;371 BoundedVec<PropertyKeyPermission, ConstU32<MAX_PROPERTIES_PER_ITEM>>;
385372
386pub type CollectionPropertiesVec =373pub type CollectionPropertiesVec =
387 BoundedVec<Property, ConstU32<MAX_COLLECTION_PROPERTIES_ENCODE_LEN>>;374 BoundedVec<Property, ConstU32<MAX_PROPERTIES_PER_ITEM>>;
388375
389/// All fields are wrapped in `Option`s, where None means chain default376/// All fields are wrapped in `Option`s, where None means chain default
390#[struct_versioning::versioned(version = 2, upper)]377#[struct_versioning::versioned(version = 2, upper)]