Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven authored and Steven committed May 10, 2024
1 parent 2c916b9 commit d5a21f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
14 changes: 6 additions & 8 deletions crates/sozo/ops/src/migration/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,17 +694,14 @@ where
format!("deploy {}", contract.diff.name)
}

pub async fn print_strategy<P>(ui: &Ui, provider: &P, strategy: &MigrationStrategy, world_address: FieldElement, contract: &ContractMigration, base_class_hash: FieldElement)
pub async fn print_strategy<P>(ui: &Ui, provider: &P, strategy: &MigrationStrategy)
where
P: Provider + Sync + Send + 'static,
{

let contract_address =
get_contract_address(contract.salt, base_class_hash, &[], world_address);

ui.print("\n📋 Migration Strategy\n");
ui.print_sub(format!("World address: {:#x})\n", world_address));
ui.print_sub(format!("Contract address: {:#x})\n", contract_address));
if let Some(world) = &strategy.world {
ui.print_sub(format!("declare (contract address: {:#x})\n", world.contract_address));
}

if let Some(base) = &strategy.base {
ui.print_header("# Base Contract");
Expand All @@ -714,7 +711,6 @@ where
if let Some(world) = &strategy.world {
ui.print_header("# World");
ui.print_sub(format!("declare (class hash: {:#x})\n", world.diff.local_class_hash));
ui.print_sub(format!("declare (contract address: {:#x})\n", world.contract_address));
}

if !&strategy.models.is_empty() {
Expand All @@ -733,6 +729,8 @@ where
for c in &strategy.contracts {
let op_name = get_contract_operation_name(provider, c, strategy.world_address).await;
ui.print_sub(format!("{op_name} (class hash: {:#x})", c.diff.local_class_hash));
let contract_address = get_contract_address(c.salt, c.diff.base_class_hash, &[], c.contract_address);
ui.print_sub(format!("{op_name} (contract address: {:#x})", contract_address));
}
ui.print(" ");
}
Expand Down
5 changes: 1 addition & 4 deletions crates/sozo/ops/src/migration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use dojo_lang::compiler::MANIFESTS_DIR;
use dojo_world::contracts::WorldContract;
use dojo_world::migration::world::WorldDiff;
use dojo_world::migration::{DeployOutput, TxnConfig, UpgradeOutput};
use dojo_world::migration::contract::ContractMigration;
use scarb::core::Workspace;
use starknet::accounts::{ConnectedAccount, SingleOwnerAccount};
use starknet::core::types::FieldElement;
Expand Down Expand Up @@ -53,8 +52,6 @@ pub async fn migrate<P, S>(
name: &str,
dry_run: bool,
txn_config: TxnConfig,
base_class_hash: FieldElement,
contract: &ContractMigration
) -> Result<()>
where
P: Provider + Sync + Send + 'static,
Expand Down Expand Up @@ -100,7 +97,7 @@ where
let world_address = strategy.world_address().expect("world address must exist");

if dry_run {
print_strategy(&ui, account.provider(), &strategy, world_address, contract, base_class_hash).await;
print_strategy(&ui, account.provider(), &strategy).await;

update_manifests_and_abis(
ws,
Expand Down

0 comments on commit d5a21f3

Please sign in to comment.