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
32use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*, weight};32use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*, weight};
33use pallet_common::{33use pallet_common::{
34 CommonWeightInfo,34 CommonWeightInfo,
35 erc::{CommonEvmHandler, PrecompileResult},35 erc::{CommonEvmHandler, PrecompileResult}, eth::collection_id_to_address,
36};36};
37use pallet_evm::{account::CrossAccountId, PrecompileHandle};37use pallet_evm::{account::CrossAccountId, PrecompileHandle};
38use pallet_evm_coder_substrate::{call, dispatch_to_evm, WithRecorder};38use pallet_evm_coder_substrate::{call, dispatch_to_evm, WithRecorder};
39use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};39use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};
40use sp_std::vec::Vec;40use sp_std::vec::Vec;
41use up_data_structs::{mapping::TokenAddressMapping, TokenId};41use up_data_structs::TokenId;
4242
43use crate::{43use crate::{
44 Allowance, Balance, common::CommonWeights, Config, Pallet, RefungibleHandle, SelfWeightOf,44 Allowance, Balance, common::CommonWeights, Config, Pallet, RefungibleHandle, SelfWeightOf,
51impl<T: Config> RefungibleTokenHandle<T> {51impl<T: Config> RefungibleTokenHandle<T> {
52 fn parent_token(&self) -> Result<address> {52 fn parent_token(&self) -> Result<address> {
53 self.consume_store_reads(2)?;53 self.consume_store_reads(2)?;
54 Ok(*T::CrossTokenAddressMapping::token_to_address(self.id, self.1).as_eth())54 Ok(collection_id_to_address(self.id))
55 }55 }
5656
57 fn parent_token_id(&self) -> Result<uint256> {57 fn parent_token_id(&self) -> Result<uint256> {
modifiedtests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth
--- a/tests/src/eth/reFungibleToken.test.ts
+++ b/tests/src/eth/reFungibleToken.test.ts
@@ -668,7 +668,7 @@
 
     const tokenAddress = await refungibleTokenContract.methods.parentToken().call();
     const tokenId = await refungibleTokenContract.methods.parentTokenId().call();
-    expect(tokenAddress).to.be.equal(rftTokenAddress);
+    expect(tokenAddress).to.be.equal(collectionIdAddress);
     expect(tokenId).to.be.equal(refungibleTokenId);
   });
 });