diff --git a/zink/codegen/src/contract.rs b/zink/codegen/src/contract.rs new file mode 100644 index 000000000..a7992d928 --- /dev/null +++ b/zink/codegen/src/contract.rs @@ -0,0 +1,9 @@ +//! derive macro for contract storage + +use proc_macro::TokenStream; +use syn::ItemStruct; + +/// Parse the input struct and generate the contract storage +pub fn parse(input: ItemStruct) -> TokenStream { + todo!() +} diff --git a/zink/codegen/src/lib.rs b/zink/codegen/src/lib.rs index 776ddaa54..b6a57081a 100644 --- a/zink/codegen/src/lib.rs +++ b/zink/codegen/src/lib.rs @@ -8,6 +8,7 @@ use proc_macro2::Span; use quote::ToTokens; use syn::{parse_macro_input, Attribute, DeriveInput, Expr, ItemFn, ItemStruct, LitStr}; +mod contract; mod event; mod revert; mod selector; @@ -33,6 +34,13 @@ pub fn assert(input: TokenStream) -> TokenStream { revert::parse_assert(input) } +/// Declare contract storage +#[proc_macro_derive(Contract)] +pub fn contract(input: TokenStream) -> TokenStream { + let input = parse_macro_input!(input as ItemStruct); + contract::parse(input) +} + /// Event logging interface /// /// ```ignore