Contracts Wizard is a web application to interactively build a contract out of components from OpenZeppelin Contracts. Select the kind of contract that you want, set your parameters and desired features, and the Wizard will generate all of the code necessary. The resulting code is ready to be compiled and deployed, or it can serve as a starting point and customized further with application specific logic.
Install dependencies with yarn install
.
packages/core
contains the code generation logic for each language under separately named subfolders. From each language's subfolder:
- Run
yarn test
to run the tests. - Run
yarn test:update-snapshots
to update AVA snapshots and run the tests. - Run
yarn lint
to run the linter across the codebase (optionallyyarn lint --fix
will automatically fix fixable issues, like formatting issues).
packages/ui
is the interface built in Svelte. From the packages/ui
directory, run yarn dev
to spin up a local server to develop the UI.
You'll need to supply your own environment variables if you want to enable Wizard AI Assistant (OPENAI_API_KEY) and/or logging (REDIS_URL, REDIS_TOKEN).
You can run yarn commands directly into core/{language}
folders with yarn run:core
.
For example, running yarn run:core cairo test
from the root directory will run tests for Cairo.
To embed Contracts Wizard on your site, first include the script tag:
<script async src="https://wizard.openzeppelin.com/build/embed.js"></script>
Then place <oz-wizard></oz-wizard>
in the body where you want Contracts Wizard to load.
Optionally focus on specific tab with the data-tab
attribute as in <oz-wizard data-tab="ERC721"></oz-wizard>
.
For languages other than Solidity, use the data-lang
attribute, for example: <oz-wizard data-lang="cairo"></oz-wizard>
.
The following describes how to use the Contracts Wizard programmatic API in your own applications.