Dusk Forge is a framework designed to simplify the development of smart contracts for the Dusk blockchain. It provides macros to reduce boilerplate, allow developers to focus on implementing core business logic.
⚠️ This crate requires the nightly Rust compiler.
Usage
The main feature of Dusk Forge is the #[contract] attribute macro, which
automates boilerplate generation. Here's how to get started:
Installation
Add dusk_forge as a dependency to your project:
Basic Example: Counter Contract
use contract;
What Happes Under the Hood?
The #[contract] macro transforms the module into a contract-ready state by:
- Generating a
static mut STATEfor the contract's state:
pub static mut STATE: Counter = Counter ;
- Wrapping public methods with
no_manglefunctions for Dusk VM compatibility:
pub unsafe
pub unsafe
Advanced Example: Struct with Complex State
use contract;
Testing
Dusk Force includes tests for macro transformations and tests for individual components. Run tests using:
Release History
To see the release history for this crate, please see the CHANGELOG file.
License
This code is licensed under the Mozilla Public License Version 2.0 (MPL-2.0). Please see the LICENSE for further details.
The included illustration is created by Regisha Dauven and is used with exclusive permission. Redistribution, modification, or reuse of the illustration by third parties is prohibited without explicit permission from the creator.
Contribute
If you want to contribute to this project, feel free to open an issue, fork the repository and open a pull request.