From 5b4a54e3d1d1a3c8cc4a15252fb85f1725a7b089 Mon Sep 17 00:00:00 2001 From: hal3e Date: Tue, 13 May 2025 12:32:13 +0200 Subject: [PATCH] chore: test contract deployment with salt --- e2e/tests/contracts.rs | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/e2e/tests/contracts.rs b/e2e/tests/contracts.rs index 0a38d02516..f778296f2a 100644 --- a/e2e/tests/contracts.rs +++ b/e2e/tests/contracts.rs @@ -46,6 +46,45 @@ async fn test_multiple_args() -> Result<()> { Ok(()) } +#[tokio::test] +async fn contract_deployment_with_salt() { + setup_program_test!( + Wallets("wallet"), + Abigen(Contract( + name = "TestContract", + project = "e2e/sway/contracts/contract_test" + )), + Deploy( + name = "contract_instance_1", + contract = "TestContract", + wallet = "wallet", + random_salt = false, + ), + Deploy( + name = "contract_instance_2", + contract = "TestContract", + wallet = "wallet", + random_salt = false, + ), + Deploy( + name = "contract_instance_3", + contract = "TestContract", + wallet = "wallet", + random_salt = true, + ), + ); + + assert_eq!( + contract_instance_1.contract_id(), + contract_instance_2.contract_id() + ); + + assert_ne!( + contract_instance_1.contract_id(), + contract_instance_3.contract_id() + ); +} + #[tokio::test] async fn test_contract_calling_contract() -> Result<()> { // Tests a contract call that calls another contract (FooCaller calls FooContract underneath)