New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

superfuse-forge

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

superfuse-forge

A developer-friendly framework/library in solidity to modify & deploy cross-chain=based contracts in a modular style.

1.0.0
latest
Source
npm
Version published
Weekly downloads
9
50%
Maintainers
0
Weekly downloads
 
Created
Source

Keep Optimistic and be Superchain dApp developer!!

  • What is it for
  • Quickstart
  • Architecture
  • Contributing
  • Acknowledgement

[!NOTE] You can find our relevant examples here. Geneated contract code from the Superfuse Wizard is stored here due to documentation and testing purpose.

What Is It For

One of our Swiss army knife toolset: superfuse-forge is a developer-friendly framework/library in solidity to build a variations of cross-chain contracts in superchain Ecosystem.

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
  • Save deployment schemas in json file
  • Separatable into each of modular and customizable deploy scripts
  • Based on All-Solidity, so no context switching, no new testing syntax

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

Installation

Add the superfuse-forge using your favorite package manager, e.g., with pnpm:

pnpm init
pnpm add superfuse-forge
pnpm install

Quick Guide

  • Set your working environment with foundry :
forge init my-project
cd my-project
  • Add the superfuse-forge using your favorite package manager, e.g., with pnpm or Yarn:
pnpm add superfuse-forge

or

yarn add -D superfuse-forge
  • Configure permission and remapping (e.g. with txt" for remappings.txt) by modifing:
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
+solc_version = '0.8.25'
+fs_permissions = [
+    { access = 'read-write', path = './deployments/' },
+    { access = 'read', path = './configs' },
+    { access = 'read', path = './test' },
+    { access = 'write', path = './deployment.json' },
+]

+[soldeer]
+remappings_location = "txt"

Then, add remappings.txt with following lines:

@superfuse-core/=node_modules/superfuse-forge/src
@superfuse-deploy/=node_modules/superfuse-forge/script
@superfuse-test/=node_modules/superfuse-forge/test/

@forge-std-v1.9.1/=node_modules/superfuse-forge/lib/forge-std-v1.9.1/src/
@solady-v0.0.292/=node_modules/superfuse-forge/lib/solady-v0.0.292/src/

@openzeppelin-v0.4.7.3/=node_modules/superfuse-forge/lib/openzeppelin-v0.4.7.3/contracts/
@openzeppelin-v0.5.0.2/=node_modules/superfuse-forge/lib/openzeppelin-v0.5.0.2/contracts/

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

[!NOTE] You can check out dependencies'versions here.

  • Copy .env as following.
MNEMONIC="test test test test test test test test test test test junk"
# local network 's default private key so it is still not exposed
DEPLOYER_PRIVATE_KEY=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
DEPLOYER_ADDRESS=0x70997970C51812dc3A010C7d01b50e0d17dc79C8

[!NOTE] The key or menemonic here must be secret and secure. you can configure it via our Wizard, and the default values are based on above .env. You must choose your own secret. Otherwise, it does not mimic the production deployment environment.

  • Modify .gitignore as following.
# ...
+node_modules/
  • Copy a set of smart contract including main contracts deploy scripts and test suites
rsync -av --exclude='interfaces/' --exclude='L2/' --exclude='libraries/' node_modules/superfuse-forge/src/ src/

[!NOTE] we, for this example, also need to reconfigue the new remapping:

# ...
+@main/=src/
+@script/=script/
@superfuse-core/=node_modules/superfuse-forge/src
@superfuse-deploy/=node_modules/superfuse-forge/script
@superfuse-test/=node_modules/superfuse-forge/test/

@forge-std-v1.9.1/=node_modules/superfuse-forge/lib/forge-std-v1.9.1/src/
@solady-v0.0.292/=node_modules/superfuse-forge/lib/solady-v0.0.292/src/

@openzeppelin-v0.4.7.3/=node_modules/superfuse-forge/lib/openzeppelin-v0.4.7.3/contracts/
@openzeppelin-v0.5.0.2/=node_modules/superfuse-forge/lib/openzeppelin-v0.5.0.2/contracts/

[!TIP] You may choose your own remapping convention that suites your needs best!!!

For Deploy script, we now want to exclude /deployer:

rsync -av --exclude='deployer/' node_modules/superfuse-forge/script/ script/

Now, copy a test suite:

cp node_modules/superfuse-forge/test/* test/
  • Compile and run test:

This will take a while to compile:

forge t

[!TIP] Behind the scene, the test suite works by replicating the same environment as production script, because it utilizes the same deployment logic script inside setUp() as following:


/** ... */

// deployment logic
import {DeployMyERC20VotesScript} from "@script/000_DeployMyERC20VotesScript.s.sol";

contract ERC20VotesTest is Test {

    /** ... */

    function setUp() external {

         /** ... */

        deployerProcedue = getDeployer();
        deployerProcedue.setAutoBroadcast(false);

        console.log("Setup MyERC20Votes ... ");

        DeployMyERC20VotesScript myERC20VotesDeployments = new DeployMyERC20VotesScript();
        myERC20Votes = myERC20VotesDeployments.deploy();

        deployerProcedue.deactivatePrank();

    }
    /** ... */

}

[!NOTE] You can chekout this

Keywords

blockchain

FAQs

Package last updated on 15 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts