Skip to content

Commit

Permalink
chore: export create address calls (bluealloy#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Sep 7, 2022
1 parent 88dc2e9 commit 9f1932d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion crates/revm/src/evm_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,7 @@ impl<'a, GSPEC: Spec, DB: Database + 'a, const INSPECT: bool> Host
}
}

/// Returns the address for the legacy `CREATE` scheme: [`CreateScheme::Create`]
pub fn create_address(caller: H160, nonce: u64) -> H160 {
let mut stream = rlp::RlpStream::new_list(2);
stream.append(&caller);
Expand All @@ -814,7 +815,7 @@ pub fn create_address(caller: H160, nonce: u64) -> H160 {
out
}

/// Get the create address from given scheme.
/// Returns the address for the `CREATE2` scheme: [`CreateScheme::Create2`]
pub fn create2_address(caller: H160, code_hash: H256, salt: U256) -> H160 {
let mut temp: [u8; 32] = [0; 32];
salt.to_big_endian(&mut temp);
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod journaled_state;
mod models;
mod specification;

pub use evm_impl::{EVMData, Host};
pub use evm_impl::{create2_address, create_address, EVMData, Host};

pub type DummyStateDB = InMemoryDB;

Expand Down

0 comments on commit 9f1932d

Please sign in to comment.