Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve hardhat task #76

Merged
merged 7 commits into from
Aug 26, 2024
Merged

Conversation

juliopavila
Copy link
Contributor

@juliopavila juliopavila commented Aug 19, 2024

Description:

This PR introduces significant improvements to the Hardhat tasks used in the zodiac exit module for deploying and verifying mastercopies. The changes include the following:

Key Changes:

  1. Task Separation:

    • Deploy Mastercopies: deploy:mastercopies - Deploys the latest version of all mastercopies.
    • Deploy Mastercopy with Version: deploy:mastercopy --contract-version <version> - Deploys a specific version of the mastercopies across all contracts that have that version.
    • Verify Mastercopies: verify:mastercopies - Verifies the latest version of all mastercopies.
    • Verify Mastercopy with Version: verify:mastercopy --contract-version <version> - Verifies a specific version of the mastercopies across all contracts that have that version.
  2. Task Removal:

    • Removed the outdated setup.ts file, as its functionality has been replaced by the new, more modular task scripts.

Enhanced Functionality:

  • Version Handling:

    • The --contract-version flag is now optional. If not provided, the tasks default to using the latest version of the contracts.
    • When the --contract-version flag is provided, the tasks specifically target and deploy or verify the version specified across all applicable contracts.
  • Deployment Logic:

    • For deploying a mastercopy, the script first checks if the --contract-version parameter is set. If not, it defaults to the latest version. If a version is specified, the script deploys that version across all contracts with matching versions on the selected network.
  • Verification Logic:

    • Similar logic is applied to the verification process. The script temporarily generates artifacts for the contracts found based on the specified version and uses these artifacts for verification.

Example Usage:

  • Deploy the latest version of all mastercopies:
    yarn deploy:mastercopies --network <network>
  • Deploy a specific version (e.g., 1.2.0) of the mastercopies:
    yarn deploy:mastercopy --network <network> --contract-version 1.2.0
  • Verify the latest version of all mastercopies:
    yarn verify:mastercopies --network <network>
  • Verify a specific version (e.g., 1.2.0) of the mastercopies:
    yarn verify:mastercopy --network <network> --contract-version 1.2.0

Testing and Verification:

  • Logs of the tests conducted during deployment and verification processes will be added to demonstrate the successful execution of these tasks.

Deploy all mastercopies

contracts git:(use-zodiac-core-v2) yarn deploy-mastercopies hardhat
yarn run v1.22.18
$ yarn hardhat deploy:mastercopies --network hardhat
$ /Users/juliopavila/Documents/Projects/zodiac-module-exit/packages/contracts/node_modules/.bin/hardhat deploy:mastercopies --network hardhatExit@1.0.0: Deployment starting...
🚀 Exit@1.0.0: Successfully deployed at 0x35E35dcDc7Cd112B93C7c55987C86e5D6D419C69ExitERC20@1.1.0: Deployment starting...
🚀 ExitERC20@1.1.0: Successfully deployed at 0x33bCa41bda8A3983afbAd8fc8936Ce2Fb29121daExitERC20@1.2.0: Deployment starting...
🚀 ExitERC20@1.2.0: Successfully deployed at 0x3ed380a282aDfA3460da28560ebEB2F6D967C9f5ExitERC721@1.1.0: Deployment starting...
🚀 ExitERC721@1.1.0: Successfully deployed at 0xD3579C14a4181EfC3DF35C3103D20823A8C8d718ExitERC721@1.2.0: Deployment starting...
🚀 ExitERC721@1.2.0: Successfully deployed at 0xE0eCE32Eb4BE4E9224dcec6a4FcB335c1fe05CDeCirculatingSupply@1.0.0: Deployment starting...
🚀 CirculatingSupply@1.0.0: Successfully deployed at 0xd7a85e7D0813F8440602E243Acb67df3CCeb5a60CirculatingSupplyERC20@1.1.0: Deployment starting...
🚀 CirculatingSupplyERC20@1.1.0: Successfully deployed at 0xb50fab2e2892E3323A5300870C042B428B564FE3CirculatingSupplyERC20@1.2.0: Deployment starting...
🚀 CirculatingSupplyERC20@1.2.0: Successfully deployed at 0x5Ed57C291a184cc244F5c9B5E9F11a8DD08BBd12CirculatingSupplyERC721@1.1.0: Deployment starting...
🚀 CirculatingSupplyERC721@1.1.0: Successfully deployed at 0x71530ec830CBE363bab28F4EC52964a550C0AB1ECirculatingSupplyERC721@1.2.0: Deployment starting...
🚀 CirculatingSupplyERC721@1.2.0: Successfully deployed at 0xBD34D00dC0ae37C687F784A11FA6a0F2c5726Ba3
  Done in 2.63s.

