starknet_devnet_core/
constants.rs

1use std::net::{IpAddr, Ipv4Addr};
2use std::num::NonZeroU128;
3
4use nonzero_ext::nonzero;
5use starknet_rs_core::types::Felt;
6use starknet_types::chain_id::ChainId;
7use starknet_types::num_bigint::BigUint;
8
9pub const CAIRO_0_ACCOUNT_CONTRACT: &str = include_str!(concat!(
10    env!("CARGO_MANIFEST_DIR"),
11    "/contracts/accounts_artifacts/OpenZeppelin/0.5.1/Account.cairo/Account.json"
12));
13pub const CAIRO_0_ACCOUNT_CONTRACT_HASH: &str =
14    "0x4d07e40e93398ed3c76981e72dd1fd22557a78ce36c0515f679e27f0bb5bc5f";
15
16/// only used in tests; if artifact needed in production, use CAIRO_1_ACCOUNT_CONTRACT_SIERRA
17pub const CAIRO_1_ACCOUNT_CONTRACT_SIERRA_PATH: &str = concat!(
18    env!("CARGO_MANIFEST_DIR"),
19    "/contracts/accounts_artifacts/OpenZeppelin/1.0.0/Account.cairo/Account.sierra"
20);
21pub const CAIRO_1_ACCOUNT_CONTRACT_SIERRA: &str = include_str!(concat!(
22    env!("CARGO_MANIFEST_DIR"),
23    "/contracts/accounts_artifacts/OpenZeppelin/1.0.0/Account.cairo/Account.sierra"
24));
25pub const CAIRO_1_ACCOUNT_CONTRACT_SIERRA_HASH: &str =
26    "0x05b4b537eaa2399e3aa99c4e2e0208ebd6c71bc1467938cd52c798c601e43564";
27
28pub const ETH_ERC20_CONTRACT_CLASS_HASH: Felt =
29    Felt::from_hex_unchecked("0x9524a94b41c4440a16fd96d7c1ef6ad6f44c1c013e96662734502cd4ee9b1f");
30pub const ETH_ERC20_CONTRACT_CLASS: &str = include_str!(concat!(
31    env!("CARGO_MANIFEST_DIR"),
32    "/contracts/system_artifacts/erc20_eth.sierra"
33));
34pub const ETH_ERC20_CONTRACT_ADDRESS: Felt =
35    Felt::from_hex_unchecked("0x49D36570D4E46F48E99674BD3FCC84644DDD6B96F7C741B1562B82F9E004DC7");
36
37pub const STRK_ERC20_CONTRACT_CLASS_HASH: Felt =
38    Felt::from_hex_unchecked("0x76791ef97c042f81fbf352ad95f39a22554ee8d7927b2ce3c681f3418b5206a");
39pub const STRK_ERC20_CONTRACT_CLASS: &str = include_str!(concat!(
40    env!("CARGO_MANIFEST_DIR"),
41    "/contracts/system_artifacts/erc20_strk.sierra"
42));
43pub const STRK_ERC20_CONTRACT_ADDRESS: Felt =
44    Felt::from_hex_unchecked("0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d");
45
46// ERC20 contracts storage variables; available in source at https://github.com/starknet-io/starkgate-contracts
47pub const ETH_ERC20_NAME: &str = "Ether";
48pub const ETH_ERC20_SYMBOL: &str = "ETH";
49pub const STRK_ERC20_NAME: &str = "StarkNet Token";
50pub const STRK_ERC20_SYMBOL: &str = "STRK";
51
52pub(crate) const UDC_LEGACY_CONTRACT: &str = include_str!(concat!(
53    env!("CARGO_MANIFEST_DIR"),
54    "/contracts/system_artifacts/UDC_OZ_0.5.0.json"
55));
56pub const UDC_LEGACY_CONTRACT_CLASS_HASH: Felt =
57    Felt::from_hex_unchecked("0x7B3E05F48F0C69E4A65CE5E076A66271A527AFF2C34CE1083EC6E1526997A69");
58pub const UDC_LEGACY_CONTRACT_ADDRESS: Felt =
59    Felt::from_hex_unchecked("0x41A78E741E5AF2FEC34B695679BC6891742439F7AFB8484ECD7766661AD02BF");
60
61pub(crate) const UDC_CONTRACT: &str =
62    include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/contracts/system_artifacts/udc_2.sierra"));
63pub const UDC_CONTRACT_CLASS_HASH: Felt =
64    Felt::from_hex_unchecked("0x01b2df6d8861670d4a8ca4670433b2418d78169c2947f46dc614e69f333745c8");
65pub const UDC_CONTRACT_ADDRESS: Felt =
66    Felt::from_hex_unchecked("0x02ceed65a4bd731034c01113685c831b01c15d7d432f71afb1cf1634b53a2125");
67
68/// https://github.com/argentlabs/argent-contracts-starknet/blob/main/deployments/account.txt
69pub const ARGENT_CONTRACT_VERSION: &str = "0.4.0";
70pub(crate) const ARGENT_CONTRACT_SIERRA: &str = include_str!(concat!(
71    env!("CARGO_MANIFEST_DIR"),
72    "/contracts/accounts_artifacts/Argent/argent_0.4.0.sierra"
73));
74pub const ARGENT_CONTRACT_CLASS_HASH: Felt =
75    Felt::from_hex_unchecked("0x36078334509b514626504edc9fb252328d1a240e4e948bef8d0c08dff45927f");
76
77/// https://github.com/argentlabs/argent-contracts-starknet/blob/main/deployments/multisig.txt
78pub const ARGENT_MULTISIG_CONTRACT_VERSION: &str = "0.2.0";
79pub(crate) const ARGENT_MULTISIG_CONTRACT_SIERRA: &str = include_str!(concat!(
80    env!("CARGO_MANIFEST_DIR"),
81    "/contracts/accounts_artifacts/Argent/argent_multisig_0.2.0.sierra"
82));
83pub const ARGENT_MULTISIG_CONTRACT_CLASS_HASH: Felt =
84    Felt::from_hex_unchecked("0x7aeca3456816e3b833506d7cc5c1313d371fbdb0ae95ee70af72a4ddbf42594");
85
86/// https://github.com/OpenZeppelin/cairo-contracts/blob/89a450a88628ec3b86273f261b2d8d1ca9b1522b/src/account/interface.cairo#L7
87pub const ISRC6_ID_HEX: &str = "0x2ceccef7f994940b3962a6c67e0ba4fcd37df7d131417c604f91e03caecc1cd";
88
89pub const STARKNET_VERSION: &str = "0.14.1";
90
91pub const DEVNET_DEFAULT_SEED: u32 = 123;
92pub const DEVNET_DEFAULT_TEST_SEED: u32 = 123;
93pub const DEVNET_DEFAULT_TOTAL_ACCOUNTS: u8 = 10;
94pub const DEVNET_DEFAULT_INITIAL_BALANCE: u128 = 1_000_000_000_000_000_000_000;
95pub const DEVNET_DEFAULT_L1_GAS_PRICE: NonZeroU128 = nonzero!(1_000_000_000u128);
96pub const DEVNET_DEFAULT_L1_DATA_GAS_PRICE: NonZeroU128 = nonzero!(1_000_000_000u128);
97pub const DEVNET_DEFAULT_L2_GAS_PRICE: NonZeroU128 = nonzero!(1_000_000_000u128);
98pub const DEVNET_DEFAULT_HOST: IpAddr = IpAddr::V4(Ipv4Addr::LOCALHOST);
99pub const DEVNET_DEFAULT_PORT: u16 = 5050;
100pub const DEVNET_DEFAULT_TIMEOUT: u16 = 120;
101pub const DEVNET_DEFAULT_CHAIN_ID: ChainId = ChainId::Testnet;
102pub const DEVNET_DEFAULT_STARTING_BLOCK_NUMBER: u64 = 0;
103
104pub const USE_KZG_DA: bool = true;
105
106// chargeable account
107pub const CHARGEABLE_ACCOUNT_PUBLIC_KEY: &str =
108    "0x4C37AB4F0994879337BFD4EAD0800776DB57DA382B8ED8EFAA478C5D3B942A4";
109pub const CHARGEABLE_ACCOUNT_PRIVATE_KEY: &str = "0x5FB2959E3011A873A7160F5BB32B0ECE";
110pub const CHARGEABLE_ACCOUNT_ADDRESS: &str =
111    "0x1CAF2DF5ED5DDE1AE3FAEF4ACD72522AC3CB16E23F6DC4C7F9FAED67124C511";
112pub fn chargeable_account_initial_balance() -> BigUint {
113    // Ideally, this would be a constant, but defining it as a string introduces parsing issues and
114    // making lazy_static a dependency seems too much.
115    BigUint::from(1_u32) << 255
116}
117
118pub const ENTRYPOINT_NOT_FOUND_ERROR_ENCODED: Felt =
119    Felt::from_hex_unchecked("0x454e545259504f494e545f4e4f545f464f554e44");
120
121pub const MAXIMUM_CONTRACT_CLASS_SIZE: u64 = 4_089_446;
122pub const MAXIMUM_CONTRACT_BYTECODE_SIZE: u64 = 81_920;
123pub const MAXIMUM_SIERRA_LENGTH: u64 = 81_920;