{"id":19390348,"url":"https://github.com/nucypher/nucypher-contracts","last_synced_at":"2026-01-28T12:29:00.967Z","repository":{"id":39591361,"uuid":"356134261","full_name":"nucypher/nucypher-contracts","owner":"nucypher","description":"Ethereum contracts supporting TACo applications on the Threshold Network.","archived":false,"fork":false,"pushed_at":"2025-04-21T09:28:47.000Z","size":2497,"stargazers_count":18,"open_issues_count":55,"forks_count":11,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-21T10:32:00.078Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/nucypher.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,"zenodo":null}},"created_at":"2021-04-09T04:25:41.000Z","updated_at":"2025-04-11T17:49:22.000Z","dependencies_parsed_at":"2022-09-20T05:40:23.156Z","dependency_job_id":"503949e1-d778-4534-ba0e-0d0631015ffa","html_url":"https://github.com/nucypher/nucypher-contracts","commit_stats":null,"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucypher%2Fnucypher-contracts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucypher%2Fnucypher-contracts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucypher%2Fnucypher-contracts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucypher%2Fnucypher-contracts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nucypher","download_url":"https://codeload.github.com/nucypher/nucypher-contracts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250539363,"owners_count":21447294,"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":[],"created_at":"2024-11-10T10:20:26.535Z","updated_at":"2026-01-28T12:28:55.181Z","avatar_url":"https://github.com/nucypher.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NuCypher contracts\n\nContracts from the [main NuCypher codebase](https://github.com/nucypher/nucypher) extracted into a separate repo for ease of testing and interoperability with other projects.\n\n## Structure\n\n* `deployment`: Deployment utilities\n* `deployment/artifacts`: ABI and address of deployed contracts\n* `contracts`: Source code for contracts\n* `scripts`: Deployment and utilities scripts\n* `tests`: Contract tests\n* `src`: NPM package sources\n\n## Installation\n\nWe use [Ape](https://docs.apeworx.io/ape/stable/index.html) as the testing and deployment framework of this project.\n\n### Configuring Pre-commit\n\nTo install pre-commit locally:\n\n```bash\npre-commit install\n```\n\n### Github Actions envvars\n\nIn future, we may need to set the following:\n\n* `ETHERSCAN_API_KEY`: Etherscan [API token](https://etherscan.io/apis), required to query source files from Etherscan.\n* `POLYGONSCAN_API_KEY`: Polygonscan [API token](https://polygonscan.com/apis), required to query source files from Polygonscan.\n* `GITHUB_TOKEN`: Github [personal access token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line#creating-a-token), required by [py-solc-x](https://github.com/iamdefinitelyahuman/py-solc-x) when querying installable solc versions.\n* `WEB3_INFURA_PROJECT_ID`: Infura project ID, required for connecting to Infura hosted nodes.\n\n## Running the Tests\n\n### Python Tests\n\nThis project uses [tox](https://tox.readthedocs.io/en/latest/) to standardize the local and remote testing environments.\nNote that `tox` will install the dependencies from `requirements.txt` automatically and run a linter (`black`); if that is not desirable, you can just run `py.test`.\n\n### TypeScript Tests\n\nTo run the TypeScript tests, you will need to install the dependencies:\n\n```bash\n$ npm install\n```\n\nThen you can run the tests:\n\n```bash\n$ npm test\n```\n\n## Deploy to Production\n\n##### 1. Setup Deployment Parameters\n\nConfigurations for the deployments are in `deployments/constructor_params/\u003cdomain\u003e/\u003cfilename\u003e.yaml`.\n\nHere is an example deployment configuration YAML file, but you can also find a full\nexamples in `deployments/constructor_params/lynx/`:\n\n```yaml\ndeployment:\n  name: example\n  chain_id: \u003cchain_id\u003e\n\nartifacts:\n    dir: ./deployment/artifacts/\n    filename: example.json\n\ncontracts:\n  - MyToken:\n      _totalSupplyOfTokens: 10000000000000000000000000\n  - MyContractWithNoParameters\n  - MyContractWithParameters:\n      _token: $MyToken\n      _number_parameter: 123456\n      _list_parameter: [123456, 789012]\n```\n\n##### 2. Create Deployment Script\n\nDeployment scripts are located in `scripts/\u003cdomain\u003e/\u003cname\u003e.py`.\nHere is a simple example deployment script, but you can also find a full example in `scripts/lynx/deploy_root.py`:\n\n```python\n#!/usr/bin/python3\n\nfrom ape import project\n\nfrom deployment.constants import (\n    CONSTRUCTOR_PARAMS_DIR,\n)\nfrom deployment.networks import is_local_network\nfrom deployment.params import Deployer\n\nVERIFY = not is_local_network()\nCONSTRUCTOR_PARAMS_FILEPATH = CONSTRUCTOR_PARAMS_DIR / \"my-domain\" / \"example.yml\"\n\n\ndef main():\n    deployer = Deployer.from_yaml(filepath=CONSTRUCTOR_PARAMS_FILEPATH,\n                                  verify=VERIFY)\n    token = deployer.deploy(project.MyToken)\n    my_contract_with_no_parameters = deployer.deploy(\n        project.MyContractWithNoParameters)\n    my_contract_with_parameters = deployer.deploy(\n        project.MyContractWithParameters)\n    deployments = [\n        token,\n        my_contract_with_no_parameters,\n        my_contract_with_parameters,\n    ]\n    deployer.finalize(deployments=deployments)\n```\n\n##### 3. Setup Deployment Account (production only)\n\nIn order to deploy to **production** you will need to import an account into ape:\n```\n$ ape accounts import \u003cid\u003e\n```\nYou will be asked to input the private key, and to choose a password. The account will then be available as `\u003cid\u003e`.\n\nThen you can check the account was imported correctly:\n```\n$ ape accounts list\n```\n\n##### 4. Deploy\n\nClear your ape database before deploying to production to avoid conflicts with upgradeable proxies.\nPlease note that this will delete all ape deployment artifacts, so make sure you have a\nbackup of artifacts from other projects before running this command.\n\n```\n$ rm -r ~/.ape/ethereum\n```\n\nNext, Run deployment scripts:\n```bash\n\n$ ape run \u003cdomain\u003e \u003cscript_name\u003e --network ethereum:local:test\n$ ape run \u003cdomain\u003e \u003cscript_name\u003e --network polygon:mumbai:infura\n$ ape run \u003cdomain\u003e \u003cscript_name\u003e  --network ethereum:goerli:infura\n```\n\n## NPM publishing process\n\nFor interoperability, we keep an NPM package with information of deployed smart contracts, such as address, ABI, etc.\nThe NPM package can be found at https://www.npmjs.com/package/@nucypher/nucypher-contracts.\n\nThe process to publish a new NPM release is as follows:\n\n1. Make the required changes to deployment artifacts, usually by running a deployment script.\n\n2. Update the package version using `bump2version`. We don't want to create a git tag, so we are running it with `--no-tag`.\n\nNote that we follow [semantic versioning](https://docs.npmjs.com/about-semantic-versioning).\n\n```bash\nTo update the minor version (e.g. from v1.1.0 to v1.2.0):\n\u003e bump2version minor --no-tag\n\nTo update the patch version (e.g. from v1.1.0 to v1.1.1):\n\u003e bump2version patch --no-tag\n```\n\nAlternatively, modify the `version` field in `package.json` and `setup.cfg`.\n\nIt is still necessary to bump the version on the `package-lock.json` file, so just run:\n\n```bash\n\u003e npm install\n```\n\n3. Create a PR with these changes. We need this PR to be merged before continue.\n\n4. When these changes are merged, create a new tag on `main` branch. The name of the tag must be the new `\u003cversion\u003e` that is being released (e.g. `v0.23.0`).\n\n```bash\n\u003e git tag -a \u003cversion\u003e -m \"\u003cversion\u003e\"\n\n\u003e git push origin \u003cversion\u003e\n```\n\n5. Publish the new NPM version; this is performed automatically by Github Actions\nwhen you [create a new release](https://github.com/nucypher/nucypher-contracts/releases/new),\nassociated to the latest version tag. Alternatively, run:\n\n```bash\n\u003e npm publish\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnucypher%2Fnucypher-contracts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnucypher%2Fnucypher-contracts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnucypher%2Fnucypher-contracts/lists"}