{"id":19607104,"url":"https://github.com/jbx-protocol/juice-contracts-v2","last_synced_at":"2025-04-13T06:42:39.664Z","repository":{"id":37438460,"uuid":"406926752","full_name":"jbx-protocol/juice-contracts-v2","owner":"jbx-protocol","description":"⚙️  Juicebox core V2 contracts.","archived":false,"fork":false,"pushed_at":"2023-02-02T16:17:43.000Z","size":7295,"stargazers_count":80,"open_issues_count":2,"forks_count":54,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-04-14T10:45:21.939Z","etag":null,"topics":["ethereum","juicebox","solidity"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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":"security/postmortem/5.24.2022.md","support":null}},"created_at":"2021-09-15T21:14:48.000Z","updated_at":"2024-03-30T23:54:03.000Z","dependencies_parsed_at":"2023-02-17T22:00:59.504Z","dependency_job_id":null,"html_url":"https://github.com/jbx-protocol/juice-contracts-v2","commit_stats":null,"previous_names":["jbx-protocol/juice-contracts"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbx-protocol%2Fjuice-contracts-v2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbx-protocol%2Fjuice-contracts-v2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbx-protocol%2Fjuice-contracts-v2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbx-protocol%2Fjuice-contracts-v2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbx-protocol","download_url":"https://codeload.github.com/jbx-protocol/juice-contracts-v2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248675441,"owners_count":21143763,"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:54.522Z","updated_at":"2025-04-13T06:42:39.642Z","avatar_url":"https://github.com/jbx-protocol.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# juice-contracts-v2\n\n## Develop\n\n### Unit Tests\n\nTo run the unit tests suite (in Javascript), you'll need to run `yarn install` first then manually run Hardhat in order to enable ESM support:\n\n```bash\nnode --require esm ./node_modules/.bin/hardhat test --network hardhat\n```\n\nAlternatively, you can run a local Hardhat node in another terminal using\n\n```bash\nyarn chain --network hardhat\n```\n\nthen run the following:\n\n```bash\nyarn test\n```\n\nIt might happens that Hardhat cannot resolve custom error (test failing on \"Expecter nameOfTheError() but reverted\nwithout a reason string\"), just restart yarn chain.\n\n### System Tests\n\nEnd-to-end tests have been written in Solidity, using Foundry.\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\n```\n\n3. Run tests:\n\n```bash\nforge test\n```\n\n4. Update Foundry periodically:\n\n```bash\nfoundryup\n```\n\nResources:\n\n- [The Forge-Book](https://onbjerg.github.io/foundry-book/forge)\n\n### Coverage\n\nTo check current unit tests coverage:\n\n```bash\nnode --require esm ./node_modules/.bin/hardhat coverage --network hardhat\n```\n\nA few notes:\n\n- Hardhat doesn't support [esm](https://nodejs.org/api/esm.html) yet, hence running manually with node.\n- We are currently using a forked version of [solidity-coverage](https://www.npmjs.com/package/solidity-coverage) that includes optimizer settings. Ideally we will move to the maintained version after this is fixed on their end.\n- Juicebox V2 codebase being quite large, Solidity Coverage might run out of memory if you modify/add parts to it. Please check [Solidity-coverage FAQ](https://github.com/sc-forks/solidity-coverage/blob/master/docs/faq.md) in order to address the issue.\n\n## Deploy\n\nJuicebox uses the [Hardhat Deploy](https://github.com/wighawag/hardhat-deploy) plugin to deploy contracts to a given network. But before using it, you must create a `./mnemonic.txt` file containing the mnemonic phrase of the wallet used to deploy. You can generate a new mnemonic using [this tool](https://github.com/itinance/mnemonics). Generate a mnemonic at your own risk.\n\nThen, to execute the `./deploy/deploy.js` script, run the following:\n\n```bash\nnpx hardhat deploy --network $network\n```\n\n\\_You'll likely want to set the optimizer runs to 10000 in `./hardhat.config.js` before deploying to prevent contract size errors. The preset value of 1000000 is necessary for hardhat to run unit tests successfully. Bug about this opened [here](https://github.com/NomicFoundation/hardhat/issues/2657#issuecomment-1113890401).\n\nContract artifacts will be outputted to `./deployments/$network/**` and should be checked in to the repo.\n\n## Verification\n\nTo verify the contracts on [Etherscan](https://etherscan.io), make sure you have an `ETHERSCAN_API_KEY` set in your `./.env` file. Then run the following:\n\n```bash\nnpx hardhat --network $network etherscan-verify\n```\n\nThis will verify all of the deployed contracts in `./deployments`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbx-protocol%2Fjuice-contracts-v2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbx-protocol%2Fjuice-contracts-v2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbx-protocol%2Fjuice-contracts-v2/lists"}