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

difftreelog

Public storage

str-mv2021-11-22parent: #946ee50.patch.diff
in: master

3 files changed

modifiedpallets/nft/src/sponsorship.rsdiffbeforeafterboth
14 REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, TokenId,14 REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, TokenId,
15};15};
16use pallet_common::{CollectionHandle};16use pallet_common::{CollectionHandle};
17use pallet_common::account::CrossAccountId;
1718
18pub fn withdraw_transfer<T: Config>(19pub fn withdraw_transfer<T: Config>(
19 collection: &CollectionHandle<T>,20 collection: &CollectionHandle<T>,
20 who: &T::AccountId,21 who: &T::AccountId,
21 item_id: &TokenId,22 item_id: &TokenId,
22) -> Option<()> {23) -> Option<()> {
24
25 // preliminary sponsoring correctness check
26 if !((pallet_nonfungible::TokenData::<T>::get((collection.id, item_id))?.owner).as_sub()
27 == who) || (pallet_refungible::Owned::<T>::get((
28 collection.id,
29 T::CrossAccountId::from_sub(who.clone()),
30 item_id,
31 ))) {
32 return None;
33 }
34
23 // sponsor timeout35 // sponsor timeout
24 let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;36 let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;
90}102}
91103
92pub fn withdraw_set_variable_meta_data<T: Config>(104pub fn withdraw_set_variable_meta_data<T: Config>(
105 who: &T::AccountId,
93 collection: &CollectionHandle<T>,106 collection: &CollectionHandle<T>,
94 item_id: &TokenId,107 item_id: &TokenId,
95 data: &[u8],108 data: &[u8],
96) -> Option<()> {109) -> Option<()> {
110
111 // preliminary sponsoring correctness check
112 if !((pallet_nonfungible::TokenData::<T>::get((collection.id, item_id))?.owner).as_sub()
113 == who) || (pallet_refungible::Owned::<T>::get((
114 collection.id,
115 T::CrossAccountId::from_sub(who.clone()),
116 item_id,
117 ))) {
118 return None;
119 }
120
97 // Can't sponsor fungible collection, this tx will be rejected121 // Can't sponsor fungible collection, this tx will be rejected
98 // as invalid122 // as invalid
204 data,228 data,
205 } => {229 } => {
206 let (sponsor, collection) = load(*collection_id)?;230 let (sponsor, collection) = load(*collection_id)?;
207 withdraw_set_variable_meta_data::<T>(&collection, item_id, data).map(|()| sponsor)231 withdraw_set_variable_meta_data::<T>(&who, &collection, item_id, data).map(|()| sponsor)
208 }232 }
209 _ => None,233 _ => None,
210 }234 }
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -58,18 +58,18 @@
 	}
 
 	#[pallet::pallet]
-	#[pallet::generate_store(pub(super) trait Store)]
+	#[pallet::generate_store(pub trait Store)]
 	pub struct Pallet<T>(_);
 
 	#[pallet::storage]
-	pub(super) type TokensMinted<T: Config> =
+	pub type TokensMinted<T: Config> =
 		StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
 	#[pallet::storage]
-	pub(super) type TokensBurnt<T: Config> =
+	pub type TokensBurnt<T: Config> =
 		StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
 
 	#[pallet::storage]
-	pub(super) type TokenData<T: Config> = StorageNMap<
+	pub type TokenData<T: Config> = StorageNMap<
 		Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
 		Value = ItemData<T>,
 		QueryKind = OptionQuery,
@@ -77,7 +77,7 @@
 
 	/// Used to enumerate tokens owned by account
 	#[pallet::storage]
-	pub(super) type Owned<T: Config> = StorageNMap<
+	pub type Owned<T: Config> = StorageNMap<
 		Key = (
 			Key<Twox64Concat, CollectionId>,
 			Key<Blake2_128Concat, T::CrossAccountId>,
@@ -88,7 +88,7 @@
 	>;
 
 	#[pallet::storage]
-	pub(super) type AccountBalance<T: Config> = StorageNMap<
+	pub type AccountBalance<T: Config> = StorageNMap<
 		Key = (
 			Key<Twox64Concat, CollectionId>,
 			Key<Blake2_128Concat, T::CrossAccountId>,
@@ -98,7 +98,7 @@
 	>;
 
 	#[pallet::storage]
-	pub(super) type Allowance<T: Config> = StorageNMap<
+	pub type Allowance<T: Config> = StorageNMap<
 		Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
 		Value = T::CrossAccountId,
 		QueryKind = OptionQuery,
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -54,25 +54,25 @@
 	}
 
 	#[pallet::pallet]
-	#[pallet::generate_store(pub(super) trait Store)]
+	#[pallet::generate_store(pub trait Store)]
 	pub struct Pallet<T>(_);
 
 	#[pallet::storage]
-	pub(super) type TokensMinted<T: Config> =
+	pub type TokensMinted<T: Config> =
 		StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
 	#[pallet::storage]
-	pub(super) type TokensBurnt<T: Config> =
+	pub type TokensBurnt<T: Config> =
 		StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
 
 	#[pallet::storage]
-	pub(super) type TokenData<T: Config> = StorageNMap<
+	pub type TokenData<T: Config> = StorageNMap<
 		Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
 		Value = ItemData,
 		QueryKind = ValueQuery,
 	>;
 
 	#[pallet::storage]
-	pub(super) type TotalSupply<T: Config> = StorageNMap<
+	pub type TotalSupply<T: Config> = StorageNMap<
 		Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
 		Value = u128,
 		QueryKind = ValueQuery,
@@ -80,7 +80,7 @@
 
 	/// Used to enumerate tokens owned by account
 	#[pallet::storage]
-	pub(super) type Owned<T: Config> = StorageNMap<
+	pub type Owned<T: Config> = StorageNMap<
 		Key = (
 			Key<Twox64Concat, CollectionId>,
 			Key<Blake2_128Concat, T::CrossAccountId>,
@@ -91,7 +91,7 @@
 	>;
 
 	#[pallet::storage]
-	pub(super) type AccountBalance<T: Config> = StorageNMap<
+	pub type AccountBalance<T: Config> = StorageNMap<
 		Key = (
 			Key<Twox64Concat, CollectionId>,
 			// Owner
@@ -102,7 +102,7 @@
 	>;
 
 	#[pallet::storage]
-	pub(super) type Balance<T: Config> = StorageNMap<
+	pub type Balance<T: Config> = StorageNMap<
 		Key = (
 			Key<Twox64Concat, CollectionId>,
 			Key<Twox64Concat, TokenId>,
@@ -114,7 +114,7 @@
 	>;
 
 	#[pallet::storage]
-	pub(super) type Allowance<T: Config> = StorageNMap<
+	pub type Allowance<T: Config> = StorageNMap<
 		Key = (
 			Key<Twox64Concat, CollectionId>,
 			Key<Twox64Concat, TokenId>,