difftreelog
NFTPAR-142: Off-chain and on-chain data schema. Error messages.
in: master
1 file changed
pallets/nft/src/lib.rsdiffbeforeafterboth264decl_error! {264decl_error! {265 /// Error for non-fungible-token module.265 /// Error for non-fungible-token module.266 pub enum Error for Module<T: Trait> {266 pub enum Error for Module<T: Trait> {267 /// Total collections bound exceeded267 /// Total collections bound exceeded.268 TotalCollectionsLimitExceeded,268 TotalCollectionsLimitExceeded,269 /// Decimal_points parameter must be lower than 4269 /// Decimal_points parameter must be lower than 4.270 CollectionDecimalPointLimitExceeded, 270 CollectionDecimalPointLimitExceeded, 271 /// Collection name can not be longer than 63 char271 /// Collection name can not be longer than 63 char.272 CollectionNameLimitExceeded, 272 CollectionNameLimitExceeded, 273 /// Collection description can not be longer than 255 char273 /// Collection description can not be longer than 255 char.274 CollectionDescriptionLimitExceeded, 274 CollectionDescriptionLimitExceeded, 275 /// Token prefix can not be longer than 15 char275 /// Token prefix can not be longer than 15 char.276 CollectionTokenPrefixLimitExceeded,276 CollectionTokenPrefixLimitExceeded,277 /// This collection does not exist277 /// This collection does not exist.278 CollectionNotFound,278 CollectionNotFound,279 /// Item not exists279 /// Item not exists.280 TokenNotFound,280 TokenNotFound,281 /// Arithmetic calculation overflow281 /// Arithmetic calculation overflow.282 NumOverflow, 282 NumOverflow, 283 /// Account already has admin role283 /// Account already has admin role.284 AlreadyAdmin, 284 AlreadyAdmin, 285 /// You do not own this collection285 /// You do not own this collection.286 NoPermission,286 NoPermission,287 /// This address is not set as sponsor, use setCollectionSponsor first287 /// This address is not set as sponsor, use setCollectionSponsor first.288 ConfirmUnsetSponsorFail,288 ConfirmUnsetSponsorFail,289 /// Collection is not in mint mode289 /// Collection is not in mint mode.290 PublicMintingNotAllowed,290 PublicMintingNotAllowed,291 /// Sender parameter and item owner must be equal291 /// Sender parameter and item owner must be equal.292 MustBeTokenOwner,292 MustBeTokenOwner,293 /// Item balance not enouth293 /// Item balance not enough.294 TokenValueTooLow,294 TokenValueTooLow,295 /// Size of item is too large295 /// Size of item is too large.296 NftSizeLimitExceeded,296 NftSizeLimitExceeded,297 /// Size of item must be 0 with fungible type298 FungibleUnexpectedParam,299 /// No approve found297 /// No approve found300 ApproveNotFound,298 ApproveNotFound,301 /// Requested value more than approved299 /// Requested value more than approved.302 TokenValueNotEnough,300 TokenValueNotEnough,303 /// Only approved addresses can call this method301 /// Only approved addresses can call this method.304 ApproveRequired,302 ApproveRequired,305 /// Address is not in white list303 /// Address is not in white list.306 AddresNotInWhiteList,304 AddresNotInWhiteList,307 /// Number of collection admins bound exceeded305 /// Number of collection admins bound exceeded.308 CollectionAdminsLimitExceeded,306 CollectionAdminsLimitExceeded,309 /// Owned tokens by a single address bound exceeded307 /// Owned tokens by a single address bound exceeded.310 AddressOwnershipLimitExceeded,308 AddressOwnershipLimitExceeded,311 /// Length of items properties must be greater than 0309 /// Length of items properties must be greater than 0.312 EmptyArgument,310 EmptyArgument,311 /// const_data exceeded data limit.312 TokenConstDataLimitExceeded,313 /// variable_data exceeded data limit.314 TokenVariableDataLimitExceeded,315 /// Not NFT item data used to mint in NFT collection.316 NotNftDataUsedToMintNftCollectionToken,317 /// Not Fungible item data used to mint in Fungible collection.318 NotFungibleDataUsedToMintFungibleCollectionToken,319 /// Not Re Fungible item data used to mint in Re Fungible collection.320 NotReFungibleDataUsedToMintReFungibleCollectionToken,321 /// Unexpected collection type.322 UnexpectedCollectionType,323 /// Can't store metadata in fungible tokens.324 CantSotreMetadataInFungibleTokens313 }325 }314}326}3153271192 {1204 {1193 CollectionMode::NFT => Self::set_nft_variable_data(collection_id, item_id, data)?,1205 CollectionMode::NFT => Self::set_nft_variable_data(collection_id, item_id, data)?,1194 CollectionMode::ReFungible(_) => Self::set_re_fungible_variable_data(collection_id, item_id, data)?,1206 CollectionMode::ReFungible(_) => Self::set_re_fungible_variable_data(collection_id, item_id, data)?,1195 CollectionMode::Fungible(_) => fail!("Can't store metadata in fungible tokens."),1207 CollectionMode::Fungible(_) => fail!(Error::<T>::CantSotreMetadataInFungibleTokens),1196 _ => fail!("Unexpected collection type.")1208 _ => fail!(Error::<T>::UnexpectedCollectionType)1197 };1209 };119812101199 Ok(())1211 Ok(())1346 CollectionMode::NFT => {1357 CollectionMode::NFT => {1347 if let CreateItemData::NFT(data) = data {1358 if let CreateItemData::NFT(data) = data {1348 // check sizes1359 // check sizes1349 ensure!(ChainLimit::get().custom_data_limit >= data.const_data.len() as u32, "const_data exceeded data limit.");1360 ensure!(ChainLimit::get().custom_data_limit >= data.const_data.len() as u32, Error::<T>::TokenConstDataLimitExceeded);1350 ensure!(ChainLimit::get().custom_data_limit >= data.variable_data.len() as u32, "variable_data exceeded data limit.");1361 ensure!(ChainLimit::get().custom_data_limit >= data.variable_data.len() as u32, Error::<T>::TokenVariableDataLimitExceeded);1351 } else {1362 } else {1352 fail!("Not NFT item data used to mint in NFT collection.");1363 fail!(Error::<T>::NotNftDataUsedToMintNftCollectionToken);1353 }1364 }1354 },1365 },1355 CollectionMode::Fungible(_) => {1366 CollectionMode::Fungible(_) => {1356 if let CreateItemData::Fungible(_) = data {1367 if let CreateItemData::Fungible(_) = data {1357 } else {1368 } else {1358 fail!("Not Fungible item data used to mint in Fungible collection.");1369 fail!(Error::<T>::NotFungibleDataUsedToMintFungibleCollectionToken);1359 }1370 }1360 },1371 },1361 CollectionMode::ReFungible(_) => {1372 CollectionMode::ReFungible(_) => {1362 if let CreateItemData::ReFungible(data) = data {1373 if let CreateItemData::ReFungible(data) = data {136313741364 // check sizes1375 // check sizes1365 ensure!(ChainLimit::get().custom_data_limit >= data.const_data.len() as u32, "const_data exceeded data limit.");1376 ensure!(ChainLimit::get().custom_data_limit >= data.const_data.len() as u32, Error::<T>::TokenConstDataLimitExceeded);1366 ensure!(ChainLimit::get().custom_data_limit >= data.variable_data.len() as u32, "variable_data exceeded data limit.");1377 ensure!(ChainLimit::get().custom_data_limit >= data.variable_data.len() as u32, Error::<T>::TokenVariableDataLimitExceeded);1367 } else {1378 } else {1368 fail!("Not Re Fungible item data used to mint in Re Fungible collection.");1379 fail!(Error::<T>::NotReFungibleDataUsedToMintReFungibleCollectionToken);1369 }1380 }1370 },1381 },1371 _ => { fail!("Unexpected collection type."); }1382 _ => { fail!(Error::<T>::UnexpectedCollectionType); }1372 };1383 };137313841374 Ok(())1385 Ok(())