Home
Cairopractice
Cancel

Underhanded Cairo, pt. 1

Here’s a pretty simple Cairo program: use debug::PrintTrait; fn calc(v1: u64, v2: u64) -> (u64, u64) { (v1 + v2, v2 * v2) } fn main() { let mut res: u64 = 0; let mut counter: u64 ...

Mock addresses for testing

When writing tests, we often need mock addresses to represent some entity like an account without actually deploying an initializing an account contract. The obvious thing to do is to use values li...

Updating structs

Deprecation notice: Since this post was published, Starknet and Cairo have evolved. As such, parts of the post might be obsolete. For the best, most up-to-date resources, please consult the officia...

Idiomatic array looping

Deprecation notice: Since this post was published, Starknet and Cairo have evolved. As such, parts of the post might be obsolete. For the best, most up-to-date resources, please consult the officia...

Interface spoofing for fun and performance

Deprecation notice: Since this post was published, Starknet and Cairo have evolved. As such, parts of the post might be obsolete. For the best, most up-to-date resources, please consult the officia...

Storing user defined types, part 2

Deprecation notice: Since this post was published, Starknet and Cairo have evolved. As such, parts of the post might be obsolete. For the best, most up-to-date resources, please consult the officia...

Storing user defined types, part 1

Deprecation notice: Since this post was published, Starknet and Cairo have evolved. As such, parts of the post might be obsolete. For the best, most up-to-date resources, please consult the officia...

Calling contracts using dispatch

Deprecation notice: Since this post was published, Starknet and Cairo have evolved. As such, parts of the post might be obsolete. For the best, most up-to-date resources, please consult the officia...