npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hexlantcontract/hc-wizard

v1.0.8

Published

A boilerplate contract generator forked from openzeppelin

Downloads

68

Readme

Hexlant Contracts Wizard for Solidity

NPM Package

A boilerplate contract generator forked from openzeppelin

Repository

https://bitbucket.org/hexlant/hc-wizard/src/master/

NPM

@hexlantcontract/hc-wizard

Compile usage

import { erc20 } from '@hexlantcontract/hc-wizard';

const { abi, bytecode, code } = erc20.compile({
	access: 'ownable',
  name: 'ExampleFT',
  symbol: 'EFT',
  premint: '1000000',
})

Result

abi

[
  { inputs: [], stateMutability: 'nonpayable', type: 'constructor' },
  {
    anonymous: false,
    inputs: [ [Object], [Object], [Object] ],
    name: 'Approval',
    type: 'event'
  },
  {
    anonymous: false,
    inputs: [ [Object], [Object] ],
    name: 'OwnershipTransferred',
    type: 'event'
  },
  {
    anonymous: false,
    inputs: [ [Object], [Object], [Object] ],
    name: 'Transfer',
    type: 'event'
  },
  {
    inputs: [ [Object], [Object] ],
    name: 'allowance',
    outputs: [ [Object] ],
    stateMutability: 'view',
    type: 'function'
  },
  {
    inputs: [ [Object], [Object] ],
    name: 'approve',
    outputs: [ [Object] ],
    stateMutability: 'nonpayable',
    type: 'function'
  },
  {
    inputs: [ [Object] ],
    name: 'balanceOf',
    outputs: [ [Object] ],
    stateMutability: 'view',
    type: 'function'
  },
  {
    inputs: [],
    name: 'decimals',
    outputs: [ [Object] ],
    stateMutability: 'view',
    type: 'function'
  },
  {
    inputs: [ [Object], [Object] ],
    name: 'decreaseAllowance',
    outputs: [ [Object] ],
    stateMutability: 'nonpayable',
    type: 'function'
  },
  {
    inputs: [ [Object], [Object] ],
    name: 'increaseAllowance',
    outputs: [ [Object] ],
    stateMutability: 'nonpayable',
    type: 'function'
  },
  {
    inputs: [],
    name: 'name',
    outputs: [ [Object] ],
    stateMutability: 'view',
    type: 'function'
  },
  {
    inputs: [],
    name: 'owner',
    outputs: [ [Object] ],
    stateMutability: 'view',
    type: 'function'
  },
  {
    inputs: [],
    name: 'renounceOwnership',
    outputs: [],
    stateMutability: 'nonpayable',
    type: 'function'
  },
  {
    inputs: [],
    name: 'symbol',
    outputs: [ [Object] ],
    stateMutability: 'view',
    type: 'function'
  },
  {
    inputs: [],
    name: 'totalSupply',
    outputs: [ [Object] ],
    stateMutability: 'view',
    type: 'function'
  },
  {
    inputs: [ [Object], [Object] ],
    name: 'transfer',
    outputs: [ [Object] ],
    stateMutability: 'nonpayable',
    type: 'function'
  },
  {
    inputs: [ [Object], [Object], [Object] ],
    name: 'transferFrom',
    outputs: [ [Object] ],
    stateMutability: 'nonpayable',
    type: 'function'
  },
  {
    inputs: [ [Object] ],
    name: 'transferOwnership',
    outputs: [],
    stateMutability: 'nonpayable',
    type: 'function'
  }
]

bytecode

60806040523480156200001157600080fd5b5060405180604001604052806009815260200168115e185b5c1b19519560ba1b8152506040518060400160405280600381526020016211519560ea1b815250816003908051906020019062000068929190620001e5565b5080516200007e906004906020840190620001e5565b5050506200009b62000095620000c960201b60201c565b620000cd565b620000c333620000ae6012600a620003a0565b620000bd90620f4240620003b8565b6200011f565b62000432565b3390565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0382166200017a5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b80600260008282546200018e9190620003da565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b828054620001f390620003f5565b90600052602060002090601f01602090048101928262000217576000855562000262565b82601f106200023257805160ff191683800117855562000262565b8280016001018555821562000262579182015b828111156200026257825182559160200191906001019062000245565b506200027092915062000274565b5090565b5b8082111562000270576000815560010162000275565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115620002e2578160001904821115620002c657620002c66200028b565b80851615620002d457918102915b93841c9390800290620002a6565b509250929050565b600082620002fb575060016200039a565b816200030a575060006200039a565b81600181146200032357600281146200032e576200034e565b60019150506200039a565b60ff8411156200034257620003426200028b565b50506001821b6200039a565b5060208310610133831016604e8410600b841016171562000373575081810a6200039a565b6200037f8383620002a1565b80600019048211156200039657620003966200028b565b0290505b92915050565b6000620003b160ff841683620002ea565b9392505050565b6000816000190483118215151615620003d557620003d56200028b565b500290565b60008219821115620003f057620003f06200028b565b500190565b600181811c908216806200040a57607f821691505b602082108114156200042c57634e487b7160e01b600052602260045260246000fd5b50919050565b610a0f80620004426000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063715018a61161008c578063a457c2d711610066578063a457c2d7146101cd578063a9059cbb146101e0578063dd62ed3e146101f3578063f2fde38b1461020657600080fd5b8063715018a6146101a05780638da5cb5b146101aa57806395d89b41146101c557600080fd5b806323b872dd116100c857806323b872dd14610142578063313ce56714610155578063395093511461016457806370a082311461017757600080fd5b806306fdde03146100ef578063095ea7b31461010d57806318160ddd14610130575b600080fd5b6100f7610219565b604051610104919061084c565b60405180910390f35b61012061011b3660046108bd565b6102ab565b6040519015158152602001610104565b6002545b604051908152602001610104565b6101206101503660046108e7565b6102c3565b60405160128152602001610104565b6101206101723660046108bd565b6102e7565b610134610185366004610923565b6001600160a01b031660009081526020819052604090205490565b6101a8610309565b005b6005546040516001600160a01b039091168152602001610104565b6100f761031d565b6101206101db3660046108bd565b61032c565b6101206101ee3660046108bd565b6103ac565b610134610201366004610945565b6103ba565b6101a8610214366004610923565b6103e5565b60606003805461022890610978565b80601f016020809104026020016040519081016040528092919081815260200182805461025490610978565b80156102a15780601f10610276576101008083540402835291602001916102a1565b820191906000526020600020905b81548152906001019060200180831161028457829003601f168201915b5050505050905090565b6000336102b981858561045e565b5060019392505050565b6000336102d1858285610582565b6102dc8585856105fc565b506001949350505050565b6000336102b98185856102fa83836103ba565b61030491906109b3565b61045e565b6103116107a0565b61031b60006107fa565b565b60606004805461022890610978565b6000338161033a82866103ba565b90508381101561039f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b6102dc828686840361045e565b6000336102b98185856105fc565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6103ed6107a0565b6001600160a01b0381166104525760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610396565b61045b816107fa565b50565b6001600160a01b0383166104c05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610396565b6001600160a01b0382166105215760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610396565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600061058e84846103ba565b905060001981146105f657818110156105e95760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610396565b6105f6848484840361045e565b50505050565b6001600160a01b0383166106605760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610396565b6001600160a01b0382166106c25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610396565b6001600160a01b0383166000908152602081905260409020548181101561073a5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610396565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36105f6565b6005546001600160a01b0316331461031b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610396565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600060208083528351808285015260005b818110156108795785810183015185820160400152820161085d565b8181111561088b576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b03811681146108b857600080fd5b919050565b600080604083850312156108d057600080fd5b6108d9836108a1565b946020939093013593505050565b6000806000606084860312156108fc57600080fd5b610905846108a1565b9250610913602085016108a1565b9150604084013590509250925092565b60006020828403121561093557600080fd5b61093e826108a1565b9392505050565b6000806040838503121561095857600080fd5b610961836108a1565b915061096f602084016108a1565b90509250929050565b600181811c9082168061098c57607f821691505b602082108114156109ad57634e487b7160e01b600052602260045260246000fd5b50919050565b600082198211156109d457634e487b7160e01b600052601160045260246000fd5b50019056fea2646970667358221220dc0faa232bb83237d9a3c3ff2fef314f8fdbc6de70b17fdde2dda0b7efd73c0d64736f6c63430008090033

code

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract ExampleFT is ERC20, Ownable {
    constructor() ERC20("ExampleFT", "EFT") {
        _mint(msg.sender, 1000000 * 10 ** decimals());
    }
}

Detail

ERC20

Options

access: false | 'ownable' | 'roles'
name: string
symbol: string
premint?: string
burnable?: boolean
pausable?: boolean
mintable?: boolean
freezable?: boolean
lockable?: boolean

Defaults

access: false,
name: 'MyToken',
symbol: 'MTK',
burnable: false,
pausable: false,
premint: '0',
mintable: false,
freezable: false,
lockable: false,
// snapshots: false,
// permit: false,
// votes: false,
// flashmint: false,
// upgradeable: false,

ERC721

Options

access: 'ownable' | 'roles'
name: string
symbol: string
baseUri?: string
enumerable?: boolean
uriStorage?: boolean
burnable?: boolean
ownerBurnable?: boolean
pausable?: boolean
mintable?: boolean
incremental?: boolean
airdrop?: boolean

Defaults

access: 'ownable',
name: 'MyToken',
symbol: 'MTK',
baseUri: '',
enumerable: false,
uriStorage: false,
burnable: false,
ownerBurnable: false,
pausable: false,
mintable: false,
incremental: false,
airdrop: false,
// votes: false,
// hexlant: false,
// upgradeable: false,

ERC1155

Options

access: 'ownable' | 'roles'
name: string
uri: string
burnable?: boolean
ownerBurnable?: boolean
pausable?: boolean
mintable?: boolean
supply?: boolean
updatableUri?: boolean
airdrop?: boolean

Defaults

access: 'ownable',
name: 'MyToken',
uri: '',
burnable: false,
ownerBurnable: false,
pausable: false,
mintable: false,
supply: false,
updatableUri: true,
airdrop: false,
// hexlant: false,
// upgradeable: false,

Deploy contract with Ethers.js

example

import { erc20 } from '@hexlantcontract/hc-wizard';
import { ethers, ContractFactory } from 'ethers';

const deploy = async () => {
  const provider = new ethers.providers.JsonRpcProvider(process.env.RPC_URL);
  const wallet = new ethers.Wallet(process.env.PRIVATE_KEY);
	const signer = wallet.connect(provider);

	const { abi, bytecode } = erc20.compile({
    access: 'ownable',
    name: 'ExampleFT',
    symbol: 'EFT',
    premint: '1000000',
  });

	const ERC20Factory = new ContractFactory(abi, bytecode, signer);
  const ERC20 = await ERC20Factory.deploy();

	console.log('address :', ERC20.address)
  console.log('tx hash :', ERC20.deployTransaction.hash)
}

deploy();

result

address : 0x281CA16fdf60D946dC8510acA1cc5295a3c38039
tx hash : 0x9202d6c470f23fb48264e8206fbf490c9552e76c67f3fa90a12297cbd6121a78