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: Deploy instant rewards contracts #187

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

andresaiello
Copy link
Collaborator

@andresaiello andresaiello commented Sep 17, 2024

Summary

  • Deploy contracts
  • Refactor scripts

Summary by CodeRabbit

  • New Features

    • Introduced a manifest for smart contract deployment, enhancing upgradeability and management.
    • Added InstantRewards smart contract deployment script.
    • Implemented a new helper function for contract verification.
  • Updates

    • Updated contract addresses for ZetaXP and added a new address for InstantRewards.
  • Refactor

    • Improved modularity by importing verification logic in the xp-nft deployment script.

Copy link

coderabbitai bot commented Sep 17, 2024

Walkthrough

Walkthrough

This pull request introduces several significant updates to the smart contract framework within the zevm-app-contracts package. Key changes include the addition of a manifest JSON file for smart contract deployment, updates to contract addresses in the addresses.json file, the introduction of a contract verification helper function, and a deployment script for the InstantRewards contract. Additionally, the xp-nft deployment script has been refined to utilize the new verification function, enhancing modularity and maintainability.

Changes

Files Change Summary
packages/zevm-app-contracts/.openzeppelin/unknown-7000.json Introduced a manifest JSON file detailing smart contract deployment, including admin address, transaction hashes, and storage layout for ERC721Upgradeable and ZetaXP.
packages/zevm-app-contracts/data/addresses.json Updated the address for "ZetaXP" and added a new key "InstantRewards" with its address.
packages/zevm-app-contracts/scripts/explorer.helpers.ts Added a new verifyContract function for verifying deployed contracts, handling success and error logging.
packages/zevm-app-contracts/scripts/instant-rewards/deploy.ts Created a deployment script for the InstantRewards contract, including network validation and address saving.
packages/zevm-app-contracts/scripts/xp-nft/deploy.ts Removed local verifyContract function; now imports from explorer.helpers, enhancing modularity.

Possibly related PRs


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai generate interesting stats about this repository and render them as a table.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Collaborator

@GMaiolo GMaiolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 18cd9e5 and 2c66c0f.

Files selected for processing (5)
  • packages/zevm-app-contracts/.openzeppelin/unknown-7000.json (1 hunks)
  • packages/zevm-app-contracts/data/addresses.json (1 hunks)
  • packages/zevm-app-contracts/scripts/explorer.helpers.ts (1 hunks)
  • packages/zevm-app-contracts/scripts/instant-rewards/deploy.ts (1 hunks)
  • packages/zevm-app-contracts/scripts/xp-nft/deploy.ts (1 hunks)
Additional comments not posted (8)
packages/zevm-app-contracts/scripts/explorer.helpers.ts (1)

3-15: LGTM!

The verifyContract function is well-structured and follows best practices for error handling and logging. The use of the run function from Hardhat to execute the verify:verify command is a clean and efficient approach. The function is also exported, which promotes reusability across the codebase.

The function takes the necessary parameters (contractAddress and constructorArguments) to perform the verification process and handles errors gracefully by catching and logging them. The log messages provide clear indications of the verification process's start, success, and failure states.

Overall, the implementation is solid and production-ready.

packages/zevm-app-contracts/data/addresses.json (2)

19-19: Verify the new address for the "ZetaXP" key.

Please ensure that the updated address 0x9A4e8bB5FFD8088ecF1DdE823e97Be8080BD38cb is correct and has been thoroughly tested before deploying it to the production environment. Confirm that the associated smart contract at this address is functioning as expected and has undergone rigorous testing to prevent any unexpected behavior or failures in the application.


20-20: Verify the new address for the "InstantRewards" key and ensure thorough testing and auditing.

The introduction of the new "InstantRewards" key and its associated address 0x018412ec1D5bBb864eAe0A4BECaa683052890238 suggests that a new smart contract has been deployed for handling instant rewards functionality. It is crucial to ensure that this address is correct and points to a thoroughly tested and audited smart contract before integrating it into the production environment.

Please confirm that the smart contract at this address has undergone rigorous testing and has been audited by a reputable third-party auditing firm to identify and address any potential vulnerabilities or security risks. Integrating an untested or unaudited contract could introduce unexpected behavior or security vulnerabilities in the application, potentially leading to financial losses or reputational damage.

packages/zevm-app-contracts/scripts/instant-rewards/deploy.ts (1)

28-31: LGTM!

The main function serves as a clear entry point for the script, performing the necessary network validation before invoking the deployment function. The implementation is concise and follows best practices.

packages/zevm-app-contracts/scripts/xp-nft/deploy.ts (2)

2-2: LGTM!

The import statement for ethers, network, and upgrades from the hardhat package is correct and necessary for the deployment script.


6-6: Excellent refactor!

Importing the verifyContract function from the explorer.helpers module is a great step towards enhancing modularity and maintainability. By utilizing an external verification function, you promote code reuse and keep the deployment script focused on its primary responsibility. Well done!

packages/zevm-app-contracts/.openzeppelin/unknown-7000.json (2)

1-13: LGTM!

The manifest metadata is complete and correctly formatted. The use of a transparent proxy aligns with the upgradeable contract design.


14-310: LGTM!

The storage layout is comprehensive and correctly formatted. It includes storage variables from various contracts, such as Initializable, ContextUpgradeable, ERC165Upgradeable, ERC721Upgradeable, OwnableUpgradeable, Ownable2StepUpgradeable, EIP712Upgradeable, and ZetaXP.

The inclusion of these storage variables suggests that the ZetaXP contract inherits from or uses these contracts, providing a clear understanding of the contract's state and organization.

The storage layout is essential for ensuring the correct deployment and upgradeability of the contract.

Comment on lines +10 to +11
const signer = "0x1d24d94520B94B26351f6573de5ef9731c48531A";
const owner = "0x1d24d94520B94B26351f6573de5ef9731c48531A";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting the signer and owner addresses into environment variables or configuration files.

Hardcoding the signer and owner addresses directly in the script reduces flexibility and maintainability. It is recommended to extract these values into environment variables or configuration files, allowing for easier modification and reuse across different environments.

@andresaiello andresaiello merged commit a0df721 into main Sep 17, 2024
11 of 12 checks passed
@andresaiello andresaiello deleted the andy/pd-6628-deploy-instant-rewards-contracts branch September 17, 2024 20:08
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