Skip to content
Closed
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions bin/sozo/src/commands/options/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ pub struct TransactionOptions {
#[arg(long)]
#[arg(help = "The finality status to wait for. Since 0.14, the nodes syncing is sometime \
not fast enough to propagate the transaction to the nodes in the \
PRE-CONFIRMED state. The default is ACCEPTED_ON_L2. Available options are: \
PRE-CONFIRMED, ACCEPTED_ON_L2, ACCEPTED_ON_L1.")]
PRE_CONFIRMED state. The default is ACCEPTED_ON_L2. Available options are: \
PRE_CONFIRMED, ACCEPTED_ON_L2.")]
#[arg(global = true)]
#[arg(default_value = "ACCEPTED_ON_L2")]
pub finality_status: Option<String>,
Expand Down Expand Up @@ -141,7 +141,6 @@ fn parse_finality_status(status: Option<String>) -> Result<TransactionFinalitySt
match status.to_uppercase().as_str() {
"PRE_CONFIRMED" => Ok(TransactionFinalityStatus::PreConfirmed),
"ACCEPTED_ON_L2" => Ok(TransactionFinalityStatus::AcceptedOnL2),
"ACCEPTED_ON_L1" => Ok(TransactionFinalityStatus::AcceptedOnL1),
_ => bail!("Invalid finality status: {}", status),
}
} else {
Expand Down
23 changes: 10 additions & 13 deletions crates/sozo/ops/src/migrate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -819,14 +819,12 @@ where
if let ResourceDiff::Created(ResourceLocal::ExternalContract(contract)) = resource {
match contract {
ExternalContractLocal::SozoManaged(c) => {
let block_number =
deploy_block_numbers.get(&contract.tag()).unwrap_or_else(|| {
panic!(
"Block number should be available for sozo-managed {} external \
contract.",
contract.tag()
)
});
let block_number = deploy_block_numbers.get(&contract.tag()).unwrap_or({
// Against the pre-confirmed state, the block number is not available.
// Since the block number is only registered for indexing purposes,
// using 0 is acceptable for now.
&0
});

calls.push(self.world.register_external_contract_getcall(
&ByteArray::from_string(&contract.namespace())?,
Expand Down Expand Up @@ -930,11 +928,10 @@ where
{
Some((_, call)) => deploy_call = Some(call),
None => {
return Err(MigrationError::DeployExternalContractError(anyhow!(
"Failed to deploy external contract `{}` in namespace `{}`",
contract.common.name,
contract.common.namespace
)));
deploy_call = {
// Already deployed, no need to deploy again.
None
}
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/spawn-and-move/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ default = [ "dungeon" ]
dungeon = [ ]

[profile.saya]
[profile.sepolia]
78 changes: 78 additions & 0 deletions examples/spawn-and-move/dojo_sepolia.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[world]
description = "example world"
name = "example"
seed = "dojo_examples-glihm6"

[[models]]
tag = "ns-Message"
description = "Message sent by a player"

[[models]]
tag = "ns-Position"
description = "position of a player in the world"

[[models]]
tag = "ns-Moves"
description = "move of a player in the world"

[[events]]
tag = "ns-Moved"
description = "when a player has moved"

[[contracts]]
tag = "ns-actions"
description = "set of actions for a player"

[[external_contracts]]
contract_name = "ERC20Token"
instance_name = "GoldToken"
salt = "1"
constructor_data = ["0x2af9427c5a277474c079a1283c880ee8a6f0f8fbf73ce969c08d88befec1bba", "str:Gold", "str:GOLD", "u256:0x10000000000000", "0x2af9427c5a277474c079a1283c880ee8a6f0f8fbf73ce969c08d88befec1bba"]

[[external_contracts]]
contract_name = "ERC20Token"
instance_name = "WoodToken"
salt = "1"
constructor_data = ["0x2af9427c5a277474c079a1283c880ee8a6f0f8fbf73ce969c08d88befec1bba", "str:Wood", "str:WOOD", "u256:0x10000000000000", "0x2af9427c5a277474c079a1283c880ee8a6f0f8fbf73ce969c08d88befec1bba"]

[[external_contracts]]
contract_name = "ERC721Token"
instance_name = "Badge"
salt = "1"
constructor_data = ["0x2af9427c5a277474c079a1283c880ee8a6f0f8fbf73ce969c08d88befec1bba", "str:Badge", "str:BDG", "str:https://badge.com/" ]

[[external_contracts]]
contract_name = "ERC1155Token"
instance_name = "Rewards"
salt = "1"
constructor_data = ["0x2af9427c5a277474c079a1283c880ee8a6f0f8fbf73ce969c08d88befec1bba", "str:https://rewards.com/" ]

[[external_contracts]]
contract_name = "Bank"
salt = "1"
constructor_data = ["0x2af9427c5a277474c079a1283c880ee8a6f0f8fbf73ce969c08d88befec1bba"]

[[external_contracts]]
contract_name = "Saloon"
constructor_data = []
salt = "1"

[lib_versions]
"ns-simple_math" = "0_1_0"

[namespace]
default = "ns"
mappings = { "ns" = ["actions", "GoldToken", "Bank"], "ns2" = ["actions", "GoldToken"], "ns3" = ["Bank"] }

[env]
rpc_url = "https://api.cartridge.gg/x/starknet/sepolia"
# Default account for katana with seed = 0
account_address = "0x4ba5ae775eb7da75f092b3b30b03bce15c3476337ef5f9e3cdf18db7a7534bd"
keystore_path = "~/.snaccounts/dev-sepolia.key"
world_block = 2791680

[init_call_args]
"ns-others" = ["0xff"]

[writers]
"ns" = [ "ns-mock_token", "ns-actions", "ns-others" ]
Loading
Loading