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

@gluwa/deployment-tool

v0.0.4

Published

Tool to deploy and upgrade contracts on Ethereum Mainnet

Downloads

15

Readme

license npm version

Mainnet Deployment Tool

This Hardhat plugin add 4 tasks and 3 functions to deploy and upgrade smart contracts.

Step include :

  • Compile your contracts
  • Verify storage layout, deploy a proxy admin if non existent, deploy implementation contract if non existent
  • Get last commit id (8 first characters)
  • Deploy a Transparent Upgradeable Proxy OR Upgrade Proxy using implementation contract
  • Save address of the Proxy, Proxy Admin address and initialize arguments
  • Verify contract on etherscan.io (if selected)
  • Commit new storage layout file and address file with Contract Name and CommitId in commit msg
  • Git Pull & Push

How to install this package

1. Install this package

With NPM

npm install deployment-tool

Or with Yarn

yarn add deployment-tool

2. Import/Require this package in your hardhat.config.js/.ts

Inside inside hardhat.config.js

require("deployment-tool");

or inside hardhat.config.ts (Typescript)

import 'deployment-tool'

Other option

git clone https://github.com/marc-aurele-besner/deployment-tool

cd deployment-tool

npm install

npm run build

npm link

in the hardhat project, you want to use this plugin

npm link deployment-tool

Tasks

npx hardhat deployment
npx hardhat deploy-contract
npx hardhat upgrade-contract
npx hardhat test-deploy-then-upgrade-contract

Task: deploy-contract

Usage: hardhat [GLOBAL OPTIONS] deploy-contract [--contract-name ] [--extra ] [--initialize-arguments ] [--initialize-signature ] [--skip-git ] [--tag ] [--verify-contract ]

OPTIONS:

  • --contract-name The name of the contract to deploy (default: "")
  • --extra Extra data to save with this deployment (default: "")
  • --initialize-arguments The initialize() argument (default: "")
  • --initialize-signature Function signature of the initialize function (default: "")
  • --skip-git Skit git commit, pull & push (default: "false")
  • --tag Add a extra tag to this version of the contract (default: "")
  • --verify-contract Validate the contract on Etherscan.io (default: "false")

deploy-contract: Deploy a proxy contract, initialize it, save the address, commit, pull and push

Task: upgrade-contract

Usage: hardhat [GLOBAL OPTIONS] upgrade-contract [--contract-name ] [--extra ] [--skip-git ] [--tag ] [--verify-contract ]

OPTIONS:

  • --contract-name The name of the contract to deploy (default: "")
  • --extra Extra data to save with this deployment (default: "")
  • --skip-git Skit git commit, pull & push (default: "false")
  • --tag Add a extra tag to this version of the contract (default: "")
  • --verify-contract Validate the contract on Etherscan.io (default: "false")

upgrade-contract: Upgrade a proxy contract, save the address, commit, pull and push

Task: test-deploy-then-upgrade-contract

Usage: hardhat [GLOBAL OPTIONS] test-deploy-then-upgrade-contract [--contract-name ] [--extra ] [--initialize-arguments ] [--initialize-signature ] [--skip-git ] [--tag ] [--verify-contract ]

OPTIONS:

  • --contract-name The name of the contract to deploy (default: "")
  • --extra Extra data to save with this deployment (default: "")
  • --initialize-arguments The initialize() argument (default: "")
  • --initialize-signature Function signature of the initialize function (default: "")
  • --skip-git Skit git commit, pull & push (default: "false")
  • --tag Add a extra tag to this version of the contract (default: "")
  • --verify-contract Validate the contract on Etherscan.io (default: "false")

test-deploy-then-upgrade-contract: Upgrade a proxy contract, save the address, commit, pull and push

Functions

Function allow you to use the deployment OR upgrade script in scripts or tests files, they all return a instance of the contract that you can use.

    const { contractDeployment } = require('hardhat');

    contractDeployment.deployContract(
        contractName: string,
        initializeArguments: any[] = [],
        initializeSignature: string = 'initialize',
        tag?: string,
        extra?: any,
        skipGit?: boolean,
        verifyContract?: boolean
    )
    contractDeployment.upgradeContract(
        contractName: string,
        tag?: string,
        extra?: any,
        skipGit?: boolean,
        verifyContract?: boolean
    )
    contractDeployment.testDeployThenUpgradeContract(
        contractName: string,
        initializeArguments: any[] = [],
        initializeSignature: string = 'initialize',
        tag?: string,
        extra?: any,
        skipGit?: boolean,
        verifyContract?: boolean
    )

Dependencies

This package/plugin use other hardhat plugins that you can then reuse, for example https://www.npmjs.com/package/hardhat-awesome-cli is used to save the contract address and initialization details, this can be access with a function like

const { addressBook } = require('hardhat');
addressBook.retrieveContractObject(contractName: string, deployedNetwork: string)