Deploy the latest version

contracts git:(use-zodiac-core-v2) yarn deploy-mastercopy hardhat  
yarn run v1.22.18
$ yarn hardhat deploy:mastercopy --network hardhat
$ /Users/juliopavila/Documents/Projects/zodiac-module-exit/packages/contracts/node_modules/.bin/hardhat deploy:mastercopy --network hardhat
🚀 Exit@1.0.0: Successfully deployed at 0x35E35dcDc7Cd112B93C7c55987C86e5D6D419C69
🚀 ExitERC20@1.2.0: Successfully deployed at 0x3ed380a282aDfA3460da28560ebEB2F6D967C9f5
🚀 ExitERC721@1.2.0: Successfully deployed at 0xE0eCE32Eb4BE4E9224dcec6a4FcB335c1fe05CDe
🚀 CirculatingSupply@1.0.0: Successfully deployed at 0xd7a85e7D0813F8440602E243Acb67df3CCeb5a60
🚀 CirculatingSupplyERC20@1.2.0: Successfully deployed at 0x5Ed57C291a184cc244F5c9B5E9F11a8DD08BBd12
🚀 CirculatingSupplyERC721@1.2.0: Successfully deployed at 0xBD34D00dC0ae37C687F784A11FA6a0F2c5726Ba3
  Done in 2.31s.

Deploy specific version

contracts git:(use-zodiac-core-v2) yarn deploy-mastercopy hardhat --contract-version 1.2.0
yarn run v1.22.18
$ yarn hardhat deploy:mastercopy --network hardhat --contract-version 1.2.0
$ /Users/juliopavila/Documents/Projects/zodiac-module-exit/packages/contracts/node_modules/.bin/hardhat deploy:mastercopy --network hardhat --contract-version 1.2.0
⏭️ Skipping deployment of Exit@1.2.0: Version not found.
🚀 ExitERC20@1.2.0: Successfully deployed at 0x3ed380a282aDfA3460da28560ebEB2F6D967C9f5
🚀 ExitERC721@1.2.0: Successfully deployed at 0xE0eCE32Eb4BE4E9224dcec6a4FcB335c1fe05CDe
⏭️ Skipping deployment of CirculatingSupply@1.2.0: Version not found.
🚀 CirculatingSupplyERC20@1.2.0: Successfully deployed at 0x5Ed57C291a184cc244F5c9B5E9F11a8DD08BBd12
🚀 CirculatingSupplyERC721@1.2.0: Successfully deployed at 0xBD34D00dC0ae37C687F784A11FA6a0F2c5726Ba3
  Done in 2.50s.

** Verify all mastercopies **

contracts git:(use-zodiac-core-v2) yarn verify-mastercopies sepolia
yarn run v1.22.18
$ yarn hardhat verify:mastercopies --network sepolia
$ /Users/juliopavila/Documents/Projects/zodiac-module-exit/packages/contracts/node_modules/.bin/hardhat verify:mastercopies --network sepolia
🔄 Exit@1.0.0: Already verified at 0x35E35dcDc7Cd112B93C7c55987C86e5D6D419C69
🔄 ExitERC20@1.1.0: Already verified at 0x33bCa41bda8A3983afbAd8fc8936Ce2Fb29121da
🔄 ExitERC20@1.2.0: Already verified at 0x3ed380a282aDfA3460da28560ebEB2F6D967C9f5
🔄 ExitERC721@1.1.0: Already verified at 0xD3579C14a4181EfC3DF35C3103D20823A8C8d718
🔄 ExitERC721@1.2.0: Already verified at 0xE0eCE32Eb4BE4E9224dcec6a4FcB335c1fe05CDe
🔄 CirculatingSupply@1.0.0: Already verified at 0xd7a85e7D0813F8440602E243Acb67df3CCeb5a60
🔄 CirculatingSupplyERC20@1.1.0: Already verified at 0xb50fab2e2892E3323A5300870C042B428B564FE3
🔄 CirculatingSupplyERC20@1.2.0: Already verified at 0x5Ed57C291a184cc244F5c9B5E9F11a8DD08BBd12
🔄 CirculatingSupplyERC721@1.1.0: Already verified at 0x71530ec830CBE363bab28F4EC52964a550C0AB1E
🔄 CirculatingSupplyERC721@1.2.0: Already verified at 0xBD34D00dC0ae37C687F784A11FA6a0F2c5726Ba3
  Done in 12.50s.

