JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5170
  • Score
    100M100P100Q140465F
  • License MIT

A boilerplate generator to get started with OpenZeppelin Contracts

Package Exports

  • @openzeppelin/wizard
  • @openzeppelin/wizard/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@openzeppelin/wizard) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

OpenZeppelin Contracts Wizard for Solidity

Interactively build a contract out of components from OpenZeppelin Contracts. Provide parameters and desired features for the kind of contract that you want, 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.

This package provides a programmatic API. For a web interface, see https://wizard.openzeppelin.com

Installation

npm install @openzeppelin/wizard

Contract types

The following contract types are supported:

  • erc20
  • erc721
  • erc1155
  • governor

Each contract type has a print function and a defaults constant as defined below.

Functions

print

function print(opts?: ERC20Options): string
function print(opts?: ERC721Options): string
function print(opts?: ERC1155Options): string
function print(opts?: GovernorOptions): string

Returns a string representation of a contract generated using the provided options. If opts is not provided, uses defaults.

defaults

const defaults: Required<ERC20Options>
const defaults: Required<ERC721Options>
const defaults: Required<ERC1155Options>
const defaults: Required<GovernorOptions>

The default options that are used for print.

Examples

Import the contract type(s) that you want to use from the @openzeppelin/wizard package:

import { erc20 } from '@openzeppelin/wizard';

To generate the source code for an ERC20 contract with all of the default settings:

const contract = erc20.print();

To generate the source code for an ERC20 contract with a custom name and symbol, along with some custom settings:

const contract = erc20.print({
  name: 'ExampleToken',
  symbol: 'ETK',
  burnable: true,
  premint: '1000000',
});

To generate the source code for an ERC20 contract with all of the defaults but is upgradeable using the UUPS proxy pattern:

const contract = erc20.print({
  ...erc20.defaults,
  upgradeable: 'uups',
});