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

@jbx-protocol/juice-v3-migration

v1.0.1

Published

## Motivation

Downloads

6

Readme

Juice V3 Migration

Motivation

Since the v3 contract went live recently so in order for existing projects to migrate their treasuries & project tokens to V3 we have come up with some migration tools in the form of smart contracts that'll help to make this process efficient & seamless for the users

Mechanic

First up we have the allocators by which v1 & v2 project owners can migrate their treasuries to v3, so we basically use a couple of custom allocator implementations for both v1 & v2, so inside allocate we fetch the primary terminal and add to its balance with addToBalanceOf.

Next up we have the project token deployer for v1 & v2 project token holders to migrate to v3, so to start things project owners can deploy a v3 token for their project by calling deploy on the v3 token deployer which will also call setFor to attach the token to the project.

After the token is deployed token holders can call migrate to send their v1/v2 claimed & unclaimed token balances & get the appropriate v3 tokens minted to them.

Another interesting thing is since the migration logic lies in the v3 token contract in order to make sure that v3 redemptions are smooth we calculate the totalSupply by total supply of v3 tokens + (v1 total supply - v1 token balance in v3 contract i.e the balances that have been already migrated) + (v2 total supply - v2 token balance in v3 contract i.e the balances that have been already migrated)

Architecture

An understanding of how the Juicebox protocol's distributions with allocations & project token economics is an important prereq to understand the migration process.

For migration of the treasuries V1Allocator & V2Allocator contracts need to be deployed & then attached as an allocator to the respective v1 & v2 projects.

For migration of the project tokens JBV3TokenDeployer will be deployed and then v3 project owners can deploy their tokens, so that the token holders can call migrate on JBV3Token

Deploy

The deployment process is pretty straightforward with deployer scripts for the V1Allocator, V2Allocator & JBV3TokenDeployer in the scripts folder.

Install

Quick all-in-one command:

git clone https://github.com/jbx-protocol/juice-v3-migration && cd juice-v3-migration && foundryup && git submodule update --init --recursive --force && yarn install && forge test --gas-report

To get set up:

  1. Install Foundry.
curl -L https://foundry.paradigm.xyz | sh
  1. Install external lib(s)
git submodule update --init --recursive --force && yarn install

then run

forge update
  1. Run tests:
forge test
  1. Update Foundry periodically:
foundryup

Setup

Configure the .env variables, and add a mnemonic.txt file with the mnemonic of the deployer wallet. The sender address in the .env must correspond to the mnemonic account.

Goerli

yarn deploy-goerli-v2-allocator

Mainnet

yarn deploy-mainnet-v3-token-deployer
yarn deploy-mainnet-v2-allocator
yarn deploy-mainnet-v1-allocator

The deployments are stored in ./broadcast

See the Foundry Book for available options.