Skip to content

Conversation

ericglau
Copy link
Member

@ericglau ericglau commented Aug 26, 2025

Adds a Polkadot tab based on Solidity, with the following differences:

  • Omit Account tab due to native account abstraction being available in Polkadot
  • Omit Superchain specific functionality
  • Temporarily omit Governor, ERC20/721 Votes, and ERC20Permit due to those requiring ECDSA and ecrecover. Requires further investigation.
  • Omits Download Foundry package.
  • Change "Open in Remix" to "Open in Polkadot Remix" with different URL.

Remaining to do:

  • Override available options in the model (e.g. remove ERC20 permit so it does not appear by default)
  • Override available contracts for AI Assistant
  • Override Download Hardhat package function?
    • Determine if Polkadot Hardhat plugins should be enabled on the generated project
    • Determine if Polkadot specific configuration are needed in the Hardhat config, such as for the local Hardhat development network. If so, what should be the configuration settings?
    • Determine if Polkadot specific changes are needed for generated tests or deployment scripts
    • When Upgradeability is enabled, the downloaded Hardhat package includes OpenZeppelin Hardhat Upgrades plugin. Test if it works with Polkadot networks.
  • Determine if Governor/votes/permit should be re-enabled at any point before release.
  • Determine if any Polkadot-specific MCP tools are desired for Solidity.

Summary by Sourcery

Add a Polkadot tab to the Contracts Wizard by reusing the Solidity flow with custom overrides that disable unsupported features and adjust UI components, and update navigation, theming, and app initialization to support the new Polkadot context

New Features:

  • Introduce Polkadot as a new app type in the contracts wizard
  • Add a standalone Polkadot HTML page and Svelte PolkadotApp that wraps the existing SolidityApp with Polkadot-specific overrides
  • Extend selection and initialization logic in main.ts to recognize “polkadot” and launch PolkadotApp
  • Provide navigation switch links and icon assets for Polkadot in the UI

Enhancements:

  • Implement an Overrides API to omit tabs, features, and adjust button labels/links (e.g., hide Account and Governor tabs, rename “Open in Remix” to “Open in Polkadot Remix”, disable Download Foundry)
  • Make controls components accept an omitFeatures prop to conditionally hide superchain, permit, and votes options
  • Update App.svelte to apply overrides for feature visibility and button visibilities
  • Add Polkadot theme variables and CSS styling for the active Polkadot tab

Chores:

  • Add removeUnsupportedFeatures utility to strip unsupported options from generic wizard options

Copy link

sourcery-ai bot commented Aug 26, 2025

Reviewer's Guide

This PR integrates a new Polkadot tab into the existing Solidity wizard by parameterizing and overriding key UI features, routing logic, and deployment buttons. It layers in an Overrides API to omit unsupported features and tabs, adapts the remix integration for Polkadot Remix URLs, and injects Polkadot-specific assets (HTML, CSS, icons) while keeping the original Solidity code paths largely intact.

Class diagram for removeUnsupportedFeatures utility

classDiagram
    class removeUnsupportedFeatures {
      +removeUnsupportedFeatures(opts: GenericOptions): GenericOptions
    }
    class GenericOptions {
      kind: string
      permit: boolean
      votes: boolean
      crossChainBridging: string | boolean
    }
    removeUnsupportedFeatures --> GenericOptions
Loading

File-Level Changes

Change Details Files
Add Polkadot platform integration and routing
  • Register "polkadot" in main.ts evaluation and instantiate PolkadotApp
  • Introduce public/polkadot.html and insert Polkadot switch links in existing HTML shells
  • Ship new Polkadot HTML, CSS, and icon assets for nav and theme
src/main.ts
public/*.html
public/icons/polkadot.svg
public/icons/polkadot_active.svg
Implement Overrides API in solidity/App
  • Define Overrides and defaultOverrides in overrides.ts
  • Add overrides prop to App.svelte and propagate to getButtonVisibilities
  • Extend remixURL to consume overrideRemixURL and update Open button label
  • Use overrides.omitTabs to hide Account/Governor buttons and overrides.omitZipFoundry to suppress Foundry zip
  • Pass overrides.omitFeatures map into each control component
src/solidity/App.svelte
src/solidity/remix.ts
src/solidity/overrides.ts
Enable omitFeatures flagging in control components
  • Add omitFeatures prop to ERC20, ERC721, Stablecoin, RealWorldAsset controls
  • Wrap superchain tooltip initialization and show calls with omitFeatures conditions
  • Guard Permit and Votes sections behind omitFeatures.includes checks
src/solidity/ERC20Controls.svelte
src/solidity/RealWorldAssetControls.svelte
src/solidity/StablecoinControls.svelte
src/solidity/ERC721Controls.svelte
Adapt UI theme and styles for Polkadot
  • Declare --polkadot-pink CSS variable and switch-polkadot active style
  • Insert Polkadot switch in nav bars across standalone.css and vars.css
  • Add theme overrides in Polkadot App.svelte for tab highlight
src/standalone.css
src/common/styles/vars.css
public/*.html
src/polkadot/App.svelte
Add utility for removing unsupported features
  • Create removeUnsupportedFeatures.ts to strip permit, votes, superchain when applicable
  • Define Overrides interface in overrides.ts alongside defaultOverrides
src/polkadot/remove-unsupported-features.ts
src/solidity/overrides.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

coderabbitai bot commented Aug 26, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • 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.
  • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

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.

1 participant