difftreelog
style reformat code
in: master
3 files changed
pallets/nft/Cargo.tomldiffbeforeafterboth42rlp = { default-features = false, version = "0.5.0" }42rlp = { default-features = false, version = "0.5.0" }434344evm-coder = { default-features = false, path = "../../crates/evm-coder" }44evm-coder = { default-features = false, path = "../../crates/evm-coder" }45primitive-types = { version = "0.9.0", default-features = false }45primitive-types = { version = "0.9.0", default-features = false, features = ["serde_no_std"] }464647hex-literal = "0.3.1"47hex-literal = "0.3.1"4848pallets/nft/src/eth/account.rsdiffbeforeafterboth--- a/pallets/nft/src/eth/account.rs
+++ b/pallets/nft/src/eth/account.rs
@@ -1,6 +1,7 @@
use crate::Config;
use codec::{Encode, EncodeLike, Decode};
-use sp_core::{H160, H256, crypto::AccountId32};
+use sp_core::crypto::AccountId32;
+use primitive_types::H160;
use core::cmp::Ordering;
use serde::{Serialize, Deserialize};
use pallet_evm::AddressMapping;
pallets/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 ð[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
+}