Skip to content

Commit

Permalink
adds aliased types needed to describe EVM environment
Browse files Browse the repository at this point in the history
  • Loading branch information
saibatizoku committed Oct 12, 2021
1 parent fe39e78 commit 16ffe1d
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions chain-evm/src/machine.rs
Expand Up @@ -9,7 +9,10 @@
//! ## StackState<'config>
//!

use std::rc::Rc;
use std::{
rc::Rc,
time::{SystemTime, UNIX_EPOCH},
};

use evm::{
backend::{Apply, ApplyBackend, Backend, Basic, Log, MemoryVicinity},
Expand All @@ -23,14 +26,50 @@ use crate::state::AccountTrie;
/// EVM Configuration.
pub use evm::Config;

/// A block's chain ID.
pub type ChainId = U256;

/// A block hash.
pub type BlockHash = H256;

/// A block hash.
pub type BlockHashes = Vec<BlockHash>;

/// A block's number.
pub type BlockNumber = U256;

/// A block's timestamp.
pub struct BlockTimestamp;

impl BlockTimestamp {
/// Returns the time since `UNIX_EPOCH` as `U256`
pub fn now() -> U256 {
U256::from(
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs(),
)
}
}

/// A block's difficulty.
pub type BlockDifficulty = U256;

/// A block's gas limit.
pub type BlockGasLimit = U256;

/// A block's origin
pub type Origin = H160;

/// Gas quantity integer for EVM operations.
pub type Gas = U256;

/// Gas price integer for EVM operations.
pub type GasPrice = U256;

/// Gas limit for EVM operations.
pub type GasLimit = u64;
pub type GasLimit = U256;

/// Integer of the value sent with an EVM transaction.
pub type Value = U256;
Expand Down

0 comments on commit 16ffe1d

Please sign in to comment.