difftreelog
Merge pull request #275 from UniqueNetwork/feature/CORE-262
in: master
7 files changed
pallets/common/src/lib.rsdiffbeforeafterboth307 /// Item balance not enough.307 /// Item balance not enough.308 TokenValueTooLow,308 TokenValueTooLow,309 /// Requested value more than approved.309 /// Requested value more than approved.310 TokenValueNotEnough,310 ApprovedValueTooLow,311 /// Tried to approve more than owned311 /// Tried to approve more than owned312 CantApproveMoreThanOwned,312 CantApproveMoreThanOwned,313313pallets/fungible/src/lib.rsdiffbeforeafterboth223use core::ops::Deref;3use core::ops::Deref;4use frame_support::{ensure};4use frame_support::{ensure};5use up_data_structs::{AccessMode, Collection, CollectionId, TokenId, CreateCollectionData};5use up_data_structs::{AccessMode, CollectionId, TokenId, CreateCollectionData};6use pallet_common::{6use pallet_common::{7 Error as CommonError, Event as CommonEvent, Pallet as PalletCommon, account::CrossAccountId,7 Error as CommonError, Event as CommonEvent, Pallet as PalletCommon, account::CrossAccountId,8};8};346 if allowance.is_none() {346 if allowance.is_none() {347 ensure!(347 ensure!(348 collection.ignores_allowance(spender),348 collection.ignores_allowance(spender),349 <CommonError<T>>::TokenValueNotEnough349 <CommonError<T>>::ApprovedValueTooLow350 );350 );351 }351 }352352377 if allowance.is_none() {377 if allowance.is_none() {378 ensure!(378 ensure!(379 collection.ignores_allowance(spender),379 collection.ignores_allowance(spender),380 <CommonError<T>>::TokenValueNotEnough380 <CommonError<T>>::ApprovedValueTooLow381 );381 );382 }382 }383383pallets/nonfungible/src/lib.rsdiffbeforeafterboth3use erc::ERC721Events;3use erc::ERC721Events;4use frame_support::{BoundedVec, ensure};4use frame_support::{BoundedVec, ensure};5use up_data_structs::{5use up_data_structs::{AccessMode, CollectionId, CustomDataLimit, TokenId, CreateCollectionData};6 AccessMode, Collection, CollectionId, CustomDataLimit, TokenId, CreateCollectionData,7};8use pallet_common::{6use pallet_common::{9 Error as CommonError, Pallet as PalletCommon, Event as CommonEvent, account::CrossAccountId,7 Error as CommonError, Pallet as PalletCommon, Event as CommonEvent, account::CrossAccountId,497 if <Allowance<T>>::get((collection.id, token)).as_ref() != Some(spender) {495 if <Allowance<T>>::get((collection.id, token)).as_ref() != Some(spender) {498 ensure!(496 ensure!(499 collection.ignores_allowance(spender),497 collection.ignores_allowance(spender),500 <CommonError<T>>::TokenValueNotEnough498 <CommonError<T>>::ApprovedValueTooLow501 );499 );502 }500 }503501525 if <Allowance<T>>::get((collection.id, token)).as_ref() != Some(spender) {523 if <Allowance<T>>::get((collection.id, token)).as_ref() != Some(spender) {526 ensure!(524 ensure!(527 collection.ignores_allowance(spender),525 collection.ignores_allowance(spender),528 <CommonError<T>>::TokenValueNotEnough526 <CommonError<T>>::ApprovedValueTooLow529 );527 );530 }528 }531529pallets/refungible/src/lib.rsdiffbeforeafterboth223use frame_support::{ensure, BoundedVec};3use frame_support::{ensure, BoundedVec};4use up_data_structs::{4use up_data_structs::{5 AccessMode, Collection, CollectionId, CustomDataLimit, MAX_REFUNGIBLE_PIECES, TokenId,5 AccessMode, CollectionId, CustomDataLimit, MAX_REFUNGIBLE_PIECES, TokenId, CreateCollectionData,6 CreateCollectionData,7};6};8use pallet_common::{7use pallet_common::{532 if allowance.is_none() {531 if allowance.is_none() {533 ensure!(532 ensure!(534 collection.ignores_allowance(spender),533 collection.ignores_allowance(spender),535 <CommonError<T>>::TokenValueNotEnough534 <CommonError<T>>::ApprovedValueTooLow536 );535 );537 }536 }538537565 if allowance.is_none() {564 if allowance.is_none() {566 ensure!(565 ensure!(567 collection.ignores_allowance(spender),566 collection.ignores_allowance(spender),568 <CommonError<T>>::TokenValueNotEnough567 <CommonError<T>>::ApprovedValueTooLow569 );568 );570 }569 }571570pallets/unique/src/lib.rsdiffbeforeafterboth38use up_data_structs::{38use up_data_structs::{39 MAX_DECIMAL_POINTS, VARIABLE_ON_CHAIN_SCHEMA_LIMIT, CONST_ON_CHAIN_SCHEMA_LIMIT,39 MAX_DECIMAL_POINTS, VARIABLE_ON_CHAIN_SCHEMA_LIMIT, CONST_ON_CHAIN_SCHEMA_LIMIT,40 OFFCHAIN_SCHEMA_LIMIT, MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_DESCRIPTION_LENGTH,40 OFFCHAIN_SCHEMA_LIMIT, MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_DESCRIPTION_LENGTH,41 MAX_TOKEN_PREFIX_LENGTH, AccessMode, Collection, CreateItemData, CollectionLimits,41 MAX_TOKEN_PREFIX_LENGTH, AccessMode, CreateItemData, CollectionLimits, CollectionId,42 CollectionId, CollectionMode, TokenId, SchemaVersion, SponsorshipState, MetaUpdatePermission,42 CollectionMode, TokenId, SchemaVersion, SponsorshipState, MetaUpdatePermission,43 CreateCollectionData, CustomDataLimit,43 CreateCollectionData, CustomDataLimit,44};44};pallets/unique/src/tests.rsdiffbeforeafterboth601 1601 1602 )602 )603 .map_err(|e| e.error),603 .map_err(|e| e.error),604 CommonError::<Test>::TokenValueNotEnough604 CommonError::<Test>::ApprovedValueTooLow605 );605 );606606607 // do approve607 // do approve916 4916 4917 )917 )918 .map_err(|e| e.error),918 .map_err(|e| e.error),919 CommonError::<Test>::TokenValueNotEnough919 CommonError::<Test>::ApprovedValueTooLow920 );920 );921 });921 });922}922}tests/src/interfaces/augment-api-errors.tsdiffbeforeafterboth115 /**115 /**116 * Requested value more than approved.116 * Requested value more than approved.117 **/117 **/118 TokenValueNotEnough: AugmentedError<ApiType>;118 ApprovedValueTooLow: AugmentedError<ApiType>;119 /**119 /**120 * Item balance not enough.120 * Item balance not enough.121 **/121 **/