difftreelog
refactor rename structure dispatch* fns
in: master
4 files changed
pallets/fungible/src/lib.rsdiffbeforeafterboth236236237 // =========237 // =========238238239 <PalletStructure<T>>::try_nest_if_sent_to_token(239 <PalletStructure<T>>::nest_if_sent_to_token(240 from.clone(),240 from.clone(),241 to,241 to,242 collection.id,242 collection.id,320 <TotalSupply<T>>::insert(collection.id, total_supply);320 <TotalSupply<T>>::insert(collection.id, total_supply);321 for (user, amount) in balances {321 for (user, amount) in balances {322 <Balance<T>>::insert((collection.id, &user), amount);322 <Balance<T>>::insert((collection.id, &user), amount);323 <PalletStructure<T>>::nest_if_sent_to_token(&user, collection.id, TokenId::default());323 <PalletStructure<T>>::nest_if_sent_to_token_unchecked(&user, collection.id, TokenId::default());324 <PalletEvm<T>>::deposit_log(324 <PalletEvm<T>>::deposit_log(325 ERC20Events::Transfer {325 ERC20Events::Transfer {326 from: H160::default(),326 from: H160::default(),pallets/nonfungible/src/lib.rsdiffbeforeafterboth585 None585 None586 };586 };587587588 <PalletStructure<T>>::try_nest_if_sent_to_token(588 <PalletStructure<T>>::nest_if_sent_to_token(589 from.clone(),589 from.clone(),590 to,590 to,591 collection.id,591 collection.id,704 },704 },705 );705 );706706707 <PalletStructure<T>>::nest_if_sent_to_token(&data.owner, collection.id, TokenId(token));707 <PalletStructure<T>>::nest_if_sent_to_token_unchecked(&data.owner, collection.id, TokenId(token));708708709 if let Err(e) = Self::set_token_properties(709 if let Err(e) = Self::set_token_properties(710 collection,710 collection,pallets/refungible/src/lib.rsdiffbeforeafterboth375375376 // =========376 // =========377377378 <PalletStructure<T>>::try_nest_if_sent_to_token(378 <PalletStructure<T>>::nest_if_sent_to_token(379 from.clone(),379 from.clone(),380 to,380 to,381 collection.id,381 collection.id,518 }518 }519 <Balance<T>>::insert((collection.id, token_id, &user), amount);519 <Balance<T>>::insert((collection.id, token_id, &user), amount);520 <Owned<T>>::insert((collection.id, &user, TokenId(token_id)), true);520 <Owned<T>>::insert((collection.id, &user, TokenId(token_id)), true);521 <PalletStructure<T>>::nest_if_sent_to_token(&user, collection.id, TokenId(token_id));521 <PalletStructure<T>>::nest_if_sent_to_token_unchecked(&user, collection.id, TokenId(token_id));522522523 // TODO: ERC20 transfer event523 // TODO: ERC20 transfer event524 <PalletCommon<T>>::deposit_event(CommonEvent::ItemCreated(524 <PalletCommon<T>>::deposit_event(CommonEvent::ItemCreated(pallets/structure/src/lib.rsdiffbeforeafterboth191 token_id: TokenId,191 token_id: TokenId,192 nesting_budget: &dyn Budget192 nesting_budget: &dyn Budget193 ) -> DispatchResult {193 ) -> DispatchResult {194 Self::try_dispatched(194 Self::try_exec_if_owner_is_valid_nft(195 under,195 under,196 |d, parent_id| d.check_nesting(196 |d, parent_id| d.check_nesting(197 from,197 from,202 )202 )203 }203 }204204205 pub fn try_nest_if_sent_to_token(205 pub fn nest_if_sent_to_token(206 from: T::CrossAccountId,206 from: T::CrossAccountId,207 under: &T::CrossAccountId,207 under: &T::CrossAccountId,208 collection_id: CollectionId,208 collection_id: CollectionId,209 token_id: TokenId,209 token_id: TokenId,210 nesting_budget: &dyn Budget210 nesting_budget: &dyn Budget211 ) -> DispatchResult {211 ) -> DispatchResult {212 Self::try_dispatched(212 Self::try_exec_if_owner_is_valid_nft(213 under,213 under,214 |d, parent_id| {214 |d, parent_id| {215 d.check_nesting(215 d.check_nesting(226 )226 )227 }227 }228228229 pub fn nest_if_sent_to_token(229 pub fn nest_if_sent_to_token_unchecked(230 owner: &T::CrossAccountId,230 owner: &T::CrossAccountId,231 collection_id: CollectionId,231 collection_id: CollectionId,232 token_id: TokenId232 token_id: TokenId233 ) {233 ) {234 Self::dispatched(234 Self::exec_if_owner_is_valid_nft(235 owner,235 owner,236 |d, parent_id| d.nest(236 |d, parent_id| d.nest(237 parent_id,237 parent_id,245 collection_id: CollectionId,245 collection_id: CollectionId,246 token_id: TokenId246 token_id: TokenId247 ) {247 ) {248 Self::dispatched(248 Self::exec_if_owner_is_valid_nft(249 owner,249 owner,250 |d, parent_id| d.unnest(250 |d, parent_id| d.unnest(251 parent_id,251 parent_id,254 );254 );255 }255 }256256257 fn dispatched(257 fn exec_if_owner_is_valid_nft(258 account: &T::CrossAccountId,258 account: &T::CrossAccountId,259 action: impl FnOnce(&dyn CommonCollectionOperations<T>, TokenId)259 action: impl FnOnce(&dyn CommonCollectionOperations<T>, TokenId)260 ) {260 ) {261 Self::try_dispatched(261 Self::try_exec_if_owner_is_valid_nft(262 account,262 account,263 |d, id| {263 |d, id| {264 action(d, id);264 action(d, id);267 ).unwrap();267 ).unwrap();268 }268 }269269270 fn try_dispatched(270 fn try_exec_if_owner_is_valid_nft(271 account: &T::CrossAccountId,271 account: &T::CrossAccountId,272 action: impl FnOnce(&dyn CommonCollectionOperations<T>, TokenId) -> DispatchResult272 action: impl FnOnce(&dyn CommonCollectionOperations<T>, TokenId) -> DispatchResult273 ) -> DispatchResult {273 ) -> DispatchResult {