git.delta.rocks / unique-network / refs/commits / 35f0b49c19be

difftreelog

style reformat code

Yaroslav Bolyukin2021-06-02parent: #6bc566c.patch.diff
in: master

3 files changed

modifiedpallets/nft/Cargo.tomldiffbeforeafterboth
--- a/pallets/nft/Cargo.toml
+++ b/pallets/nft/Cargo.toml
@@ -42,7 +42,7 @@
 rlp = { default-features = false, version = "0.5.0" }
 
 evm-coder = { default-features = false, path = "../../crates/evm-coder" }
-primitive-types = { version = "0.9.0", default-features = false }
+primitive-types = { version = "0.9.0", default-features = false, features = ["serde_no_std"] }
 
 hex-literal = "0.3.1"
 
modifiedpallets/nft/src/eth/account.rsdiffbeforeafterboth
1use crate::Config;1use crate::Config;
2use codec::{Encode, EncodeLike, Decode};2use codec::{Encode, EncodeLike, Decode};
3use sp_core::{H160, H256, crypto::AccountId32};3use sp_core::crypto::AccountId32;
4use primitive_types::H160;
4use core::cmp::Ordering;5use core::cmp::Ordering;
5use serde::{Serialize, Deserialize};6use serde::{Serialize, Deserialize};
6use pallet_evm::AddressMapping;7use pallet_evm::AddressMapping;
modifiedpallets/nft/src/eth/mod.rsdiffbeforeafterboth
--- a/pallets/nft/src/eth/mod.rs
+++ b/pallets/nft/src/eth/mod.rs
@@ -1,25 +1,31 @@
 pub mod account;
-use account::CrossAccountId;
-pub mod abi;
-use abi::{AbiReader, AbiWriter};
+pub mod erc;
+mod erc_impl;
 pub mod log;
+pub mod sponsoring;
 
+use evm_coder::abi::AbiWriter;
+use evm_coder::abi::StringError;
+use sp_std::prelude::*;
 use sp_std::borrow::ToOwned;
 use sp_std::vec::Vec;
-use sp_std::convert::TryInto;
 
-use codec::{Decode, Encode};
-use pallet_evm::{AddressMapping, PrecompileLog, PrecompileOutput, ExitReason, ExitRevert, ExitSucceed};
-use sp_core::{H160, H256};
-use frame_support::storage::{StorageMap, StorageDoubleMap};
+use pallet_evm::{PrecompileOutput, ExitReason, ExitRevert, ExitSucceed};
+use sp_core::{H160, U256};
+use frame_support::storage::StorageMap;
+
+use crate::{Config, CollectionById, CollectionHandle, CollectionId, CollectionMode};
 
-use crate::{Allowances, NftItemList, Module, Balance, Config, CollectionById, CollectionHandle, CollectionId, CollectionMode};
+use erc::{UniqueFungible, UniqueFungibleCall, UniqueNFT, UniqueNFTCall};
+use evm_coder::{types::*, abi::AbiReader};
 
 pub struct NftErcSupport<T: Config>(core::marker::PhantomData<T>);
 
 // 0x17c4e6453Cc49AAAaEACA894e6D9683e00000001 - collection
 // TODO: Unhardcode prefix
-const ETH_ACCOUNT_PREFIX: [u8; 16] = [0x17, 0xc4, 0xe6, 0x45, 0x3c, 0xc4, 0x9a, 0xaa, 0xae, 0xac, 0xa8, 0x94, 0xe6, 0xd9, 0x68, 0x3e];
+const ETH_ACCOUNT_PREFIX: [u8; 16] = [
+	0x17, 0xc4, 0xe6, 0x45, 0x3c, 0xc4, 0x9a, 0xaa, 0xae, 0xac, 0xa8, 0x94, 0xe6, 0xd9, 0x68, 0x3e,
+];
 
 fn map_eth_to_id(eth: &H160) -> Option<CollectionId> {
 	if &eth[0..16] != ETH_ACCOUNT_PREFIX {
@@ -113,7 +119,8 @@
 					CollectionMode::Fungible(_) => include_bytes!("stubs/ERC20.bin") as &[u8],
 					CollectionMode::ReFungible => include_bytes!("stubs/ERC1633.bin") as &[u8],
 					CollectionMode::Invalid => include_bytes!("stubs/Invalid.bin") as &[u8],
-				}.to_owned()
+				}
+				.to_owned()
 			})
 	}
 	fn call(
@@ -162,17 +169,20 @@
 			gas: 0.into(),
 			// zero selector, this transaction always have same sender, so all data should be acquired from logs
 			data: Vec::from([0, 0, 0, 0]),
-		}.sign(
+		}
+		.sign(
 			// TODO: move to pallet config
 			// 0xF70631E55faff9f3FD3681545aa6c724226a3853
 			// 9dbaef9b3ebc00e53f67c6a77bcfbf2c4f2aebe4d70d94af4f2df01744b7a91a
-			&hex_literal::hex!("9dbaef9b3ebc00e53f67c6a77bcfbf2c4f2aebe4d70d94af4f2df01744b7a91a").into(),
-			&chain_id
+			&hex_literal::hex!("9dbaef9b3ebc00e53f67c6a77bcfbf2c4f2aebe4d70d94af4f2df01744b7a91a")
+				.into(),
+			&chain_id,
 		);
-		rlp::decode::<ethereum::Transaction>(&signed).expect("transaction is just created, it can't be broken")
+		rlp::decode::<ethereum::Transaction>(&signed)
+			.expect("transaction is just created, it can't be broken")
 	}
 	#[cfg(not(feature = "std"))]
 	{
 		panic!("transaction generation not yet supported by wasm runtime")
 	}
-}
\ No newline at end of file
+}