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
10851085
1086 pub fn get_allowance(1086 pub fn get_allowance(
1087 collection: &NonfungibleHandle<T>,1087 collection: &NonfungibleHandle<T>,
1088 token: TokenId,1088 token_id: TokenId,
1089 ) -> Result<Option<T::CrossAccountId>, DispatchError> {1089 ) -> Result<Option<T::CrossAccountId>, DispatchError> {
1090 ensure!(1090 ensure!(
1091 <TokenData<T>>::get((collection.id, token)).is_some(),1091 <TokenData<T>>::get((collection.id, token_id)).is_some(),
1092 <CommonError<T>>::TokenNotFound1092 <CommonError<T>>::TokenNotFound
1093 );1093 );
1094 Ok(<Allowance<T>>::get((collection.id, token)))1094 Ok(<Allowance<T>>::get((collection.id, token_id)))
1095 }1095 }
10961096
1097 /// Set allowance for the spender to `transfer` or `burn` sender's token.1097 /// Set allowance for the spender to `transfer` or `burn` sender's token.
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -230,7 +230,7 @@
     const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
 
     {
-      const badTokenId = 1234567;
+      const badTokenId = await contract.methods.nextTokenId().call() + 1;
       await expect(contract.methods.getApproved(badTokenId).call()).to.be.rejectedWith('revert TokenNotFound');
     }
     {