Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions bin/ops/src/core_contract/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use log::{debug, trace, warn};
use starknet::accounts::{Account, SingleOwnerAccount};
use starknet::core::crypto::compute_hash_on_elements;
use starknet::core::types::{contract::SierraClass, Call, Felt, FlattenedSierraClass};
use starknet::core::utils::get_contract_address;
use starknet::macros::{selector, short_string};
use starknet::providers::jsonrpc::HttpTransport;
use starknet::providers::JsonRpcClient;
Expand Down Expand Up @@ -139,6 +140,18 @@ pub async fn deploy_contract(
.await
{
Ok((contract_address, transaction_result)) => {
// dojo-utils's `deploy_via_udc` returns `(Felt::ZERO, Noop)` when
// the contract is already deployed at the deterministic UDC-derived
// address — it computes the real address internally then drops it
// before returning. Recompute locally so downstream callers (and
// --output json consumers) see the actual address, not zero.
let contract_address = if contract_address == Felt::ZERO
&& matches!(transaction_result, TransactionResult::Noop)
{
get_contract_address(salt, class_hash, constructor_calldata, Felt::ZERO)
} else {
contract_address
};
match &transaction_result {
TransactionResult::Noop => {
debug!(contract:% = contract_name; "Contract already deployed.");
Expand Down
Loading