Skip to content
Merged
Show file tree
Hide file tree
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
47 changes: 24 additions & 23 deletions crates/e2e/src/setup/deploy.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use {
alloy::primitives::{Address, B256, U256},
contracts::alloy::{
BalancerV2Authorizer,
BalancerV2Vault,
Expand All @@ -12,11 +13,7 @@ use {
WETH9,
support::{Balances, Signatures},
},
ethcontract::{Address, H256},
ethrpc::alloy::{
CallBuilderExt,
conversions::{IntoAlloy, IntoLegacy},
},
ethrpc::alloy::{CallBuilderExt, conversions::IntoAlloy},
model::DomainSeparator,
shared::ethrpc::Web3,
};
Expand Down Expand Up @@ -58,13 +55,13 @@ impl Contracts {
.await
.unwrap();
let balances = match deployed.balances {
Some(address) => Balances::Instance::new(address.into_alloy(), web3.alloy.clone()),
Some(address) => Balances::Instance::new(address, web3.alloy.clone()),
None => Balances::Instance::deployed(&web3.alloy)
.await
.expect("failed to find balances contract"),
};
let signatures = match deployed.signatures {
Some(address) => Signatures::Instance::new(address.into_alloy(), web3.alloy.clone()),
Some(address) => Signatures::Instance::new(address, web3.alloy.clone()),
None => Signatures::Instance::deployed(&web3.alloy)
.await
.expect("failed to find signatures contract"),
Expand Down Expand Up @@ -93,8 +90,7 @@ impl Contracts {
.vaultRelayer()
.call()
.await
.expect("Couldn't get vault relayer address")
.into_legacy(),
.expect("Couldn't get vault relayer address"),
domain_separator: DomainSeparator(
gp_settlement
.domainSeparator()
Expand Down Expand Up @@ -127,27 +123,33 @@ impl Contracts {
.to_string();
tracing::info!("connected to test network {}", network_id);

let accounts: Vec<Address> = web3.eth().accounts().await.expect("get accounts failed");
let accounts: Vec<Address> = web3
.eth()
.accounts()
.await
.expect("get accounts failed")
.into_iter()
.map(|a| a.into_alloy())
.collect();
let admin = accounts[0];

let weth = WETH9::Instance::deploy(web3.alloy.clone()).await.unwrap();

let balancer_authorizer =
BalancerV2Authorizer::Instance::deploy(web3.alloy.clone(), admin.into_alloy())
.await
.unwrap();
let balancer_authorizer = BalancerV2Authorizer::Instance::deploy(web3.alloy.clone(), admin)
.await
.unwrap();
let balancer_vault = BalancerV2Vault::Instance::deploy(
web3.alloy.clone(),
*balancer_authorizer.address(),
*weth.address(),
alloy::primitives::U256::ZERO,
alloy::primitives::U256::ZERO,
U256::ZERO,
U256::ZERO,
)
.await
.unwrap();

let uniswap_v2_factory =
UniswapV2Factory::Instance::deploy(web3.alloy.clone(), accounts[0].into_alloy())
UniswapV2Factory::Instance::deploy(web3.alloy.clone(), accounts[0])
.await
.unwrap();
let uniswap_v2_router = UniswapV2Router02::Instance::deploy(
Expand All @@ -162,7 +164,7 @@ impl Contracts {
.await
.unwrap();
gp_authenticator
.initializeManager(admin.into_alloy())
.initializeManager(admin)
.send_and_watch()
.await
.expect("failed to initialize manager");
Expand Down Expand Up @@ -196,8 +198,7 @@ impl Contracts {
.vaultRelayer()
.call()
.await
.expect("Couldn't get vault relayer address")
.into_legacy();
.expect("Couldn't get vault relayer address");
let domain_separator = DomainSeparator(
gp_settlement
.domainSeparator()
Expand Down Expand Up @@ -250,10 +251,10 @@ impl Contracts {
}
}

pub fn default_pool_code(&self) -> H256 {
pub fn default_pool_code(&self) -> B256 {
match self.chain_id {
100 => H256(shared::sources::uniswap_v2::HONEYSWAP_INIT),
_ => H256(shared::sources::uniswap_v2::UNISWAP_INIT),
100 => B256::new(shared::sources::uniswap_v2::HONEYSWAP_INIT),
_ => B256::new(shared::sources::uniswap_v2::UNISWAP_INIT),
}
}
}
Loading
Loading