From fac617f5e589c3177a68b535adf29295f7c85ee4 Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 13 Dec 2024 12:31:57 +0100 Subject: [PATCH] add unit test --- crates/forge/bin/cmd/create.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/crates/forge/bin/cmd/create.rs b/crates/forge/bin/cmd/create.rs index 1df06e234..15ebbb87a 100644 --- a/crates/forge/bin/cmd/create.rs +++ b/crates/forge/bin/cmd/create.rs @@ -108,6 +108,7 @@ pub struct CreateArgs { retry: RetryArgs, } +#[derive(Debug, Default)] /// Data used to deploy a contract on zksync pub struct ZkSyncData { #[allow(dead_code)] @@ -1149,6 +1150,8 @@ impl From for ContractDeploymentError { mod tests { use super::*; use alloy_primitives::I256; + use alloy_zksync::network::tx_type::TxType; + use utils::get_provider_zksync; #[test] fn can_parse_create() { @@ -1217,4 +1220,20 @@ mod tests { let params = args.parse_constructor_args(&constructor, &args.constructor_args).unwrap(); assert_eq!(params, vec![DynSolValue::Int(I256::unchecked_from(-5), 256)]); } + + #[test] + fn test_zk_deployer_builds_eip712_transactions() { + let client = get_provider_zksync(&Default::default()).expect("failed creating client"); + let factory = + DeploymentTxFactory::new_zk(Default::default(), Default::default(), client, 0); + + let deployer = factory + .deploy_tokens_zk( + Default::default(), + &ZkSyncData { bytecode: [0u8; 32].into(), ..Default::default() }, + ) + .expect("failed deploying tokens"); + + assert_eq!(TxType::Eip712, deployer.tx.output_tx_type()); + } }