Cairo 1.0 Q&A #2267
Replies: 8 comments 5 replies
-
Hi, Is it possible to execute bitwise operations on felts?.
|
Beta Was this translation helpful? Give feedback.
-
I try to declare the official hello_starknet contract with command: And I get error:
Maybe my starknet version is wrong? Or just the official contract does't work? starknet version: |
Beta Was this translation helpful? Give feedback.
-
When I update a mutable variable inside a break condition of a loop it throw an error. This is the code:
and this is the error:
This error is kind of odd, shouldn't this logic valid in Cairo1? |
Beta Was this translation helpful? Give feedback.
-
How to write code in Cairo that is similar to Rust's
use case:
|
Beta Was this translation helpful? Give feedback.
-
In /// Generate getters and setters skeleton for a non-mapping member in the storage struct.
fn handle_legacy_mapping_storage_var(address: &str) -> String {
format!(
"
mod $storage_var_name$ {{$extra_uses$
use starknet::SyscallResultTrait;
use starknet::SyscallResultTraitImpl;
fn address(key: $key_type$) -> starknet::StorageBaseAddress {{
starknet::storage_base_address_from_felt252(
hash::LegacyHash::<$key_type$>::hash({address}, key))
}}
fn read(key: $key_type$) -> $value_type$ {{
// Only address_domain 0 is currently supported.
let address_domain = 0_u32;
starknet::StorageAccess::<$value_type$>::read(
address_domain,
address(key),
).unwrap_syscall()
}}
fn write(key: $key_type$, value: $value_type$) {{
// Only address_domain 0 is currently supported.
let address_domain = 0_u32;
starknet::StorageAccess::<$value_type$>::write(
address_domain,
address(key),
value,
).unwrap_syscall()
}}
}}"
)
} Note the line
The result of the inner hash is in the |
Beta Was this translation helpful? Give feedback.
-
How can I generate from a cairo file the |
Beta Was this translation helpful? Give feedback.
-
how can i get current block number in cairo contract? Just like block.number in solidity |
Beta Was this translation helpful? Give feedback.
-
Hello! I'm currently utilizing the following crate: Here are my questions:
Thanks in advance for any clarification here! |
Beta Was this translation helpful? Give feedback.
-
Ask all your questions about Cairo 1.0
Beta Was this translation helpful? Give feedback.
All reactions