{"id":19607085,"url":"https://github.com/jbx-protocol/juice-v3-migration","last_synced_at":"2026-05-14T11:32:13.840Z","repository":{"id":63767105,"uuid":"566909184","full_name":"jbx-protocol/juice-v3-migration","owner":"jbx-protocol","description":"A collection of tools to ease the migration of existing project to Juice-contracts-V3","archived":false,"fork":false,"pushed_at":"2023-04-25T21:05:34.000Z","size":37785,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T10:34:18.613Z","etag":null,"topics":["ethereum","juicebox","solidity"],"latest_commit_sha":null,"homepage":"","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jbx-protocol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-16T17:07:54.000Z","updated_at":"2023-01-18T18:23:58.000Z","dependencies_parsed_at":"2025-01-09T09:35:53.384Z","dependency_job_id":null,"html_url":"https://github.com/jbx-protocol/juice-v3-migration","commit_stats":{"total_commits":76,"total_committers":5,"mean_commits":15.2,"dds":0.3421052631578947,"last_synced_commit":"06aea3eaf2c25f0981e3cb1c81b903a806872271"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbx-protocol%2Fjuice-v3-migration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbx-protocol%2Fjuice-v3-migration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbx-protocol%2Fjuice-v3-migration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbx-protocol%2Fjuice-v3-migration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbx-protocol","download_url":"https://codeload.github.com/jbx-protocol/juice-v3-migration/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240895011,"owners_count":19874911,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ethereum","juicebox","solidity"],"created_at":"2024-11-11T10:08:45.853Z","updated_at":"2026-05-14T11:32:13.811Z","avatar_url":"https://github.com/jbx-protocol.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Juice V3 Migration\n\n## Motivation\n\nSince the v3 contract went live recently so in order for existing projects to migrate their treasuries \u0026 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 \u0026 seamless for the users\n\n## Mechanic\n\nFirst up we have the allocators by which v1 \u0026 v2 project owners can migrate their treasuries to v3, so we basically use a couple of custom allocator implementations for both v1 \u0026 v2, so inside `allocate` we fetch the `primary terminal` and add to its balance with `addToBalanceOf`.\n\nNext up we have the project token deployer for v1 \u0026 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.\n\nAfter the token is deployed token holders can call `migrate` to send their v1/v2 claimed \u0026 unclaimed token balances \u0026 get the appropriate v3 tokens minted to them.\n\nAnother 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 `\ntotal 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)`\n\n## Architecture\n\nAn understanding of how the Juicebox protocol's distributions with allocations \u0026 project token economics is an important prereq to understand the migration process.\n\nFor migration of the treasuries `V1Allocator` \u0026 `V2Allocator` contracts need to be deployed \u0026 then attached as an `allocator` to the respective v1 \u0026 v2 projects.\n\nFor 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`\n\n## Deploy\n\nThe deployment process is pretty straightforward with deployer scripts for the `V1Allocator`, `V2Allocator` \u0026  `JBV3TokenDeployer`\nin the `scripts` folder.\n\n\n# Install\n\nQuick all-in-one command:\n\n```bash\ngit clone https://github.com/jbx-protocol/juice-v3-migration \u0026\u0026 cd juice-v3-migration \u0026\u0026 foundryup \u0026\u0026 git submodule update --init --recursive --force \u0026\u0026 yarn install \u0026\u0026 forge test --gas-report\n```\n\nTo get set up:\n\n1. Install [Foundry](https://github.com/gakonst/foundry).\n\n```bash\ncurl -L https://foundry.paradigm.xyz | sh\n```\n\n2. Install external lib(s)\n\n```bash\ngit submodule update --init --recursive --force \u0026\u0026 yarn install\n```\n\nthen run\n\n```bash\nforge update\n```\n\n3. Run tests:\n\n```bash\nforge test\n```\n\n4. Update Foundry periodically:\n\n```bash\nfoundryup\n```\n\n#### Setup\n\nConfigure 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.\n\n## Goerli\n\n```bash\nyarn deploy-goerli-v2-allocator\n```\n\n## Mainnet\n\n```bash\nyarn deploy-mainnet-v3-token-deployer\nyarn deploy-mainnet-v2-allocator\nyarn deploy-mainnet-v1-allocator\n```\n\nThe deployments are stored in ./broadcast\n\nSee the [Foundry Book for available options](https://book.getfoundry.sh/reference/forge/forge-create.html).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbx-protocol%2Fjuice-v3-migration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbx-protocol%2Fjuice-v3-migration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbx-protocol%2Fjuice-v3-migration/lists"}