Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
nbaztec committed Dec 13, 2024
1 parent 254acb1 commit fac617f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions crates/forge/bin/cmd/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -1149,6 +1150,8 @@ impl From<PendingTransactionError> 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() {
Expand Down Expand Up @@ -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());
}
}

0 comments on commit fac617f

Please sign in to comment.