Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force users to call a contract!() marco at the top of the file #1476

Open
richardpringle opened this issue Aug 29, 2024 · 0 comments
Open

Force users to call a contract!() marco at the top of the file #1476

richardpringle opened this issue Aug 29, 2024 · 0 comments

Comments

@richardpringle
Copy link
Collaborator

richardpringle commented Aug 29, 2024

(alternatively, maybe we could force them to annotate lib.rs with #![contract]. Then we could do something like add a #![contract(bindings_struct = StructName)] where StructName is simply a syn::Ident.

With this we could use cfg directives to specify the #![crate_type = "cdylib"] or #![crate_type = "lib"] depending on whether we're compiling with the bindings feature (the latter for bindings).

Then we could store that struct name in global-state inside sdk-macros and write multiple impl blocks such that using the bindings as a dependency would look something like this (constructor arguments subject to change):

use counter::Counter;

let counter = Counter::new(address, external_call_context);
let val = counter.inc(alice);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant