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

@0xsequence/solidity-deployer

v0.1.1

Published

A workflow for deploying solidity contracts

Downloads

32

Readme

Solidity Deployer

Solidity Deployer is a TypeScript project that simplifies the process of deploying, managing, and verifying Solidity smart contracts. It streamlines the deployment process by providing a robust workflow for deploying contracts, deploying guard wallets, recovering funds, and verifying contracts through Etherscan and Tenderly.

Key Features

  • Deploying Guard Wallets
  • Deploying Contracts
  • Verifying Contracts on Tenderly and Etherscan
  • Recovering Funds

Installation

To use Solidity Deployer in your project, you need to have Node.js and Yarn installed. You can install the package via Yarn:

yarn add solidity-deployer

Usage

DeploymentFlow

The DeploymentFlow class is the core of the project, which handles the deployment and management of smart contracts.

Constructor

constructor(tenderly: TenderlyConfiguration | Tenderly, etherscanApiKey: string, signer: Signer, networkName?: string, logger?: Logger, deployer?: Deployer)

Initialize a new DeploymentFlow instance with the required configuration options for Tenderly, Etherscan, and other necessary parameters.

Deploying Guard Wallets

deployGuards: (moduleAddr: string, guards: string[]) => Promise<string[]>

This method deploys guard wallets for a given module address and a list of image hashes. It returns a promise that resolves to an array of deployed guard wallet addresses.

Deploying and Verifying Contracts

deployAndVerify: <T extends ContractFactory>(
  friendlyName: string,
  contract: new (signer: Signer) => T,
  verificationRequest: ContractVerificationRequest,
  deploymentArgs?: Parameters<T['deploy']>[],
  contractInstance?: BigNumberish,
  txParams?: providers.TransactionRequest,
  fundsRecoveryAddr?: string,
) => Promise<Contract>

This method deploys and verifies a contract using the provided contract factory and deployment arguments. It also takes a friendly name for the contract, verification request details, and optional transaction parameters and funds recovery address.

Recovering Funds

recoverFunds: (address: string) => Promise<BigNumber>

This method helps to recover all funds in the signer and returns them to the specified address. It returns a promise that resolves to the remaining dust in the signer.

Example

import { Tenderly } from "tenderly";
import { Wallet } from "ethers";
import { DeploymentFlow } from "solidity-deployer";

const tenderlyConfig = {...}; // Your Tenderly configuration
const etherscanApiKey = "your-etherscan-api-key";
const privateKey = "your-private-key";
const networkName = "mainnet";

const signer = new Wallet(privateKey);
const tenderly = new Tenderly(tenderlyConfig);

const deploymentFlow = new DeploymentFlow(tenderly, etherscanApiKey, signer, networkName);

async function main() {
  // Deploy and verify a contract
  const contract = ...; // Your contract factory
  const verificationRequest = ...; // Contract verification request
  const deploymentArgs = ...; // Contract deployment arguments

  const deployedContract = await deploymentFlow.deployAndVerify("MyContract", contract, verificationRequest, deploymentArgs);
  console.log("Deployed contract address:", deployedContract.address);

  // Deploy guards
  const moduleAddr = deployedContract.address;
  const guards = [...]; // List of image hashes for each guard wallet
  const deployedGuardWallets = await deploymentFlow.deployGuards(moduleAddr, guards);
  console.log("Deployed guard wallets:", deployedGuardWallets);

  // Recover funds
  const recoveryAddress = "your-recovery-address";
  const remainingDust = await deploymentFlow.recoverFunds(recoveryAddress);
  console.log("Remaining dust in signer:", remainingDust.toString());
}

main()
  .then(() => {
    process.exit(0);
  })
  .catch(error => {
    console.error(error);
    process.exit(1);
  });

License

This project is released under the Apache License 2.0.