** Verify latest mastercopy **

contracts git:(use-zodiac-core-v2) yarn verify-mastercopy sepolia  
yarn run v1.22.18
$ yarn hardhat verify:mastercopy --network sepolia
$ /Users/juliopavila/Documents/Projects/zodiac-module-exit/packages/contracts/node_modules/.bin/hardhat verify:mastercopy --network sepolia
🔄 Exit@1.0.0: Already verified at 0x35E35dcDc7Cd112B93C7c55987C86e5D6D419C69
🔄 ExitERC20@1.2.0: Already verified at 0x3ed380a282aDfA3460da28560ebEB2F6D967C9f5
🔄 ExitERC721@1.2.0: Already verified at 0xE0eCE32Eb4BE4E9224dcec6a4FcB335c1fe05CDe
🔄 CirculatingSupply@1.0.0: Already verified at 0xd7a85e7D0813F8440602E243Acb67df3CCeb5a60
🔄 CirculatingSupplyERC20@1.2.0: Already verified at 0x5Ed57C291a184cc244F5c9B5E9F11a8DD08BBd12
🔄 CirculatingSupplyERC721@1.2.0: Already verified at 0xBD34D00dC0ae37C687F784A11FA6a0F2c5726Ba3
  Done in 9.02s.

Verify specific version

contracts git:(use-zodiac-core-v2) yarn verify-mastercopy sepolia --contract-version 1.2.0
yarn run v1.22.18
$ yarn hardhat verify:mastercopy --network sepolia --contract-version 1.2.0
$ /Users/juliopavila/Documents/Projects/zodiac-module-exit/packages/contracts/node_modules/.bin/hardhat verify:mastercopy --network sepolia --contract-version 1.2.0
⏭️ Skipping deployment of Exit@1.2.0: Version not found.
⏭️ Skipping deployment of CirculatingSupply@1.2.0: Version not found.
🔄 ExitERC20@1.2.0: Already verified at 0x3ed380a282aDfA3460da28560ebEB2F6D967C9f5
🔄 ExitERC721@1.2.0: Already verified at 0xE0eCE32Eb4BE4E9224dcec6a4FcB335c1fe05CDe
🔄 CirculatingSupplyERC20@1.2.0: Already verified at 0x5Ed57C291a184cc244F5c9B5E9F11a8DD08BBd12
🔄 CirculatingSupplyERC721@1.2.0: Already verified at 0xBD34D00dC0ae37C687F784A11FA6a0F2c5726Ba3
  Done in 7.63s.

@cristovaoth
Copy link
Contributor

Nice work @juliopavila

After reviewing the drafted changes, I have a more defined direction in mind. It might be best to maintain four separate task files, with each one dedicated to a specific task:

  • deploy-mastercopies
  • deploy-mastercopy --version
  • verify-mastercopies
  • verify-mastercopy --version

The version flag would be optional, and when not provided, we would just use latest.

What do you think?

Copy link

github-actions bot commented Aug 19, 2024

Pull Request Test Coverage Report for Build 10562279492

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 93.717%

Totals Coverage Status
Change from base Build 10419254943: 0.0%
Covered Lines: 116
Relevant Lines: 117

💛 - Coveralls

@juliopavila juliopavila merged commit b98bc9f into use-zodiac-core Aug 26, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants