git.delta.rocks / unique-network / refs/commits / 7b6dca1f6320

difftreelog

fix PR

Trubnikov Sergey2023-03-10parent: #8df8e96.patch.diff
in: master

3 files changed

modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -520,8 +520,8 @@
 	/// @param tokenId The NFT to find the approved address for
 	/// @return The approved address for this NFT, or the zero address if there is none
 	fn get_approved(&self, token_id: U256) -> Result<Address> {
-		let token = token_id.try_into()?;
-		let operator = <Pallet<T>>::get_allowance(self, token).map_err(dispatch_to_evm::<T>)?;
+		let token_id = token_id.try_into()?;
+		let operator = <Pallet<T>>::get_allowance(self, token_id).map_err(dispatch_to_evm::<T>)?;
 		Ok(if let Some(operator) = operator {
 			*operator.as_eth()
 		} else {
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -1085,13 +1085,13 @@
 
 	pub fn get_allowance(
 		collection: &NonfungibleHandle<T>,
-		token: TokenId,
+		token_id: TokenId,
 	) -> Result<Option<T::CrossAccountId>, DispatchError> {
 		ensure!(
-			<TokenData<T>>::get((collection.id, token)).is_some(),
+			<TokenData<T>>::get((collection.id, token_id)).is_some(),
 			<CommonError<T>>::TokenNotFound
 		);
-		Ok(<Allowance<T>>::get((collection.id, token)))
+		Ok(<Allowance<T>>::get((collection.id, token_id)))
 	}
 
 	/// Set allowance for the spender to `transfer` or `burn` sender's token.
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
230 const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);230 const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
231231
232 {232 {
233 const badTokenId = 1234567;233 const badTokenId = await contract.methods.nextTokenId().call() + 1;
234 await expect(contract.methods.getApproved(badTokenId).call()).to.be.rejectedWith('revert TokenNotFound');234 await expect(contract.methods.getApproved(badTokenId).call()).to.be.rejectedWith('revert TokenNotFound');
235 }235 }
236 {236 {