Skip to content

Starknet Core Contract components in Cairo.

License

Notifications You must be signed in to change notification settings

cartridge-gg/piltover

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

Test

To test the project, run:

snforge test

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.

About

Starknet Core Contract components in Cairo.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 61.7%
  • Cairo 38.3%