{"id":19498092,"url":"https://github.com/patrickalphac/upgrades-mix","last_synced_at":"2025-07-02T11:37:33.323Z","repository":{"id":44655985,"uuid":"372997988","full_name":"PatrickAlphaC/upgrades-mix","owner":"PatrickAlphaC","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-17T02:42:09.000Z","size":365,"stargazers_count":18,"open_issues_count":0,"forks_count":28,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-04T04:11:29.146Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/PatrickAlphaC.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}},"created_at":"2021-06-02T00:48:39.000Z","updated_at":"2024-09-17T13:35:22.000Z","dependencies_parsed_at":"2023-01-18T17:31:33.990Z","dependency_job_id":null,"html_url":"https://github.com/PatrickAlphaC/upgrades-mix","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickAlphaC%2Fupgrades-mix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickAlphaC%2Fupgrades-mix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickAlphaC%2Fupgrades-mix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickAlphaC%2Fupgrades-mix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PatrickAlphaC","download_url":"https://codeload.github.com/PatrickAlphaC/upgrades-mix/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250907612,"owners_count":21506068,"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-10T21:49:12.349Z","updated_at":"2025-04-25T22:33:03.975Z","avatar_url":"https://github.com/PatrickAlphaC.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Upgrades Mix\n\n\u003cbr/\u003e\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://blog.openzeppelin.com/proxy-patterns/\" target=\"_blank\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/PatrickAlphaC/upgrades-mix/main/img/proxy-pattern.png\" width=\"400\" alt=\"OpenZeppelin Proxy logo\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\u003cbr/\u003e\n\n- [Upgrades Mix](#upgrades-mix)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n  - [Environment Variables](#environment-variables)\n- [Useage](#useage)\n  - [Scripts](#scripts)\n  - [Test](#test)\n  - [Linting](#linting)\n  - [Resources](#resources)\n  - [License](#license)\n\nThis repo shows users how to use the Transparent Proxy pattern for upgrading smart contracts. It uses most of the code from openzeppelin's repo, and adds brownie scripts on top.\n\n## Prerequisites\n\nPlease install or have installed the following:\n\n- [nodejs and npm](https://nodejs.org/en/download/)\n- [python](https://www.python.org/downloads/)\n\n## Installation\n\n1. [Install Brownie](https://eth-brownie.readthedocs.io/en/stable/install.html), if you haven't already. Here is a simple way to install brownie.\n\n```bash\npip install eth-brownie\n```\n\nOr, if that doesn't work, via pipx\n\n```bash\npip install --user pipx\npipx ensurepath\n# restart your terminal\npipx install eth-brownie\n```\n\n2. For local testing [install ganache-cli](https://www.npmjs.com/package/ganache-cli)\n   _Skip if you only want to use testnets_\n\n```bash\nnpm install -g ganache-cli\n```\n\nor\n\n```bash\nyarn add global ganache-cli\n```\n\n3. Download the mix and install dependancies.\n\n```bash\nbrownie bake upgrades-mix\ncd upgrades\n```\n\nOr, you can clone from source:\n\n```bash\ngit clone https://github.com/PatrickAlphaC/upgrades-mix\ncd upgrades-mix\n```\n\n## Environment Variables\n\nIf you want to be able to deploy to testnets or work with mainnet-fork, do the following.\n\n1. Set your `WEB3_INFURA_PROJECT_ID`, and `PRIVATE_KEY` [environment variables](https://www.twilio.com/blog/2017/01/how-to-set-environment-variables.html).\n\nYou can get a `WEB3_INFURA_PROJECT_ID` by getting a free trial of [Infura](https://infura.io/). At the moment, it does need to be infura with brownie. If you get lost, you can [follow this guide](https://ethereumico.io/knowledge-base/infura-api-key-guide/) to getting a project key. You can find your `PRIVATE_KEY` from your ethereum wallet like [metamask](https://metamask.io/).\n\nYou'll also need testnet Sepolia ETH and LINK. You can get LINK and ETH into your wallet by using the [sepolia faucets located here](https://sepoliafaucet.com/) and the [link token faucet here](https://faucets.chain.link/sepolia). If you're new to this, [watch this video.](https://www.youtube.com/watch?v=P7FX_1PePX0)\n\nYou can add your environment variables to the `.env` file:\n\n```\nexport WEB3_INFURA_PROJECT_ID=\u003cPROJECT_ID\u003e\nexport PRIVATE_KEY=\u003cPRIVATE_KEY\u003e\n```\n\nAND THEN RUN `source .env` TO ACTIVATE THE ENV VARIABLES\n(You'll need to do this everytime you open a new terminal, or [learn how to set them easier](https://www.twilio.com/blog/2017/01/how-to-set-environment-variables.html)).\n\n\u003e DO NOT SEND YOUR PRIVATE KEY WITH FUNDS IN IT ONTO GITHUB\n\nOtherwise, you can build, test, and deploy on your local environment.\n\n# Useage\n\n## Scripts\n\n```\nbrownie run scripts/01_deploy_box.py\nbrownie run scripts/02_upgrade_box.py\n```\n\nThis will:\n\n1. Deploy a `Box` implementation contract\n2. Deploy a `ProxyAdmin` contract to be the admin of the proxy\n3. Deploy a `TransparentUpgradeableProxy` to be the proxy for the implementations\n\nThen, the upgrade script will:\n\n4. Deploy a new Box implementation `BoxV2`\n5. Upgrade the proxy to point to the new implementation contract, essentially upgrading your infrastructure.\n6. Then it will call a function only `BoxV2` can call\n\n## Test\n\n```\nbrownie test\n```\n\n## Linting\n\n```\npip install black\npip install autoflake\nautoflake --in-place --remove-unused-variables -r .\nblack .\n```\n\n## Resources\n\nTo get started with Brownie:\n\n- Check out the other [Brownie mixes](https://github.com/brownie-mix/) that can be used as a starting point for your own contracts. They also provide example code to help you get started.\n- [\"Getting Started with Brownie\"](https://medium.com/@iamdefinitelyahuman/getting-started-with-brownie-part-1-9b2181f4cb99) is a good tutorial to help you familiarize yourself with Brownie.\n- For more in-depth information, read the [Brownie documentation](https://eth-brownie.readthedocs.io/en/stable/).\n- Or watch any of the [Brownie YouTube](https://www.youtube.com/watch?v=QfFO22lwSw4\u0026t=2s) tutorials or [articles](https://alphachain.io/blogs/)\n\nAny questions? Join our [Discord](https://discord.gg/9zk7snTfWe)\n\n## License\n\nThis project is licensed under the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickalphac%2Fupgrades-mix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickalphac%2Fupgrades-mix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickalphac%2Fupgrades-mix/lists"}