difftreelog
fix handle sponsoring for ERC721Mintable
in: master
2 files changed
pallets/unique/src/eth/sponsoring.rsdiffbeforeafterboth29use pallet_common::account::CrossAccountId;29use pallet_common::account::CrossAccountId;303031use pallet_nonfungible::erc::{UniqueNFTCall, ERC721UniqueExtensionsCall, ERC721Call};31use pallet_nonfungible::erc::{32 UniqueNFTCall, ERC721UniqueExtensionsCall, ERC721MintableCall, ERC721Call,33};32use pallet_fungible::erc::{UniqueFungibleCall, ERC20Call};34use pallet_fungible::erc::{UniqueFungibleCall, ERC20Call};333551 let token_id: TokenId = token_id.try_into().ok()?;53 let token_id: TokenId = token_id.try_into().ok()?;52 withdraw_transfer::<T>(&collection, &who, &token_id).map(|()| sponsor)54 withdraw_transfer::<T>(&collection, &who, &token_id).map(|()| sponsor)53 }55 }56 UniqueNFTCall::ERC721Mintable(57 ERC721MintableCall::Mint { token_id, .. }58 | ERC721MintableCall::MintWithTokenUri { token_id, .. },59 ) => {60 let _token_id: TokenId = token_id.try_into().ok()?;61 withdraw_create_item::<T>(62 &collection,63 who.as_sub(),64 &CreateItemData::NFT(CreateNftData::default()),65 )66 .map(|()| sponsor)67 }54 UniqueNFTCall::ERC721(ERC721Call::TransferFrom { token_id, from, .. }) => {68 UniqueNFTCall::ERC721(ERC721Call::TransferFrom { token_id, from, .. }) => {55 let token_id: TokenId = token_id.try_into().ok()?;69 let token_id: TokenId = token_id.try_into().ok()?;56 let from = T::CrossAccountId::from_eth(from);70 let from = T::CrossAccountId::from_eth(from);pallets/unique/src/sponsorship.rsdiffbeforeafterboth--- a/pallets/unique/src/sponsorship.rs
+++ b/pallets/unique/src/sponsorship.rs
@@ -103,7 +103,7 @@
pub fn withdraw_create_item<T: Config>(
collection: &CollectionHandle<T>,
- who: &T::AccountId,
+ who: &T::CrossAccountId,
_properties: &CreateItemData,
) -> Option<()> {
if _properties.data_size() as u32 > collection.limits.sponsored_data_size() {
@@ -120,14 +120,14 @@
CreateItemData::ReFungible(_) => REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,
});
- if let Some(last_tx_block) = <CreateItemBasket<T>>::get((collection.id, &who)) {
+ if let Some(last_tx_block) = <CreateItemBasket<T>>::get((collection.id, who.as_sub())) {
let timeout = last_tx_block + limit.into();
if block_number < timeout {
return None;
}
}
- CreateItemBasket::<T>::insert((collection.id, who.clone()), block_number);
+ CreateItemBasket::<T>::insert((collection.id, who.as_sub()), block_number);
Some(())
}