Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Achieve dapptools address parity #446

Merged
merged 1 commit into from
Jan 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion evm-adapters/src/evm_opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ mod sputnik_helpers {
use super::*;

use crate::{sputnik::cache::SharedBackend, FAUCET_ACCOUNT};
use ::sputnik::backend::MemoryBackend;
use ethers::providers::Provider;
use sputnik::backend::MemoryBackend;

pub enum BackendKind<'a> {
Simple(MemoryBackend<'a>),
Expand All @@ -130,6 +130,11 @@ mod sputnik_helpers {
let faucet =
backend.state_mut().entry(*FAUCET_ACCOUNT).or_insert_with(Default::default);
faucet.balance = U256::MAX;
// set deployer nonce to 1 to get the same contract addresses
// as dapptools, provided the sender is also
// `0x00a329c0648769A73afAc7F9381E08FB43dBEA72`
let deployer = backend.state_mut().entry(self.sender).or_insert_with(Default::default);
deployer.nonce = U256::from(1);

let backend = if let Some(ref url) = self.fork_url {
let provider = Provider::try_from(url.as_str())?;
Expand Down