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

redprint-forge

v0.2.2

Published

A developer-friendly framework/library in solidity to modify & deploy OPStack ’s contracts in a modular style.

Downloads

21

Readme

[!NOTE] You can find our alpha mvp and relevant examples here

[!WARNING] The code is not audited yet. Please use it carefully in production.

Installation

There are 2 ways: with Node.js and one Git Submodules

with Node

This is the recommended approach.

We assume that you already setup your working environment with hardhat + foundry as specified in foundry 's guide or hardhat 's guide and cd into it

cd my-project;
  1. Add the redprint-forge using your favorite package manager, e.g., with Yarn:
yarn add -D redprint-forge
  1. Adding remappings.txt with following line:
@redprint-core/=node_modules/redprint-forge/src
@redprint-deploy/=node_modules/redprint-forge/script
@redprint-forge-std/=node_modules/redprint-forge/lib/forge-std/src
@redprint-openzeppelin/=node_modules/redprint-forge/lib/openzeppelin-4_9_4/contracts
@redprint-openzeppelin-upgradable/=node_modules/redprint-forge/lib/openzeppelin-upgradable-4_9_4/contracts
@redprint-safe-contracts/=node_modules/redprint-forge/lib/safe-smart-account/contracts

[!TIP] We use @redprint-/ as a convention to avoid any naming conflicts with your previously installed libararies ( i.e. @redprint-forge-std/ vs @forge-std/)

What Is It For

One of our Swiss army knife toolset: redprint-forge is a developer-friendly framework/library in solidity to modify & deploy OPStack ’s contracts in a modular style.

The features include:

  • Type-safe smart contract deployment

  • Re-usable smart contract deployment and testing pipeline

  • Standardized framework, minimizing developer mistake and enhancing better security

  • All-Solidity-based so no context switching, no new scripting syntax in other languages

  • Tx Management via Safe Smart Contract Deploy Script

Together with Redprint Wizard UI, which is a code generator/ interactive playground oriented for OPStack development, it does not only help novice developers to deploy OPStack's smart contracts to deploy on OP mainnet, but also help them to use generated deployment script in their own projects.

Quickstart

Tx Management Via Safe-Multisig

You can write solidity script, then execute it from command-line in order to make any smart contract calls, or send transactions from your own safe multi-sig wallet.

You can access both _upgradeAndCallViaSafe and _callViaSafe easily by inheriting and using from in redprint-forge module ’s parent contract SafeScript.

Call and Upgrade Proxy Contract

Let’s see a practical example when initializing one of OPStack's proxy contract ( eg. ProtocolVersions ) by calling _upgradeAndCallViaSafe:


/** ... */

// `redprint-forge` 's core engine
import { SafeScript} from "@redprint-deploy/safe-management/SafeScript.sol";

/** ... */

contract DeployAndInitializeProtocolVersionsScript is DeployScript, SafeScript {

    /** ... */

    function initializeProtocolVersions() public {
      console.log("Upgrading and initializing ProtocolVersions proxy");

      /** ... */

      address proxyAdmin = deployer.mustGetAddress("ProxyAdmin");
      address safe = deployer.mustGetAddress("SystemOwnerSafe");

      /** ... */

      _upgradeAndCallViaSafe({
          _proxyAdmin: proxyAdmin,
          _safe: safe,
          _owner: owner,
          _proxy: payable(protocolVersionsProxy),
          _implementation: protocolVersions,
          _innerCallData: abi.encodeCall(
              ProtocolVersions.initialize,
              (
                  finalSystemOwner,
                  ProtocolVersion.wrap(requiredProtocolVersion),
                  ProtocolVersion.wrap(recommendedProtocolVersion)
              )
          )
      });
      /** ... */
    }

}

[!NOTE] You can the full example here: 03B_DeployAndInitializeProtocolVersions.s.sol

Call to Any Contract with arbitrary data

Let’s see another example at SafeScript itselfs. Our internal function just calls _callViaSafe:

/** ... */

abstract contract SafeScript {

  /** ... */

  function _upgradeAndCallViaSafe( address _owner, address _proxyAdmin, address _safe, address _proxy, address _implementation, bytes memory _innerCallData) internal {

      bytes memory data =
          abi.encodeCall(ProxyAdmin.upgradeAndCall, (payable(_proxy), _implementation, _innerCallData));

      Safe safe = Safe(payable(_safe));
      _callViaSafe({ _safe: safe, _owner: _owner, _target: _proxyAdmin, _data: data });
  }

  /** ... */

}

Contributing

We are currently still in an experimental phase leading up to a first audit and would love to hear your feedback on how we can improve Reprint.

If you want to say thank you or/and support active development of redprint-forge:

  • Add a GitHub Star to the project.
  • Tweet about redprint.
  • Write interesting articles about the project on Medium, or your personal blog.
  • Keep Optimistic !!