Skip to content

cartridge-gg/piltover

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

bc36b5f · Jan 28, 2025

History

40 Commits
Jan 10, 2025
Jan 28, 2025
Mar 12, 2024
Jan 28, 2025
Jan 28, 2025
Jan 28, 2025
Mar 12, 2024
Jan 10, 2025
Jan 29, 2024
Jan 29, 2024
Jan 28, 2025
Sep 6, 2024
Jan 10, 2025

Repository files navigation

Check Workflow Status Build Workflow Status

Exploration_Team

Overview

Starknet Core Contract components in Cairo.

Repository architecture

The different tasks of the Starknet Core Contract are here mapped to what we can call an "Appchain" Core Contract.

The functionalities of the core contract are split over several components. Each component is usually placed into a directory, event if it is simple. Doing so allow a good separation of additional files that may be written in the context of a component.

Due to a limitation of starknet foundry, we can't declare a contract that is defined under the tests directory. For this reason, mock contract are defined in their respective component location. This is also a good way for the component write to illustrate the minimum required to use the component.

  • appchain.cairo: core contract of the appchain on Starknet.

  • config: base configuration for the core contract.

  • messaging: messaging between Appchain - Starknet.

Build

To build the project, run:

scarb build

Bindings (Rust)

To build/update the bindings, first build the contract with scarb.

Then, within the Rust project bindings/ run:

cargo build --bin generator

This will generate the bindings into src/lib.rs, which can be imported in other Rust project. Currently some warnings are displayed, will be fixed in a future version of cainome.

Test

To test the project, run:

scarb test --all-features

Or using the script (where further tests may be added in the future):

bash scripts/test_all_features.sh

Code style (cairo)

  • Use snake_case for module name and not PascalCase.

  • Don't import directly a function from a module.

// Prefer that:
let addr = starknet::contract_address_const::<0>();

// Instead of:
use starknet::contract_address_const;
let addr = contract_address_const::<0>();
  • Document functions inside the trait, and add details if needed in the implementation.

To enforce the cairo linter, please use:

bash scripts/cairo_fmt.sh --fix

About

Starknet Core Contract components in Cairo.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 68.4%
  • Cairo 31.5%
  • Shell 0.1%