{"id":21919556,"url":"https://github.com/bosonprotocol/contracts","last_synced_at":"2025-04-19T12:34:20.750Z","repository":{"id":43119799,"uuid":"270392442","full_name":"bosonprotocol/contracts","owner":"bosonprotocol","description":"[DEPRECATED] Boson Protocol v1","archived":false,"fork":false,"pushed_at":"2023-03-05T23:05:18.000Z","size":18793,"stargazers_count":69,"open_issues_count":6,"forks_count":17,"subscribers_count":22,"default_branch":"main","last_synced_at":"2024-08-08T20:56:08.986Z","etag":null,"topics":["bosonprotocol","smart-contracts","solidity","solidity-contracts"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bosonprotocol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null}},"created_at":"2020-06-07T18:16:19.000Z","updated_at":"2023-03-28T06:40:16.000Z","dependencies_parsed_at":"2023-07-16T19:13:57.805Z","dependency_job_id":null,"html_url":"https://github.com/bosonprotocol/contracts","commit_stats":{"total_commits":1163,"total_committers":28,"mean_commits":"41.535714285714285","dds":0.6973344797936372,"last_synced_commit":"c16382516e3888ba5a195cd00f821e82c7cf0ec2"},"previous_names":["bosonprotocol/bsn-core-prototype"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bosonprotocol%2Fcontracts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bosonprotocol%2Fcontracts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bosonprotocol%2Fcontracts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bosonprotocol%2Fcontracts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bosonprotocol","download_url":"https://codeload.github.com/bosonprotocol/contracts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226979176,"owners_count":17712574,"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":["bosonprotocol","smart-contracts","solidity","solidity-contracts"],"created_at":"2024-11-28T20:08:39.039Z","updated_at":"2024-11-28T20:08:39.721Z","avatar_url":"https://github.com/bosonprotocol.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![banner](docs/assets/banner.png)](https://bosonprotocol.io)\n\n\u003ch1 align=\"center\"\u003e!Important!\u003c/h1\u003e\n\n\n\u003cp\u003e\u003cb\u003e\u003cbig\u003ePlease note that this is first version of Boson Protocol, please find the latest version \u003ca href=\"https://github.com/bosonprotocol/boson-protocol-contracts\"\u003eBoson Protocol v2 in its own repo\u003c/a\u003e.\u003c/big\u003e\u003c/b\u003e\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eBoson Protocol Contracts\u003c/h1\u003e\n\n[![Gitter chat](https://badges.gitter.im/bosonprotocol.png)](https://gitter.im/bosonprotocol/community)\n\nWelcome to Boson Protocol. Please find a set of Solidity smart contracts that implement Boson Protocol. You are invited to learn more about the project through its code and perhaps test locally how you might use it within your own project. \n\nThis is version 1 of the Protocol. You will find the addresses of the deployed contracts on Ethereum's main net and Ropsten test net [here](https://github.com/bosonprotocol/contracts/blob/main/docs/contracts/deployment.md).\n\nThis version of Boson Protocol is a stepping stone on the way to the release of version 2 of the Protocol next year, which will be accompanied with SDKs and plug-ins to make it easy to integrate. While you may prefer to wait until the new features that will be released in version 2 before building dApps using the Protocol, we encourage you to use the contracts locally and to participate in our [bug bounty](https://github.com/bosonprotocol/community/blob/main/BugBountyProgram.md). \n\nFor more details about how Boson Protocol works and how you might make use of\nit, please see the [documentation site](https://docs.bosonprotocol.io/).  \n\n---\n**Table of Contents**\n\n- [Local Development](#local-development)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n    - [Forking Rinkeby to localnode](#forking-rinkeby-to-localnode)\n    - [Special deployments](#special-deployments)\n  - [Test](#test)\n    - [Testing with DAI](#testing-with-dai)\n    - [Unit Tests](#unit-tests)\n    - [Coverage](#coverage)\n  - [Code Linting \u0026 Formatting](#code-linting--formatting)\n- [Documentation](#documentation)\n- [Contributing](#contributing)\n- [License](#license)\n\n---\n## Local Development\n\n### Prerequisites\n\nFor local development of the contracts, your development machine will need a few\ntools installed.\n\nYou'll need:\n* Node (12.20.x)\n* NPM (7.15.x)\n* Git\n\nFor instructions on how to get set up with these specific versions:\n* See the [OS X guide](docs/setup/osx.md) if you are on a Mac.\n* See the [Linux guide](docs/setup/linux.md) if you use a Linux distribution.\n\n---\n### Installation\n\nTo install dependencies:\n```shell script\nnpm install\n````\n\n---\n### Configuration\n\nBefore you can start interacting with the contracts, via hardhat, please make a copy of the `.env.example` file and call it `.env`.\n\n---\n### Build\n\nAll of the available commands can be found in `package.json`.\n\nTo compile:\n```shell script\nnpm run contracts:compile\n````\n\n---\n### Run\n\n```shell\nnpm run contracts:run\n```\n\n*Note that*: This command starts up built-in Hardhat Network and migrates all contracts to the Hardhat Network instance. The `.env` file has a hard-coded value for the `BOSON_TOKEN` address, which points to account #9 of the local hardhat network. This isn't an actual BOSON token address but just a valid address that will allow the deployment scripts to work. When deploying to a public network, this value should be replaced by the address of the Boson Token on the network you are deploying to. When deploying locally (env == hardhat), a mock Boson Token will be deployed. The unit tests deploy their own contracts and do not rely on the `deploy.ts` script.\n\nIf preferred by those who are familiar with Hardhat, the standard Hardhat commands can be used.\n\nIn a separate terminal, contracts can be deployed using\n```shell\nnpx hardhat deploy\n```\nThe above command deploys to the built-in hardhat EVM. \n\n\n#### Forking Rinkeby to localnode\n\nIt is possible to fork the state of the Rinkeby chain to have it deployed locally. \nThe following hardhat commands will achieve this:\n\n```shell script\nnpx hardhat node --fork https://eth-rinkeby.alchemyapi.io/v2/\u003c\u003calchemy key\u003e\u003e\n```\n\n*Note that*: Alchemy is recommended by Hardhat over Infura because its free accounts provide archived data, which is required for successful forking.\n\nYou can then deploy from a separate terminal using the command:\n\n```shell script\nnpx hardhat deploy --network localhost\n```\n\nThis makes the BOSON test token deployed on Rinkeby (0xEDa08eF1c6ff51Ca7Fd681295797102c1B84606c) and the official DAI token deployed on Rinkeby (0x6A9865aDE2B6207dAAC49f8bCba9705dEB0B0e6D) available to your local hardhat chain.\n\n\n#### Special deployments\n\nThe following instructions assume you have started a hardhat node (forked or not) using the local node instructions above. If you want to deploy the contracts to testnets or mainnet just replace `localhost` with the desired network. \nCalling `npx hardhat deploy` will deploy the protocol contracts. Beside that we provide addtional utility script for the following deployment cases:\n\n- Deploy all protocol contracts and ERC1155NonTransferable (equivalent to v1.0 deployment script)\n\n  ```\n  npx hardhat deploy-with-erc1155 --network localhost\n  ```\n- Deploy only ERC1155NonTransferable and set the metadata uri defined in `.env` file\n  ```\n  npx hardhat deploy-erc1155-only --network localhost\n  ```\n- Deploy a set of mock token contracts ERC20, ERC721, ERC1155 and ERC1155NonTransferable which can be used to test conditional commit\n  ```\n  npx hardhat deploy-mocks --network localhost\n  ```\n- Deploy a Gate contract on a provided network\n  - First run the deploy task to deploy the Boson Protocol contracts to your local node, as described above\n  - Then run deploy-mocks, as described above\n  - Provide values for the folowing properties in your .env file\n    ```\n    BOSON_ROUTER_ADDRESS=0000000000000000000000000000000000000000\n    CONDITIONAL_TOKEN_ADDRESS=0000000000000000000000000000000000000000\n    #Must be 0 (FUNGIBLE_TOKEN - ERC20), 1 (NONFUNGIBLE_TOKEN - ERC721), or 2 (MULTI_TOKEN - ERC1155)\n    CONDITIONAL_TOKEN_TYPE=x\n    ```\n    The Boson Router address and conditional token mock addresses can be found in the corresponding file in the addresses directory. For local deployments, the Boson Router address will be written to a file called 1.json (deploy). The mock conditional token addresses can be found in 1-mocks.json\n  - Then run\n    ```\n    npx hardhat deploy-gate --network localhost\n    ```\n\n---\n### Test\n\n#### Testing with DAI\nThere is no faucet for getting DAI tokens on a testnet. If you deploy the Boson Protocol contracts to a testnet or a local forked instance, you may want to use DAI test tokens for testing purposes. The easiest way to do this is to deploy your\nown DAI test token instance. See [here](docs/dai/daiTestToken.md) for instructions.\n\n#### Unit Tests\n\nAll contracts are thoroughly unit tested using \n[Hardhat's testing framework](https://hardhat.org/tutorial/testing-contracts.html#_5-testing-contracts) \nsupport.\n\nTo run the unit tests:\n\n```shell script\nnpm run tests:unit\n```\n\nBy default, the build system automates starting and stopping [Hardhat Network](https://hardhat.org/hardhat-network/#hardhat-network) on port `http://localhost:8545` in the background ready for each test run.\n\n#### Coverage\n\nWe use [solidity-coverage](https://github.com/sc-forks/solidity-coverage) to \nprovide test coverage reports. \n\nTo check the test coverage: \n\n```shell script \nnpm run tests:coverage\n```\n\n`solidity-coverage` runs its own instance of the hardhatEVM internally, as well as instrumenting contracts before running, note that the contracts are not run through an optimiser when calculating the code coverage, so please do ignore any warnings about contract size when calculating the code coverage. \n\n---\n### Code Linting \u0026 Formatting\n\nBoth the contracts themselves and the tests are linted and formatted as part of\nthe build process.\n\nFor the contracts, we use:\n* [solhint](https://protofire.github.io/solhint/) for linting\n* [prettier-solidity](https://github.com/prettier-solidity/prettier-plugin-solidity) for formatting\n\nFor the tests, we use:\n* [eslint](https://eslint.org/) for linting\n* [prettier](https://prettier.io/) for formatting\n\nTo lint the Solidity code:\n\n```shell script\nnpm run contracts:lint\n```\n\nThis will check if the linter is satisfied. If instead you want to attempt to\nautomatically fix any linting issues:\n\n```shell script\nnpm run contracts:lint-fix\n```\n\nTo format the Solidity code: \n\n```shell script\nnpm run contracts:format\n```\n\nTo attempt to automatically fix any formatting issues: \n\n```shell script\nnpm run contracts:format-fix\n```\n\nSimilarly, for the tests, to perform the same tasks:\n\n```shell script\nnpm run tests:lint\nnpm run tests:lint-fix\nnpm run tests:format\nnpm run tests:format-fix\n```\n\n---\n## Documentation\n\nFor an overview of the contracts and their responsibilities, see [Overview](docs/contracts/overview.md).  \n\nThe whitepaper is available through the project's [website](https://www.bosonprotocol.io/).\n\n---\n## Contributing\n\nWe welcome contributions! Until now, Boson Protocol has been largely worked on by a small dedicated team. However, the ultimate goal is for all of the Boson Protocol repositories to be fully owned by the community and contributors. Issues, pull requests, suggestions, and any sort of involvement are more than welcome.\n\nIf you have noticed a bug, please follow the [bug bounty procedure](https://github.com/bosonprotocol/community/blob/52725b04d1d3013dfc936d3d27ddc34019c6d02d/BugBountyProgram.md).\n\nQuestions and feedback are always welcome, we will use them to improve our offering.\n\nAll PRs must pass all tests before being merged.\n\nBy being in this community, you agree to the [Code of Conduct](CODE_OF_CONDUCT.md). Take a look at it, if you haven't already.\n\n---\n## License\n\nLicensed under [LGPL v3](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbosonprotocol%2Fcontracts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbosonprotocol%2Fcontracts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbosonprotocol%2Fcontracts/lists"}