Skip to content

Commit

Permalink
feat: don't deploy contracts if they were already deployed (#1528)
Browse files Browse the repository at this point in the history
  • Loading branch information
Br1ght0ne authored Oct 24, 2024
1 parent d99edd0 commit c566da8
Show file tree
Hide file tree
Showing 15 changed files with 379 additions and 169 deletions.
15 changes: 10 additions & 5 deletions e2e/tests/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ mod hygiene {
Deploy(
name = "simple_contract_instance",
contract = "SimpleContract",
wallet = "wallet"
wallet = "wallet",
random_salt = false,
),
);
}
Expand All @@ -36,7 +37,8 @@ async fn compile_bindings_from_contract_file() {
Deploy(
name = "simple_contract_instance",
contract = "SimpleContract",
wallet = "wallet"
wallet = "wallet",
random_salt = false,
),
);

Expand Down Expand Up @@ -119,12 +121,14 @@ async fn shared_types() -> Result<()> {
Deploy(
name = "contract_a",
contract = "ContractA",
wallet = "wallet"
wallet = "wallet",
random_salt = false,
),
Deploy(
name = "contract_b",
contract = "ContractB",
wallet = "wallet"
wallet = "wallet",
random_salt = false,
),
);
{
Expand Down Expand Up @@ -230,7 +234,8 @@ async fn type_paths_respected() -> Result<()> {
Deploy(
name = "contract_a_instance",
contract = "ContractA",
wallet = "wallet"
wallet = "wallet",
random_salt = false,
),
);
{
Expand Down
6 changes: 3 additions & 3 deletions e2e/tests/configurables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async fn contract_default_configurables() -> Result<()> {
"sway/contracts/configurables/out/release/configurables.bin",
LoadConfiguration::default(),
)?
.deploy(&wallet, TxPolicies::default())
.deploy_if_not_exists(&wallet, TxPolicies::default())
.await?;

let contract_instance = MyContract::new(contract_id, wallet.clone());
Expand Down Expand Up @@ -129,7 +129,7 @@ async fn contract_configurables() -> Result<()> {
"sway/contracts/configurables/out/release/configurables.bin",
LoadConfiguration::default().with_configurables(configurables),
)?
.deploy(&wallet, TxPolicies::default())
.deploy_if_not_exists(&wallet, TxPolicies::default())
.await?;

let contract_instance = MyContract::new(contract_id, wallet.clone());
Expand Down Expand Up @@ -197,7 +197,7 @@ async fn contract_manual_configurables() -> Result<()> {
LoadConfiguration::default(),
)?
.with_configurables(configurables)
.deploy(&wallet, TxPolicies::default())
.deploy_if_not_exists(&wallet, TxPolicies::default())
.await?;

let contract_instance = MyContract::new(contract_id, wallet.clone());
Expand Down
Loading

0 comments on commit c566da8

Please sign in to comment.