Skip to content

Commit

Permalink
Revert "Upgrade EVM pallet to FRAMEv2 (polkadot-evm#380)"
Browse files Browse the repository at this point in the history
This reverts commit 369143c.
  • Loading branch information
sorpaas committed Jun 14, 2021
1 parent 6e2e908 commit 713165e
Show file tree
Hide file tree
Showing 4 changed files with 323 additions and 353 deletions.
12 changes: 6 additions & 6 deletions frame/evm/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use frame_support::traits::Get;
use frame_support::{debug, storage::{StorageMap, StorageDoubleMap}};
use sha3::{Keccak256, Digest};
use evm::backend::{Backend as BackendT, ApplyBackend, Apply};
use crate::{AccountStorages, AccountCodes, Config, Event, Pallet};
use crate::{Trait, AccountStorages, AccountCodes, Module, Event};

#[derive(Clone, Eq, PartialEq, Encode, Decode, Default)]
#[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))]
Expand Down Expand Up @@ -73,7 +73,7 @@ impl<'vicinity, T> Backend<'vicinity, T> {
}
}

impl<'vicinity, T: Config> BackendT for Backend<'vicinity, T> {
impl<'vicinity, T: Trait> BackendT for Backend<'vicinity, T> {
fn gas_price(&self) -> U256 { self.vicinity.gas_price }
fn origin(&self) -> H160 { self.vicinity.origin }

Expand All @@ -82,12 +82,12 @@ impl<'vicinity, T: Config> BackendT for Backend<'vicinity, T> {
H256::default()
} else {
let number = T::BlockNumber::from(number.as_u32());
H256::from_slice(frame_system::Pallet::<T>::block_hash(number).as_ref())
H256::from_slice(frame_system::Module::<T>::block_hash(number).as_ref())
}
}

fn block_number(&self) -> U256 {
let number: u128 = frame_system::Pallet::<T>::block_number().unique_saturated_into();
let number: u128 = frame_system::Module::<T>::block_number().unique_saturated_into();
U256::from(number)
}

Expand All @@ -96,7 +96,7 @@ impl<'vicinity, T: Config> BackendT for Backend<'vicinity, T> {
}

fn block_timestamp(&self) -> U256 {
let now: u128 = pallet_timestamp::Pallet::<T>::get().unique_saturated_into();
let now: u128 = pallet_timestamp::Module::<T>::get().unique_saturated_into();
U256::from(now / 1000)
}

Expand All @@ -117,7 +117,7 @@ impl<'vicinity, T: Config> BackendT for Backend<'vicinity, T> {
}

fn basic(&self, address: H160) -> evm::backend::Basic {
let account = Pallet::<T>::account_basic(&address);
let account = Module::<T>::account_basic(&address);

evm::backend::Basic {
balance: account.balance,
Expand Down
Loading

0 comments on commit 713165e

Please sign in to comment.