{"id":25952263,"url":"https://github.com/setprotocol/set-v2-strategies-deployments","last_synced_at":"2025-03-04T14:50:21.232Z","repository":{"id":39162232,"uuid":"445312655","full_name":"SetProtocol/set-v2-strategies-deployments","owner":"SetProtocol","description":"Set V2 Strategies Deployments","archived":false,"fork":false,"pushed_at":"2022-06-01T14:48:12.000Z","size":840,"stargazers_count":10,"open_issues_count":1,"forks_count":11,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-05T00:48:04.149Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SetProtocol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-06T21:15:31.000Z","updated_at":"2024-05-12T21:56:16.000Z","dependencies_parsed_at":"2022-09-19T23:53:30.845Z","dependency_job_id":null,"html_url":"https://github.com/SetProtocol/set-v2-strategies-deployments","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SetProtocol%2Fset-v2-strategies-deployments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SetProtocol%2Fset-v2-strategies-deployments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SetProtocol%2Fset-v2-strategies-deployments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SetProtocol%2Fset-v2-strategies-deployments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SetProtocol","download_url":"https://codeload.github.com/SetProtocol/set-v2-strategies-deployments/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241868475,"owners_count":20033822,"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":"2025-03-04T14:50:20.576Z","updated_at":"2025-03-04T14:50:21.220Z","avatar_url":"https://github.com/SetProtocol.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# set-v2-strategies-deployments\n\nThis repository manages SetProtocol V2 Strategies contract deployments using the [hardhat-deploy plugin][22].\nEach deployment is tracked and recorded by network in a [deployments/outputs][23] file.\n\nThese deployments are peripheral to the core SetProtocol system and include things like\nSetToken strategy contracts, example SetToken instances and other helper contracts.\n\n**All proposed deployments should:**\n+ deploy to HardhatEVM\n+ have unit tests which check the correctness of state variables set in the constructor\n+ be deployed to a testnet have its contract code verified on a block explorer like Etherscan\n\n#### Chains\n\nSeveral networks are supported and each one is managed in its own folder.\n\nThere are dedicated environments for:\n + Ethereum (mainnet, kovan)\n + Polygon (mainnet-polygon, mumbai, goerli)\n + Optimism (mainnet, kovan)\n + Arbitrum (mainnet, rinkeby)\n + Avalanche (mainnet, fuji)\n\nTo run commands like `test`, `deploy`, navigate to the folder for the chain you're working with.\n\n\n## Install\n\nRun these commands in the project root.\n```\ncp .env.default .env\nyarn\ncd \u003cchain_folder\u003e // e.g ethereum, polygon, etc\n```\n\n## Test (deployment)\n\nWe use the hardhat network forking feature to simulate and test deployments. You'll need a valid\n[alchemy.com][200] project id to run these.\n```\nyarn clean-dev-deployment\nyarn deploy:local\n```\n\n## Test (unit)\n```\nyarn test\n```\n\n## Example Testnet Deployment (Kovan)\n\nFill in the following fields in your `.env` file:\n\n+ `KOVAN_DEPLOY_PRIVATE_KEY`: An automated kovan faucet [is here][24], or at [myCrypto, here][27]\n+ `INFURA_TOKEN`: An Infura projectID. Available with an account at [infura.io][25]\n+ `ETHERSCAN_API_KEY`: Available with an account from [etherscan.io/api][26]\n\n**Run:**\n```\nyarn deploy:kovan\nyarn etherscan:kovan\n```\n\n(If etherscan fails, see the [Etherscan](#etherscan-verification) section below).\n\n## Usage Guide\n\nNew deployments have at least two (and sometimes 3) phases:\n\n| Phase | Pull Request / Op | Pre-requisites |\n| ---- | ---- | ----|\n| 1 | Deployment script PR with tests | Code merged at set-v2-strategies \u0026 published to npm |\n| 2 | Executed deployment PR | Phase 1 complete |\n| 3 | Activate new components via Gnosis multisig | Phase 2 complete \u0026 deployment is production |\n\n### Deployment scripts\n\nCreate the new files you'll need by running the `create:deployment` command.\n\nThis will generate files numbered for the latest stage in the deploy, deployments, and test folders.\n\n```sh\n$ yarn create:deployment my_deployment_name\n\nNew deployment files at:\n\u003e .../ethereum/deploy/001_my_deployment_name.ts\n\u003e .../ethereum/deployments/constants/001_my_deployment_name.ts\n\u003e .../ethereum/test/deploys/001_my_deployment_name.spec.ts\n```\n\nThen, find the **most recent** scripts and tests which are suitable templates for your deployment\nand copy/paste them into the new files, adapting as necessary.\n\n**:bulb: Pro Tips :bulb:**:\n\n+ Verify new contracts on Kovan to catch any contract verification issues early in the process.\n+ Useful helpers can be found in [outputHelper.ts][30] and [deployUtils.ts][31]\n+ Addresses for on-chain dependencies can be found in [dependencies.ts][32]\n\n\n### Executing Deployments\n\n| Step | Action | Command |\n| ---- | ---- | ---- |\n| 1 | Checkout master, `git pull`, and run `yarn` ||\n| 2 | Checkout a new branch | `git checkout -b alex/deploy_....` |\n| 3 | Deploy to `staging_mainnet` | `yarn deploy:staging_mainnet` |\n| 4 | Verify deployment on Etherscan | `yarn etherscan:staging_mainnet`\n| 5 | Check contracts' read/write endpoints in Etherscan's UI |  |\n| 6 | Deploy to `production` | `yarn deploy:production` |\n| 7 | Verify deployment on Etherscan | `yarn etherscan:production` |\n| 8 | Commit automated changes made to outputs logs | |\n| 9 | Open PR documenting the addresses of new components | |\n\n\n### Multisig Operations (deferred transactions)\n\nWhen modules, integrations, and price oracles are added to Set in production, @asoong and @felix2feng\nenable them via multisig with Gnosis Safe wallets online.\n\nDeployment scripts should save the tx data generated for these deferred transactions using a flow\nsimilar to that used in [deployUtils#addIntegrationToRegistry][28].\n\n**Resources:**\n+ [Master list of pending and completed multisig operations][29] (only accessible to SetProtocol engineers)\n+ [Multisig transaction utilities](#multisig-transaction-utilities) in this repo.\n\n\n[22]: https://github.com/wighawag/hardhat-deploy\n[23]: https://github.com/SetProtocol/index-deployments/tree/master/deployments/outputs\n[24]: https://faucet.kovan.network/\n[25]: https://infura.io/\n[26]: https://etherscan.io/apis\n[27]: https://app.mycrypto.com/faucet\n[28]: https://github.com/SetProtocol/set-v2-strategies-deployments/blob/325cb49034642767519f969046a3dc8e54b1dd7c/deployments/utils/deployUtils.ts#L83-L100\n[29]: https://docs.google.com/spreadsheets/d/1B00zmmBm0SLuYePNgeKTGvXzuRewQ6ymJfm0hQ2SUs4/edit#gid=1026270302\n[30]: https://github.com/SetProtocol/set-v2-strategies-deployments/blob/master/deployments/utils/outputHelper.ts\n[31]: https://github.com/SetProtocol/set-v2-strategies-deployments/blob/master/deployments/utils/deployUtils.ts\n[32]: https://github.com/SetProtocol/set-v2-strategies-deployments/blob/master/deployments/utils/dependencies.ts\n\n## Semantic Release\n\nThis repository uses [semantic-release][201] to automatically publish in CI on merge to master. We\nonly publish metadata about staging and production deployments and releases are only necessary\nwhen there are changes to the `network/deployments/outputs` production or staging files.\n\nUse the following naming convention in your PR descriptions\n\n+ chore: no release: `chore(scripts): description`\n  + example: `chore(scripts): DelegatedBaseManager Optimism deploy scripts`\n+ feature release (e.g 1.1.0 -\u003e 1.2.0): `feat(deploy): description`\n  + example: `feat(deploy): Deploy DelegatedBaseManager to Optimism production`\n\n## Chain resources\n\n#### Ethereum\n\n+ [Etherscan API keys][26]\n+ [Infura][25] (for project ids)\n+ Kovan faucets:\n  + [faucet.kovan.network][24]\n  + [myCrypto][27]\n\n#### Polygon\n\n+ [Polygon/matic docs][33]\n+ [Mumbai faucet][34]\n+ [Goerli faucet][35]\n+ [Matic mainnet bridge wallet][37] (for moving mainnet funds w/ Metamask, WalletConnect)\n\n[33]: https://docs.matic.network/docs/develop/getting-started\n[34]: https://faucet.matic.network/\n[35]: https://faucet.goerli.mudit.blog/\n[37]: https://wallet.matic.network/login?next=%2Fbridge%2F\n\n## Etherscan verification\n\nSet `ETHERSCAN_API_KEY` to a valid Etherscan API key in `.env`\n\nAfter deploying, run the command for your network:\n```\nyarn etherscan:kovan\nyarn etherscan:staging_mainnet\nyarn etherscan:production\n```\n\n**When Etherscan fails...**\n\nVerification may fail because of [solidity issue 9573][1] which causes Etherscan\nto generate different bytecode from a minimized contract set than what was generated locally with\nall contracts in the project. The error message says:\n\n```\nCompiling your contract excluding unrelated contracts did not produce identical bytecode.\n...\nNomicLabsHardhatPluginError: Source code exceeds max accepted (500k chars) length\n```\n\nTo get around this, use the `compile:one` task to compile your target contract in isolation.\n\nIn a deployment script, right before the problematic contract is deployed:\n```js\n// Compile in isolation for Etherscan verification bug\nawait bre.run(\"set:compile:one\", { contractName: \"GeneralIndexModule\"});\n```\n\n... or a the command line:\n```sh\nyarn compile:one GeneralIndexModule\nyarn deploy:kovan\nyarn etherscan:kovan\n```\n\n[1]: https://github.com/ethereum/solidity/issues/9573#issuecomment-721632715\n\n## Deployment creation utility\n\n#### `yarn create:deployment`\n\nThe create:deployment command creates standard files necessary for each new deployment. It\ntakes a deployment name as an argument and automatically prefixes it with the next increment of the\ndeployment sequence.\n\n```sh\n$ yarn create:deployment my_deployment_name\n\nNew deployment files at:\n\u003e .../ethereum/deploy/001_my_deployment_name.ts\n\u003e .../ethereum/deployments/constants/001_my_deployment_name.ts\n\u003e .../ethereum/test/deploys/001_my_deployment_name.spec.ts\n```\n\n[200]: https://www.alchemy.com/\n[201]: https://semantic-release.gitbook.io/semantic-release/v/beta/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsetprotocol%2Fset-v2-strategies-deployments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsetprotocol%2Fset-v2-strategies-deployments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsetprotocol%2Fset-v2-strategies-deployments/lists"}