Skip to content

Commit

Permalink
feat: add main logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ericnordelo committed Jan 2, 2025
1 parent 5bebd2d commit b75027f
Show file tree
Hide file tree
Showing 7 changed files with 527 additions and 56 deletions.
41 changes: 38 additions & 3 deletions packages/macros/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ crate-type = ["cdylib"]
cairo-lang-macro = "0.1"
cairo-lang-parser = "2.9"
cairo-lang-syntax = "2.9"
cairo-lang-defs = "2.9"
indoc = "2.0.5"
regex = "1.11.1"
itertools = "0.14.0"
8 changes: 8 additions & 0 deletions packages/macros/src/constants.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pub const TAB: &str = " ";

pub const CONTRACT_ATTRIBUTE: &str = "starknet::contract";
pub const CONSTRUCTOR_ATTRIBUTE: &str = "constructor";
pub const STORAGE_STRUCT_NAME: &str = "Storage";
pub const EVENT_ENUM_NAME: &str = "Event";
pub const SUBSTORAGE_ATTRIBUTE: &str = "substorage(v0)";
pub const FLAT_ATTRIBUTE: &str = "flat";
4 changes: 3 additions & 1 deletion packages/macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
mod oz_component;
mod constants;
mod utils;
mod with_components;
52 changes: 0 additions & 52 deletions packages/macros/src/oz_component.rs

This file was deleted.

7 changes: 7 additions & 0 deletions packages/macros/src/utils.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use crate::constants::TAB;
use std::iter::repeat;

/// Generates a string with `n` tabs.
pub fn tabs(n: usize) -> String {
repeat(TAB).take(n).collect()
}
Loading

0 comments on commit b75027f

Please sign in to comment.