From 670fdb92c5272b83b5fe3eb7fe2974e904e857bb Mon Sep 17 00:00:00 2001 From: Starknet Dev Date: Mon, 16 Dec 2024 15:25:27 +0000 Subject: [PATCH] fix build --- contracts/dojo_dev.toml | 2 +- contracts/dojo_mainnet.toml | 4 +- contracts/manifest_dev.json | 795 +++++- contracts/manifest_mainnet.json | 2128 +++++++++++++++++ tournament-ui/.env | 2 +- .../components/create/TournamentEntryFee.tsx | 16 +- .../src/components/tournament/GamesTable.tsx | 2 +- .../components/tournament/StartTournament.tsx | 7 +- tournament-ui/src/config.ts | 5 +- tournament-ui/src/containers/Tournament.tsx | 1 + tournament-ui/src/hooks/useFreeGames.tsx | 35 +- tournament-ui/src/useSystemCalls.ts | 16 +- 12 files changed, 2974 insertions(+), 39 deletions(-) create mode 100644 contracts/manifest_mainnet.json diff --git a/contracts/dojo_dev.toml b/contracts/dojo_dev.toml index 1da85fc..cd3a98a 100644 --- a/contracts/dojo_dev.toml +++ b/contracts/dojo_dev.toml @@ -45,4 +45,4 @@ private_key = "0xc5b2fcab997346f3ea1c00b002ecf6f382c5f9c9659a3894eb783c5320f912" [migration] order_inits = [] -skip_contracts = ["tournament-LSTournament"] +# skip_contracts = ["tournament-LSTournament"] diff --git a/contracts/dojo_mainnet.toml b/contracts/dojo_mainnet.toml index c06eb3c..d2c917c 100644 --- a/contracts/dojo_mainnet.toml +++ b/contracts/dojo_mainnet.toml @@ -2,7 +2,7 @@ name = "Tournament" description = "Loot Survivor Tournaments" website = "https://github.com/Provable-Games/ls-tournaments" -seed = "tournament" +seed = "tournament1" [world.socials] x = "https://x.com/provablegames" @@ -14,7 +14,7 @@ default = "tournament" [env] chain_id = "SN_MAINNET" rpc_url = "https://api.cartridge.gg/x/starknet/mainnet" -# world_address = "0x02b127646258e21186e6c7e6234f42583d0d19bf88a57776a404c2cefeb421f2" # Uncomment and update this line with your world address. +# world_address = "0x062b6ebdb34b02e834fa3a62a8ba862c27c6fda39f902ba814903e61956dde4d" # Uncomment and update this line with your world address. [writers] "tournament-TournamentModel" = ["tournament-LSTournament"] diff --git a/contracts/manifest_dev.json b/contracts/manifest_dev.json index 26fb15c..d0ecb48 100644 --- a/contracts/manifest_dev.json +++ b/contracts/manifest_dev.json @@ -1250,7 +1250,800 @@ } ] }, - "contracts": [], + "contracts": [ + { + "address": "0x1a4ee4c4b16cd36d2bb4cb861a622f8e814daf5035716517d76af76fa2a4dfa", + "class_hash": "0x32b12f5c4ce3a3e31017409f3ffc07857822e986634d492b7ccabb796333d08", + "abi": [ + { + "type": "impl", + "name": "LSTournament__ContractImpl", + "interface_name": "dojo::contract::interface::IContract" + }, + { + "type": "interface", + "name": "dojo::contract::interface::IContract", + "items": [] + }, + { + "type": "impl", + "name": "LSTournament__DeployedContractImpl", + "interface_name": "dojo::meta::interface::IDeployedResource" + }, + { + "type": "struct", + "name": "core::byte_array::ByteArray", + "members": [ + { + "name": "data", + "type": "core::array::Array::" + }, + { + "name": "pending_word", + "type": "core::felt252" + }, + { + "name": "pending_word_len", + "type": "core::integer::u32" + } + ] + }, + { + "type": "interface", + "name": "dojo::meta::interface::IDeployedResource", + "items": [ + { + "type": "function", + "name": "dojo_name", + "inputs": [], + "outputs": [ + { + "type": "core::byte_array::ByteArray" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "enum", + "name": "core::bool", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "type": "function", + "name": "dojo_init", + "inputs": [ + { + "name": "safe_mode", + "type": "core::bool" + }, + { + "name": "test_mode", + "type": "core::bool" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "impl", + "name": "WorldProviderImpl", + "interface_name": "dojo::contract::components::world_provider::IWorldProvider" + }, + { + "type": "struct", + "name": "dojo::world::iworld::IWorldDispatcher", + "members": [ + { + "name": "contract_address", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "type": "interface", + "name": "dojo::contract::components::world_provider::IWorldProvider", + "items": [ + { + "type": "function", + "name": "world_dispatcher", + "inputs": [], + "outputs": [ + { + "type": "dojo::world::iworld::IWorldDispatcher" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "UpgradeableImpl", + "interface_name": "dojo::contract::components::upgradeable::IUpgradeable" + }, + { + "type": "interface", + "name": "dojo::contract::components::upgradeable::IUpgradeable", + "items": [ + { + "type": "function", + "name": "upgrade", + "inputs": [ + { + "name": "new_class_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "TournamentImpl", + "interface_name": "tournament::ls15_components::tournament::ITournament" + }, + { + "type": "struct", + "name": "tournament::ls15_components::models::tournament::EntryCriteria", + "members": [ + { + "name": "token_id", + "type": "core::integer::u128" + }, + { + "name": "entry_count", + "type": "core::integer::u64" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "enum", + "name": "tournament::ls15_components::models::tournament::GatedEntryType", + "variants": [ + { + "name": "criteria", + "type": "core::array::Span::" + }, + { + "name": "uniform", + "type": "core::integer::u64" + } + ] + }, + { + "type": "struct", + "name": "tournament::ls15_components::models::tournament::GatedToken", + "members": [ + { + "name": "token", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "entry_type", + "type": "tournament::ls15_components::models::tournament::GatedEntryType" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "enum", + "name": "tournament::ls15_components::models::tournament::GatedType", + "variants": [ + { + "name": "token", + "type": "tournament::ls15_components::models::tournament::GatedToken" + }, + { + "name": "tournament", + "type": "core::array::Span::" + }, + { + "name": "address", + "type": "core::array::Span::" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "tournament::ls15_components::models::tournament::GatedType" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "tournament::ls15_components::models::tournament::Premium", + "members": [ + { + "name": "token", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "token_amount", + "type": "core::integer::u128" + }, + { + "name": "token_distribution", + "type": "core::array::Span::" + }, + { + "name": "creator_fee", + "type": "core::integer::u8" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "tournament::ls15_components::models::tournament::Premium" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "tournament::ls15_components::models::tournament::TournamentModel", + "members": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + }, + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "description", + "type": "core::byte_array::ByteArray" + }, + { + "name": "creator", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "registration_start_time", + "type": "core::integer::u64" + }, + { + "name": "registration_end_time", + "type": "core::integer::u64" + }, + { + "name": "start_time", + "type": "core::integer::u64" + }, + { + "name": "end_time", + "type": "core::integer::u64" + }, + { + "name": "submission_period", + "type": "core::integer::u64" + }, + { + "name": "winners_count", + "type": "core::integer::u8" + }, + { + "name": "gated_type", + "type": "core::option::Option::" + }, + { + "name": "entry_premium", + "type": "core::option::Option::" + } + ] + }, + { + "type": "struct", + "name": "core::integer::u256", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "enum", + "name": "tournament::ls15_components::models::tournament::GatedSubmissionType", + "variants": [ + { + "name": "token_id", + "type": "core::integer::u256" + }, + { + "name": "game_id", + "type": "core::array::Span::" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "tournament::ls15_components::models::tournament::GatedSubmissionType" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "core::integer::u64" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "tournament::ls15_components::models::tournament::ERC20Data", + "members": [ + { + "name": "token_amount", + "type": "core::integer::u128" + } + ] + }, + { + "type": "struct", + "name": "tournament::ls15_components::models::tournament::ERC721Data", + "members": [ + { + "name": "token_id", + "type": "core::integer::u128" + } + ] + }, + { + "type": "enum", + "name": "tournament::ls15_components::models::tournament::TokenDataType", + "variants": [ + { + "name": "erc20", + "type": "tournament::ls15_components::models::tournament::ERC20Data" + }, + { + "name": "erc721", + "type": "tournament::ls15_components::models::tournament::ERC721Data" + } + ] + }, + { + "type": "interface", + "name": "tournament::ls15_components::tournament::ITournament", + "items": [ + { + "type": "function", + "name": "total_tournaments", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "tournament", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + } + ], + "outputs": [ + { + "type": "tournament::ls15_components::models::tournament::TournamentModel" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "tournament_entries", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + } + ], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "tournament_prize_keys", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + } + ], + "outputs": [ + { + "type": "core::array::Array::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "top_scores", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + } + ], + "outputs": [ + { + "type": "core::array::Array::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "is_token_registered", + "inputs": [ + { + "name": "token", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "create_tournament", + "inputs": [ + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "description", + "type": "core::byte_array::ByteArray" + }, + { + "name": "registration_start_time", + "type": "core::integer::u64" + }, + { + "name": "registration_end_time", + "type": "core::integer::u64" + }, + { + "name": "start_time", + "type": "core::integer::u64" + }, + { + "name": "end_time", + "type": "core::integer::u64" + }, + { + "name": "submission_period", + "type": "core::integer::u64" + }, + { + "name": "winners_count", + "type": "core::integer::u8" + }, + { + "name": "gated_type", + "type": "core::option::Option::" + }, + { + "name": "entry_premium", + "type": "core::option::Option::" + } + ], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "enter_tournament", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + }, + { + "name": "gated_submission_type", + "type": "core::option::Option::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "start_tournament", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + }, + { + "name": "start_all", + "type": "core::bool" + }, + { + "name": "start_count", + "type": "core::option::Option::" + }, + { + "name": "client_reward_address", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "golden_token_free_game_token_ids", + "type": "core::array::Span::" + }, + { + "name": "blobert_free_game_token_ids", + "type": "core::array::Span::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "submit_scores", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + }, + { + "name": "game_ids", + "type": "core::array::Array::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "add_prize", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + }, + { + "name": "token", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "token_data_type", + "type": "tournament::ls15_components::models::tournament::TokenDataType" + }, + { + "name": "position", + "type": "core::integer::u8" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "distribute_prizes", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + }, + { + "name": "prize_keys", + "type": "core::array::Array::" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [] + }, + { + "type": "event", + "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", + "kind": "struct", + "members": [ + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", + "kind": "enum", + "variants": [ + { + "name": "Upgraded", + "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", + "kind": "nested" + } + ] + }, + { + "type": "event", + "name": "dojo::contract::components::world_provider::world_provider_cpt::Event", + "kind": "enum", + "variants": [] + }, + { + "type": "event", + "name": "tournament::ls15_components::tournament::tournament_component::Event", + "kind": "enum", + "variants": [] + }, + { + "type": "event", + "name": "tournament::presets::ls_tournament::LSTournament::Event", + "kind": "enum", + "variants": [ + { + "name": "UpgradeableEvent", + "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", + "kind": "nested" + }, + { + "name": "WorldProviderEvent", + "type": "dojo::contract::components::world_provider::world_provider_cpt::Event", + "kind": "nested" + }, + { + "name": "TournamentEvent", + "type": "tournament::ls15_components::tournament::tournament_component::Event", + "kind": "nested" + } + ] + } + ], + "init_calldata": [ + "1", + "1" + ], + "tag": "tournament-LSTournament", + "selector": "0x4d91e5e6083e568f5c87da757268b5836ab2964b5f032aea89770b0efc7c1d1", + "systems": [ + "dojo_init", + "upgrade", + "create_tournament", + "enter_tournament", + "start_tournament", + "submit_scores", + "add_prize", + "distribute_prizes" + ] + } + ], "models": [ { "members": [], diff --git a/contracts/manifest_mainnet.json b/contracts/manifest_mainnet.json new file mode 100644 index 0000000..2eba096 --- /dev/null +++ b/contracts/manifest_mainnet.json @@ -0,0 +1,2128 @@ +{ + "world": { + "class_hash": "0x45575a88cc5cef1e444c77ce60b7b4c9e73a01cbbe20926d5a4c72a94011410", + "address": "0x62b6ebdb34b02e834fa3a62a8ba862c27c6fda39f902ba814903e61956dde4d", + "seed": "tournament1", + "name": "Tournament", + "entrypoints": [ + "uuid", + "set_metadata", + "register_namespace", + "register_event", + "register_model", + "register_contract", + "init_contract", + "upgrade_event", + "upgrade_model", + "upgrade_contract", + "emit_event", + "emit_events", + "set_entity", + "set_entities", + "delete_entity", + "delete_entities", + "grant_owner", + "revoke_owner", + "grant_writer", + "revoke_writer", + "upgrade" + ], + "abi": [ + { + "type": "impl", + "name": "World", + "interface_name": "dojo::world::iworld::IWorld" + }, + { + "type": "struct", + "name": "core::byte_array::ByteArray", + "members": [ + { + "name": "data", + "type": "core::array::Array::" + }, + { + "name": "pending_word", + "type": "core::felt252" + }, + { + "name": "pending_word_len", + "type": "core::integer::u32" + } + ] + }, + { + "type": "enum", + "name": "dojo::world::resource::Resource", + "variants": [ + { + "name": "Model", + "type": "(core::starknet::contract_address::ContractAddress, core::felt252)" + }, + { + "name": "Event", + "type": "(core::starknet::contract_address::ContractAddress, core::felt252)" + }, + { + "name": "Contract", + "type": "(core::starknet::contract_address::ContractAddress, core::felt252)" + }, + { + "name": "Namespace", + "type": "core::byte_array::ByteArray" + }, + { + "name": "World", + "type": "()" + }, + { + "name": "Unregistered", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "dojo::model::metadata::ResourceMetadata", + "members": [ + { + "name": "resource_id", + "type": "core::felt252" + }, + { + "name": "metadata_uri", + "type": "core::byte_array::ByteArray" + }, + { + "name": "metadata_hash", + "type": "core::felt252" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::>", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::>" + } + ] + }, + { + "type": "enum", + "name": "dojo::model::definition::ModelIndex", + "variants": [ + { + "name": "Keys", + "type": "core::array::Span::" + }, + { + "name": "Id", + "type": "core::felt252" + }, + { + "name": "MemberId", + "type": "(core::felt252, core::felt252)" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "dojo::meta::layout::FieldLayout", + "members": [ + { + "name": "selector", + "type": "core::felt252" + }, + { + "name": "layout", + "type": "dojo::meta::layout::Layout" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "enum", + "name": "dojo::meta::layout::Layout", + "variants": [ + { + "name": "Fixed", + "type": "core::array::Span::" + }, + { + "name": "Struct", + "type": "core::array::Span::" + }, + { + "name": "Tuple", + "type": "core::array::Span::" + }, + { + "name": "Array", + "type": "core::array::Span::" + }, + { + "name": "ByteArray", + "type": "()" + }, + { + "name": "Enum", + "type": "core::array::Span::" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "enum", + "name": "core::bool", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "type": "interface", + "name": "dojo::world::iworld::IWorld", + "items": [ + { + "type": "function", + "name": "resource", + "inputs": [ + { + "name": "selector", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "dojo::world::resource::Resource" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "uuid", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "metadata", + "inputs": [ + { + "name": "resource_selector", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "dojo::model::metadata::ResourceMetadata" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "set_metadata", + "inputs": [ + { + "name": "metadata", + "type": "dojo::model::metadata::ResourceMetadata" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "register_namespace", + "inputs": [ + { + "name": "namespace", + "type": "core::byte_array::ByteArray" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "register_event", + "inputs": [ + { + "name": "namespace", + "type": "core::byte_array::ByteArray" + }, + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "register_model", + "inputs": [ + { + "name": "namespace", + "type": "core::byte_array::ByteArray" + }, + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "register_contract", + "inputs": [ + { + "name": "salt", + "type": "core::felt252" + }, + { + "name": "namespace", + "type": "core::byte_array::ByteArray" + }, + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "init_contract", + "inputs": [ + { + "name": "selector", + "type": "core::felt252" + }, + { + "name": "init_calldata", + "type": "core::array::Span::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "upgrade_event", + "inputs": [ + { + "name": "namespace", + "type": "core::byte_array::ByteArray" + }, + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "upgrade_model", + "inputs": [ + { + "name": "namespace", + "type": "core::byte_array::ByteArray" + }, + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "upgrade_contract", + "inputs": [ + { + "name": "namespace", + "type": "core::byte_array::ByteArray" + }, + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ], + "outputs": [ + { + "type": "core::starknet::class_hash::ClassHash" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "emit_event", + "inputs": [ + { + "name": "event_selector", + "type": "core::felt252" + }, + { + "name": "keys", + "type": "core::array::Span::" + }, + { + "name": "values", + "type": "core::array::Span::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "emit_events", + "inputs": [ + { + "name": "event_selector", + "type": "core::felt252" + }, + { + "name": "keys", + "type": "core::array::Span::>" + }, + { + "name": "values", + "type": "core::array::Span::>" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "entity", + "inputs": [ + { + "name": "model_selector", + "type": "core::felt252" + }, + { + "name": "index", + "type": "dojo::model::definition::ModelIndex" + }, + { + "name": "layout", + "type": "dojo::meta::layout::Layout" + } + ], + "outputs": [ + { + "type": "core::array::Span::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "entities", + "inputs": [ + { + "name": "model_selector", + "type": "core::felt252" + }, + { + "name": "indexes", + "type": "core::array::Span::" + }, + { + "name": "layout", + "type": "dojo::meta::layout::Layout" + } + ], + "outputs": [ + { + "type": "core::array::Span::>" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "set_entity", + "inputs": [ + { + "name": "model_selector", + "type": "core::felt252" + }, + { + "name": "index", + "type": "dojo::model::definition::ModelIndex" + }, + { + "name": "values", + "type": "core::array::Span::" + }, + { + "name": "layout", + "type": "dojo::meta::layout::Layout" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "set_entities", + "inputs": [ + { + "name": "model_selector", + "type": "core::felt252" + }, + { + "name": "indexes", + "type": "core::array::Span::" + }, + { + "name": "values", + "type": "core::array::Span::>" + }, + { + "name": "layout", + "type": "dojo::meta::layout::Layout" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "delete_entity", + "inputs": [ + { + "name": "model_selector", + "type": "core::felt252" + }, + { + "name": "index", + "type": "dojo::model::definition::ModelIndex" + }, + { + "name": "layout", + "type": "dojo::meta::layout::Layout" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "delete_entities", + "inputs": [ + { + "name": "model_selector", + "type": "core::felt252" + }, + { + "name": "indexes", + "type": "core::array::Span::" + }, + { + "name": "layout", + "type": "dojo::meta::layout::Layout" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "is_owner", + "inputs": [ + { + "name": "resource", + "type": "core::felt252" + }, + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "grant_owner", + "inputs": [ + { + "name": "resource", + "type": "core::felt252" + }, + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "revoke_owner", + "inputs": [ + { + "name": "resource", + "type": "core::felt252" + }, + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "is_writer", + "inputs": [ + { + "name": "resource", + "type": "core::felt252" + }, + { + "name": "contract", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "grant_writer", + "inputs": [ + { + "name": "resource", + "type": "core::felt252" + }, + { + "name": "contract", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "revoke_writer", + "inputs": [ + { + "name": "resource", + "type": "core::felt252" + }, + { + "name": "contract", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "UpgradeableWorld", + "interface_name": "dojo::world::iworld::IUpgradeableWorld" + }, + { + "type": "interface", + "name": "dojo::world::iworld::IUpgradeableWorld", + "items": [ + { + "type": "function", + "name": "upgrade", + "inputs": [ + { + "name": "new_class_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [ + { + "name": "world_class_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::WorldSpawned", + "kind": "struct", + "members": [ + { + "name": "creator", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::WorldUpgraded", + "kind": "struct", + "members": [ + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::NamespaceRegistered", + "kind": "struct", + "members": [ + { + "name": "namespace", + "type": "core::byte_array::ByteArray", + "kind": "key" + }, + { + "name": "hash", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::ModelRegistered", + "kind": "struct", + "members": [ + { + "name": "name", + "type": "core::byte_array::ByteArray", + "kind": "key" + }, + { + "name": "namespace", + "type": "core::byte_array::ByteArray", + "kind": "key" + }, + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + }, + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::EventRegistered", + "kind": "struct", + "members": [ + { + "name": "name", + "type": "core::byte_array::ByteArray", + "kind": "key" + }, + { + "name": "namespace", + "type": "core::byte_array::ByteArray", + "kind": "key" + }, + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + }, + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::ContractRegistered", + "kind": "struct", + "members": [ + { + "name": "name", + "type": "core::byte_array::ByteArray", + "kind": "key" + }, + { + "name": "namespace", + "type": "core::byte_array::ByteArray", + "kind": "key" + }, + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + }, + { + "name": "salt", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::ModelUpgraded", + "kind": "struct", + "members": [ + { + "name": "selector", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + }, + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "prev_address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::EventUpgraded", + "kind": "struct", + "members": [ + { + "name": "selector", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + }, + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "prev_address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::ContractUpgraded", + "kind": "struct", + "members": [ + { + "name": "selector", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::ContractInitialized", + "kind": "struct", + "members": [ + { + "name": "selector", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "init_calldata", + "type": "core::array::Span::", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::EventEmitted", + "kind": "struct", + "members": [ + { + "name": "selector", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "system_address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "key" + }, + { + "name": "keys", + "type": "core::array::Span::", + "kind": "data" + }, + { + "name": "values", + "type": "core::array::Span::", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::MetadataUpdate", + "kind": "struct", + "members": [ + { + "name": "resource", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "uri", + "type": "core::byte_array::ByteArray", + "kind": "data" + }, + { + "name": "hash", + "type": "core::felt252", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::StoreSetRecord", + "kind": "struct", + "members": [ + { + "name": "selector", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "entity_id", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "keys", + "type": "core::array::Span::", + "kind": "data" + }, + { + "name": "values", + "type": "core::array::Span::", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::StoreUpdateRecord", + "kind": "struct", + "members": [ + { + "name": "selector", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "entity_id", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "values", + "type": "core::array::Span::", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::StoreUpdateMember", + "kind": "struct", + "members": [ + { + "name": "selector", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "entity_id", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "member_selector", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "values", + "type": "core::array::Span::", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::StoreDelRecord", + "kind": "struct", + "members": [ + { + "name": "selector", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "entity_id", + "type": "core::felt252", + "kind": "key" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::WriterUpdated", + "kind": "struct", + "members": [ + { + "name": "resource", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "contract", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "key" + }, + { + "name": "value", + "type": "core::bool", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::OwnerUpdated", + "kind": "struct", + "members": [ + { + "name": "resource", + "type": "core::felt252", + "kind": "key" + }, + { + "name": "contract", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "key" + }, + { + "name": "value", + "type": "core::bool", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world_contract::world::Event", + "kind": "enum", + "variants": [ + { + "name": "WorldSpawned", + "type": "dojo::world::world_contract::world::WorldSpawned", + "kind": "nested" + }, + { + "name": "WorldUpgraded", + "type": "dojo::world::world_contract::world::WorldUpgraded", + "kind": "nested" + }, + { + "name": "NamespaceRegistered", + "type": "dojo::world::world_contract::world::NamespaceRegistered", + "kind": "nested" + }, + { + "name": "ModelRegistered", + "type": "dojo::world::world_contract::world::ModelRegistered", + "kind": "nested" + }, + { + "name": "EventRegistered", + "type": "dojo::world::world_contract::world::EventRegistered", + "kind": "nested" + }, + { + "name": "ContractRegistered", + "type": "dojo::world::world_contract::world::ContractRegistered", + "kind": "nested" + }, + { + "name": "ModelUpgraded", + "type": "dojo::world::world_contract::world::ModelUpgraded", + "kind": "nested" + }, + { + "name": "EventUpgraded", + "type": "dojo::world::world_contract::world::EventUpgraded", + "kind": "nested" + }, + { + "name": "ContractUpgraded", + "type": "dojo::world::world_contract::world::ContractUpgraded", + "kind": "nested" + }, + { + "name": "ContractInitialized", + "type": "dojo::world::world_contract::world::ContractInitialized", + "kind": "nested" + }, + { + "name": "EventEmitted", + "type": "dojo::world::world_contract::world::EventEmitted", + "kind": "nested" + }, + { + "name": "MetadataUpdate", + "type": "dojo::world::world_contract::world::MetadataUpdate", + "kind": "nested" + }, + { + "name": "StoreSetRecord", + "type": "dojo::world::world_contract::world::StoreSetRecord", + "kind": "nested" + }, + { + "name": "StoreUpdateRecord", + "type": "dojo::world::world_contract::world::StoreUpdateRecord", + "kind": "nested" + }, + { + "name": "StoreUpdateMember", + "type": "dojo::world::world_contract::world::StoreUpdateMember", + "kind": "nested" + }, + { + "name": "StoreDelRecord", + "type": "dojo::world::world_contract::world::StoreDelRecord", + "kind": "nested" + }, + { + "name": "WriterUpdated", + "type": "dojo::world::world_contract::world::WriterUpdated", + "kind": "nested" + }, + { + "name": "OwnerUpdated", + "type": "dojo::world::world_contract::world::OwnerUpdated", + "kind": "nested" + } + ] + } + ] + }, + "contracts": [ + { + "address": "0x3ec6f61148e0bf0dcf68c31441e28c0d1988fda7081db5fdc137889af5bdad2", + "class_hash": "0x32b12f5c4ce3a3e31017409f3ffc07857822e986634d492b7ccabb796333d08", + "abi": [ + { + "type": "impl", + "name": "LSTournament__ContractImpl", + "interface_name": "dojo::contract::interface::IContract" + }, + { + "type": "interface", + "name": "dojo::contract::interface::IContract", + "items": [] + }, + { + "type": "impl", + "name": "LSTournament__DeployedContractImpl", + "interface_name": "dojo::meta::interface::IDeployedResource" + }, + { + "type": "struct", + "name": "core::byte_array::ByteArray", + "members": [ + { + "name": "data", + "type": "core::array::Array::" + }, + { + "name": "pending_word", + "type": "core::felt252" + }, + { + "name": "pending_word_len", + "type": "core::integer::u32" + } + ] + }, + { + "type": "interface", + "name": "dojo::meta::interface::IDeployedResource", + "items": [ + { + "type": "function", + "name": "dojo_name", + "inputs": [], + "outputs": [ + { + "type": "core::byte_array::ByteArray" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "enum", + "name": "core::bool", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "type": "function", + "name": "dojo_init", + "inputs": [ + { + "name": "safe_mode", + "type": "core::bool" + }, + { + "name": "test_mode", + "type": "core::bool" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "impl", + "name": "WorldProviderImpl", + "interface_name": "dojo::contract::components::world_provider::IWorldProvider" + }, + { + "type": "struct", + "name": "dojo::world::iworld::IWorldDispatcher", + "members": [ + { + "name": "contract_address", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "type": "interface", + "name": "dojo::contract::components::world_provider::IWorldProvider", + "items": [ + { + "type": "function", + "name": "world_dispatcher", + "inputs": [], + "outputs": [ + { + "type": "dojo::world::iworld::IWorldDispatcher" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "UpgradeableImpl", + "interface_name": "dojo::contract::components::upgradeable::IUpgradeable" + }, + { + "type": "interface", + "name": "dojo::contract::components::upgradeable::IUpgradeable", + "items": [ + { + "type": "function", + "name": "upgrade", + "inputs": [ + { + "name": "new_class_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "TournamentImpl", + "interface_name": "tournament::ls15_components::tournament::ITournament" + }, + { + "type": "struct", + "name": "tournament::ls15_components::models::tournament::EntryCriteria", + "members": [ + { + "name": "token_id", + "type": "core::integer::u128" + }, + { + "name": "entry_count", + "type": "core::integer::u64" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "enum", + "name": "tournament::ls15_components::models::tournament::GatedEntryType", + "variants": [ + { + "name": "criteria", + "type": "core::array::Span::" + }, + { + "name": "uniform", + "type": "core::integer::u64" + } + ] + }, + { + "type": "struct", + "name": "tournament::ls15_components::models::tournament::GatedToken", + "members": [ + { + "name": "token", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "entry_type", + "type": "tournament::ls15_components::models::tournament::GatedEntryType" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "enum", + "name": "tournament::ls15_components::models::tournament::GatedType", + "variants": [ + { + "name": "token", + "type": "tournament::ls15_components::models::tournament::GatedToken" + }, + { + "name": "tournament", + "type": "core::array::Span::" + }, + { + "name": "address", + "type": "core::array::Span::" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "tournament::ls15_components::models::tournament::GatedType" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "tournament::ls15_components::models::tournament::Premium", + "members": [ + { + "name": "token", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "token_amount", + "type": "core::integer::u128" + }, + { + "name": "token_distribution", + "type": "core::array::Span::" + }, + { + "name": "creator_fee", + "type": "core::integer::u8" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "tournament::ls15_components::models::tournament::Premium" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "tournament::ls15_components::models::tournament::TournamentModel", + "members": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + }, + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "description", + "type": "core::byte_array::ByteArray" + }, + { + "name": "creator", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "registration_start_time", + "type": "core::integer::u64" + }, + { + "name": "registration_end_time", + "type": "core::integer::u64" + }, + { + "name": "start_time", + "type": "core::integer::u64" + }, + { + "name": "end_time", + "type": "core::integer::u64" + }, + { + "name": "submission_period", + "type": "core::integer::u64" + }, + { + "name": "winners_count", + "type": "core::integer::u8" + }, + { + "name": "gated_type", + "type": "core::option::Option::" + }, + { + "name": "entry_premium", + "type": "core::option::Option::" + } + ] + }, + { + "type": "struct", + "name": "core::integer::u256", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "enum", + "name": "tournament::ls15_components::models::tournament::GatedSubmissionType", + "variants": [ + { + "name": "token_id", + "type": "core::integer::u256" + }, + { + "name": "game_id", + "type": "core::array::Span::" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "tournament::ls15_components::models::tournament::GatedSubmissionType" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "core::integer::u64" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "tournament::ls15_components::models::tournament::ERC20Data", + "members": [ + { + "name": "token_amount", + "type": "core::integer::u128" + } + ] + }, + { + "type": "struct", + "name": "tournament::ls15_components::models::tournament::ERC721Data", + "members": [ + { + "name": "token_id", + "type": "core::integer::u128" + } + ] + }, + { + "type": "enum", + "name": "tournament::ls15_components::models::tournament::TokenDataType", + "variants": [ + { + "name": "erc20", + "type": "tournament::ls15_components::models::tournament::ERC20Data" + }, + { + "name": "erc721", + "type": "tournament::ls15_components::models::tournament::ERC721Data" + } + ] + }, + { + "type": "interface", + "name": "tournament::ls15_components::tournament::ITournament", + "items": [ + { + "type": "function", + "name": "total_tournaments", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "tournament", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + } + ], + "outputs": [ + { + "type": "tournament::ls15_components::models::tournament::TournamentModel" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "tournament_entries", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + } + ], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "tournament_prize_keys", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + } + ], + "outputs": [ + { + "type": "core::array::Array::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "top_scores", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + } + ], + "outputs": [ + { + "type": "core::array::Array::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "is_token_registered", + "inputs": [ + { + "name": "token", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "create_tournament", + "inputs": [ + { + "name": "name", + "type": "core::felt252" + }, + { + "name": "description", + "type": "core::byte_array::ByteArray" + }, + { + "name": "registration_start_time", + "type": "core::integer::u64" + }, + { + "name": "registration_end_time", + "type": "core::integer::u64" + }, + { + "name": "start_time", + "type": "core::integer::u64" + }, + { + "name": "end_time", + "type": "core::integer::u64" + }, + { + "name": "submission_period", + "type": "core::integer::u64" + }, + { + "name": "winners_count", + "type": "core::integer::u8" + }, + { + "name": "gated_type", + "type": "core::option::Option::" + }, + { + "name": "entry_premium", + "type": "core::option::Option::" + } + ], + "outputs": [ + { + "type": "core::integer::u64" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "enter_tournament", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + }, + { + "name": "gated_submission_type", + "type": "core::option::Option::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "start_tournament", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + }, + { + "name": "start_all", + "type": "core::bool" + }, + { + "name": "start_count", + "type": "core::option::Option::" + }, + { + "name": "client_reward_address", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "golden_token_free_game_token_ids", + "type": "core::array::Span::" + }, + { + "name": "blobert_free_game_token_ids", + "type": "core::array::Span::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "submit_scores", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + }, + { + "name": "game_ids", + "type": "core::array::Array::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "add_prize", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + }, + { + "name": "token", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "token_data_type", + "type": "tournament::ls15_components::models::tournament::TokenDataType" + }, + { + "name": "position", + "type": "core::integer::u8" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "distribute_prizes", + "inputs": [ + { + "name": "tournament_id", + "type": "core::integer::u64" + }, + { + "name": "prize_keys", + "type": "core::array::Array::" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [] + }, + { + "type": "event", + "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", + "kind": "struct", + "members": [ + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", + "kind": "enum", + "variants": [ + { + "name": "Upgraded", + "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Upgraded", + "kind": "nested" + } + ] + }, + { + "type": "event", + "name": "dojo::contract::components::world_provider::world_provider_cpt::Event", + "kind": "enum", + "variants": [] + }, + { + "type": "event", + "name": "tournament::ls15_components::tournament::tournament_component::Event", + "kind": "enum", + "variants": [] + }, + { + "type": "event", + "name": "tournament::presets::ls_tournament::LSTournament::Event", + "kind": "enum", + "variants": [ + { + "name": "UpgradeableEvent", + "type": "dojo::contract::components::upgradeable::upgradeable_cpt::Event", + "kind": "nested" + }, + { + "name": "WorldProviderEvent", + "type": "dojo::contract::components::world_provider::world_provider_cpt::Event", + "kind": "nested" + }, + { + "name": "TournamentEvent", + "type": "tournament::ls15_components::tournament::tournament_component::Event", + "kind": "nested" + } + ] + } + ], + "init_calldata": [ + "1", + "1" + ], + "tag": "tournament-LSTournament", + "selector": "0x4d91e5e6083e568f5c87da757268b5836ab2964b5f032aea89770b0efc7c1d1", + "systems": [ + "dojo_init", + "upgrade", + "create_tournament", + "enter_tournament", + "start_tournament", + "submit_scores", + "add_prize", + "distribute_prizes" + ] + } + ], + "models": [ + { + "members": [], + "class_hash": "0x4766e2104ae737cac443b65f07e78a2de54a19e0df4c0a11be9cedb54818c3", + "tag": "tournament-PrizesModel", + "selector": "0x1a9358131792728720a66362cf2ddca41d488d4a8c13eaaa2d8730f224449df" + }, + { + "members": [], + "class_hash": "0x79a9e0d86ffe7819e5d3737c204ba8ba285a475dc483177febb8874c588610d", + "tag": "tournament-TokenModel", + "selector": "0x7f2b49a07370ee5a1e6b35e73bedf96c756ccb2cf65a00a95b83065cfffa782" + }, + { + "members": [], + "class_hash": "0x6c8cd421a29492799f81c1c8754c842ae485eac586aa8162c24d2dfe0cb8252", + "tag": "tournament-TournamentConfig", + "selector": "0x547cd590eea00da15c7206cf56bafbdacb70341a5648eef169c86d20c7ad77f" + }, + { + "members": [], + "class_hash": "0x15045c99caf1ba662af17e0ba29b9725f47fd3f95207b57d2a2ef2387ae09cb", + "tag": "tournament-TournamentEntriesAddressModel", + "selector": "0x71659e89e02c8054a9ee89b6ef3b04f97025504bfa64f6a44a2c1dbaad60711" + }, + { + "members": [], + "class_hash": "0x66f62f2e8782f15fa4f14ebd3213704f711913bf8852f8a12c0930aa7ba384a", + "tag": "tournament-TournamentEntriesModel", + "selector": "0x787b519928439e6de14689473e9eeb5223091838eed32dace6640ef63e2ac56" + }, + { + "members": [], + "class_hash": "0x2e9e1ce1f4afe90bb74e5f90d7f11296d98db41e81a9d2b07bf8f4cbcc94b04", + "tag": "tournament-TournamentEntryAddressesModel", + "selector": "0x175b45ad6db343cfcff5174d95bc2549b4e8cf525c7907497e29714fd9ea884" + }, + { + "members": [], + "class_hash": "0x44ddf68d5710e74cc16fc5674dc738c8be3bae56e86ba40b645edccad53026d", + "tag": "tournament-TournamentGameModel", + "selector": "0x3e94ec58d1d01189e7114beb849991c249f418dce68a2568504b67c4252ffbc" + }, + { + "members": [], + "class_hash": "0x2a5caae81f997ca91f32eb1f6f60e5cf1b61050dc97d987d6979d1be86a688e", + "tag": "tournament-TournamentModel", + "selector": "0x452449132e96ffddd83f75e1471014c0f4752fb593b27aafb0f425e9836c504" + }, + { + "members": [], + "class_hash": "0x4b1f1c062766f1b787287d21b9de38d818dbeee7d37c4262d0856364cc7a569", + "tag": "tournament-TournamentPrizeKeysModel", + "selector": "0x10b3843f17a028b62ea3d6db5833c6bea22d61140b0b994e5a69e16bf2bcdc5" + }, + { + "members": [], + "class_hash": "0x6ea2fb94513d419182e01e6575746f75eff98eb0f39690038e8a495c04f4e08", + "tag": "tournament-TournamentScoresModel", + "selector": "0x39b0a2c2f4017e26ed1130316f14fcfec08d95641ed83c6feaef21f1bd88f08" + }, + { + "members": [], + "class_hash": "0x5386af0a072f5b2c4421d03d202b255450f0df747da6c6a8c8b111e96462d05", + "tag": "tournament-TournamentStartIdsModel", + "selector": "0x719510df98fc502f639f308423cf7bbade37f1aec860bdaf5a808fa98ac9bb5" + }, + { + "members": [], + "class_hash": "0x4950bc11bd7f1b882b0568a6dcb729632375ed1e7342847ef0bfe518efba1d0", + "tag": "tournament-TournamentStartsAddressModel", + "selector": "0x44f795f6b0fa3ee06bc882e7ed44a1b6fd870482f6a9e73e4dc92b3e84b1421" + }, + { + "members": [], + "class_hash": "0x19df61623fab0c370d90f46bec4b961e7f5108dcaa2f39d3f337485db382804", + "tag": "tournament-TournamentTotalsModel", + "selector": "0x5635b69aebcc262c6c518af7c6454723ddf084e47a8db84c4030cd590ae24ba" + } + ], + "events": [] +} \ No newline at end of file diff --git a/tournament-ui/.env b/tournament-ui/.env index 3673ef7..ccf7b78 100644 --- a/tournament-ui/.env +++ b/tournament-ui/.env @@ -1 +1 @@ -VITE_CHAIN_ID=WP_LS_TOURNAMENTS_KATANA \ No newline at end of file +VITE_CHAIN_ID=SN_MAINNET \ No newline at end of file diff --git a/tournament-ui/src/components/create/TournamentEntryFee.tsx b/tournament-ui/src/components/create/TournamentEntryFee.tsx index e3bc0e8..ab9f1b4 100644 --- a/tournament-ui/src/components/create/TournamentEntryFee.tsx +++ b/tournament-ui/src/components/create/TournamentEntryFee.tsx @@ -58,14 +58,16 @@ const TournamentEntryFee = () => { ); useEffect(() => { - const entryFeeValue = new CairoOption(CairoOptionVariant.Some, { - token: selectedToken?.token!, - token_amount: amount, - token_distribution: payouts, - creator_fee: creatorFee, - }); + if (amount && creatorFee && payouts && selectedToken) { + const entryFeeValue = new CairoOption(CairoOptionVariant.Some, { + token: selectedToken?.token!, + token_amount: amount, + token_distribution: payouts, + creator_fee: creatorFee, + }); - setFormData({ ...formData, entryFee: entryFeeValue }); + setFormData({ ...formData, entryFee: entryFeeValue }); + } }, [amount, creatorFee, payouts, selectedToken]); return ( diff --git a/tournament-ui/src/components/tournament/GamesTable.tsx b/tournament-ui/src/components/tournament/GamesTable.tsx index 72bd99b..1ef9ebf 100644 --- a/tournament-ui/src/components/tournament/GamesTable.tsx +++ b/tournament-ui/src/components/tournament/GamesTable.tsx @@ -45,7 +45,7 @@ const GamesTable = ({ adventurersData }: GamesTableProps) => { - + diff --git a/tournament-ui/src/components/tournament/StartTournament.tsx b/tournament-ui/src/components/tournament/StartTournament.tsx index 7e4f874..dc1065f 100644 --- a/tournament-ui/src/components/tournament/StartTournament.tsx +++ b/tournament-ui/src/components/tournament/StartTournament.tsx @@ -26,8 +26,8 @@ interface StartTournamentProps { currentAddressStartCount: BigNumberish; entryAddressCount: BigNumberish; entryCount: BigNumberish; - usableGoldenTokens: number[]; - usableBlobertTokens: number[]; + usableGoldenTokens: string[]; + usableBlobertTokens: string[]; } const StartTournament = ({ @@ -259,6 +259,8 @@ const StartTournament = ({ }); } + console.log(totalVRFCost); + const ethTokenDataType = new CairoCustomEnum({ erc20: { token_amount: totalVRFCost, @@ -291,6 +293,7 @@ const StartTournament = ({ ) ) : []; + console.log(slicedUsableBlobertTokens); for (const goldenTokenId of slicedUsableGoldenTokens) { const goldenTokenDataType = new CairoCustomEnum({ diff --git a/tournament-ui/src/config.ts b/tournament-ui/src/config.ts index be1e5d0..8d52494 100644 --- a/tournament-ui/src/config.ts +++ b/tournament-ui/src/config.ts @@ -40,10 +40,11 @@ export enum ChainId { SN_MAINNET = "SN_MAINNET", } +// TODO: fix for running between katana and mainnet const supportedChainIds: ChainId[] = [ - ChainId.KATANA_LOCAL, + // ChainId.KATANA_LOCAL, // ChainId.SN_SEPOLIA, - ChainId.WP_LS_TOURNAMENTS_KATANA, + // ChainId.WP_LS_TOURNAMENTS_KATANA, // ChainId.TOURNAMENT_STAGING, ChainId.SN_MAINNET, ]; diff --git a/tournament-ui/src/containers/Tournament.tsx b/tournament-ui/src/containers/Tournament.tsx index 4452d5d..796b62f 100644 --- a/tournament-ui/src/containers/Tournament.tsx +++ b/tournament-ui/src/containers/Tournament.tsx @@ -37,6 +37,7 @@ const Tournament = () => { } = useDojo(); const { setInputDialog } = useUIStore(); const { usableGoldenTokens, usableBlobertTokens } = useFreeGames(); + console.log(usableBlobertTokens); const isMainnet = selectedChainConfig.chainId === "SN_MAINNET"; diff --git a/tournament-ui/src/hooks/useFreeGames.tsx b/tournament-ui/src/hooks/useFreeGames.tsx index 04ba993..33a7d8c 100644 --- a/tournament-ui/src/hooks/useFreeGames.tsx +++ b/tournament-ui/src/hooks/useFreeGames.tsx @@ -15,8 +15,8 @@ const useFreeGames = () => { const { tokenBalance } = useUIStore(); const { provider } = useProvider(); const { goldenToken, blobert, lootSurvivor } = useTournamentContracts(); - const [usableGoldenTokens, setUsableGoldenTokens] = useState([]); - const [usableBlobertTokens, setUsableBlobertTokens] = useState([]); + const [usableGoldenTokens, setUsableGoldenTokens] = useState([]); + const [usableBlobertTokens, setUsableBlobertTokens] = useState([]); const isMainnet = selectedChainConfig.chainId === "SN_MAINNET"; @@ -71,7 +71,7 @@ const useFreeGames = () => { const blobertTokenVariables = useMemo(() => { return { - token: indexAddress(blobert), + token: indexAddress(blobert ?? ""), owner: indexAddress(account?.address ?? "").toLowerCase(), }; }, [account?.address]); @@ -81,30 +81,34 @@ const useFreeGames = () => { blobertTokenVariables ); - const getUsableBlobertToken = async (tokenIds: number[]) => { - for (let tokenId of tokenIds) { + const getUsableBlobertToken = async (bloberts: any[]) => { + const usableTokens: string[] = []; + for (let blobert of bloberts) { const canPlay = await provider.callContract({ contractAddress: lootSurvivor, entrypoint: "free_game_available", - calldata: ["1", tokenId.toString()], + calldata: ["1", blobert.tokenId.toString()], }); - if (canPlay) { - setUsableBlobertTokens([...usableBlobertTokens, tokenId]); + if ((canPlay[0] as unknown as string) !== "0x0") { + usableTokens.push(blobert.tokenId.toString()); } } + setUsableBlobertTokens(usableTokens); }; const getUsableGoldenToken = async (tokenIds: number[]) => { + const usableTokens: string[] = []; for (let tokenId of tokenIds) { const canPlay = await provider.callContract({ contractAddress: lootSurvivor, entrypoint: "free_game_available", calldata: ["0", tokenId.toString()], }); - if (canPlay) { - setUsableGoldenTokens([...usableGoldenTokens, tokenId]); + if ((canPlay[0] as unknown as string) !== "0x0") { + usableTokens.push(tokenId.toString()); } } + setUsableGoldenTokens(usableTokens); }; useEffect(() => { @@ -117,21 +121,22 @@ const useFreeGames = () => { } else { const arr = Array.from( { length: Number(tokenBalance.goldenToken) }, - (_, i) => i + 1 + (_, i) => String(i + 1) ); setUsableGoldenTokens(arr); } }, [account?.address, tokenBalance.goldenToken, isMainnet]); + console.log(blobertsData); + useEffect(() => { if (isMainnet) { if (blobertsData) { - getUsableBlobertToken(blobertsData); + getUsableBlobertToken(blobertsData.tokens); } } else { - const arr = Array.from( - { length: Number(tokenBalance.blobert) }, - (_, i) => i + 1 + const arr = Array.from({ length: Number(tokenBalance.blobert) }, (_, i) => + String(i + 1) ); setUsableBlobertTokens(arr); } diff --git a/tournament-ui/src/useSystemCalls.ts b/tournament-ui/src/useSystemCalls.ts index 6dc39b2..124b271 100644 --- a/tournament-ui/src/useSystemCalls.ts +++ b/tournament-ui/src/useSystemCalls.ts @@ -130,19 +130,19 @@ export const useSystemCalls = () => { const resolvedClient = await client; const tournamentContract = selectTournament(resolvedClient, isMainnet); const tx = await tournamentContract.enterTournament( - account as Account, + account!, tournamentId, gatedSubmissionType ); + await wait(); + if (tx) { toast({ title: "Entered Tournament!", description: `Entered tournament ${tournamentName}`, }); } - - await wait(); } catch (error) { revert(); console.error("Error executing enter tournament:", error); @@ -187,14 +187,16 @@ export const useSystemCalls = () => { usableBlobertTokens ); + console.log(tx); + + await wait(); + if (tx) { toast({ title: "Started Tournament!", description: `Started tournament ${tournamentName}`, }); } - - await wait(); } catch (error) { revert(); console.error("Error executing create tournament:", error); @@ -267,14 +269,14 @@ export const useSystemCalls = () => { prize.position ); + await wait(); + if (showToast && tx) { toast({ title: "Added Prize!", description: `Added prize for tournament ${tournamentName}`, }); } - - await wait(); } catch (error) { revert(); console.error("Error executing add prize:", error);
NameRank Address ID Level