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

difftreelog

fix Return erc721 instead erc20

Trubnikov Sergey2022-08-26parent: #fa9ccd7.patch.diff
in: master

2 files changed

modifiedpallets/refungible/src/erc_token.rsdiffbeforeafterboth
--- a/pallets/refungible/src/erc_token.rs
+++ b/pallets/refungible/src/erc_token.rs
@@ -32,13 +32,13 @@
 use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*, weight};
 use pallet_common::{
 	CommonWeightInfo,
-	erc::{CommonEvmHandler, PrecompileResult},
+	erc::{CommonEvmHandler, PrecompileResult}, eth::collection_id_to_address,
 };
 use pallet_evm::{account::CrossAccountId, PrecompileHandle};
 use pallet_evm_coder_substrate::{call, dispatch_to_evm, WithRecorder};
 use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};
 use sp_std::vec::Vec;
-use up_data_structs::{mapping::TokenAddressMapping, TokenId};
+use up_data_structs::TokenId;
 
 use crate::{
 	Allowance, Balance, common::CommonWeights, Config, Pallet, RefungibleHandle, SelfWeightOf,
@@ -51,7 +51,7 @@
 impl<T: Config> RefungibleTokenHandle<T> {
 	fn parent_token(&self) -> Result<address> {
 		self.consume_store_reads(2)?;
-		Ok(*T::CrossTokenAddressMapping::token_to_address(self.id, self.1).as_eth())
+		Ok(collection_id_to_address(self.id))
 	}
 
 	fn parent_token_id(&self) -> Result<uint256> {
modifiedtests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth
668668
669 const tokenAddress = await refungibleTokenContract.methods.parentToken().call();669 const tokenAddress = await refungibleTokenContract.methods.parentToken().call();
670 const tokenId = await refungibleTokenContract.methods.parentTokenId().call();670 const tokenId = await refungibleTokenContract.methods.parentTokenId().call();
671 expect(tokenAddress).to.be.equal(rftTokenAddress);671 expect(tokenAddress).to.be.equal(collectionIdAddress);
672 expect(tokenId).to.be.equal(refungibleTokenId);672 expect(tokenId).to.be.equal(refungibleTokenId);
673 });673 });
674});674});