Skip to content

Add EVM Contract wizard #281

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

Merged
merged 4 commits into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions content/evm/_meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default {
'evm-general': 'EVM (General)',
'evm-hardhat': 'EVM with Hardhat',
'evm-foundry': 'EVM with Foundry',
'evm-wizard': 'EVM Contract Wizard',
'solidity-resources': 'Solidity Resources',
'nft-contract-tutorial': 'ERC721 (NFT) Contracts',

Expand Down
6 changes: 3 additions & 3 deletions content/evm/differences-with-ethereum.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Sei's EVM and Ethereum itself:
<table className="w-full divide-y divide-neutral-200 dark:divide-neutral-800">
<thead>
<tr>
<th className="px-4 py-3 text-left text-sm font-medium text-neutral-500 dark:text-neutral-400">Feature</th>
<th className="px-4 py-3 text-left text-sm font-medium text-neutral-500 dark:text-neutral-400">Sei EVM</th>
<th className="px-4 py-3 text-left text-sm font-medium text-neutral-500 dark:text-neutral-400">Ethereum</th>
<th className="px-4 py-3 text-left text-sm font-medium text-neutral-900 dark:text-neutral-100">Feature</th>
<th className="px-4 py-3 text-left text-sm font-medium text-neutral-900 dark:text-neutral-100">Sei EVM</th>
<th className="px-4 py-3 text-left text-sm font-medium text-neutral-900 dark:text-neutral-100">Ethereum</th>
</tr>
</thead>
<tbody className="divide-y divide-neutral-200 dark:divide-neutral-800">
Expand Down
116 changes: 116 additions & 0 deletions content/evm/evm-wizard.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Using the EVM OpenZeppelin Contract Wizard

The OpenZeppelin Contract Wizard is a powerful interactive tool that simplifies the creation of secure, standard-compliant smart contracts for Sei EVM. It provides a user-friendly interface for generating production-ready contract code based on OpenZeppelin's battle-tested libraries.

## Benefits of Using the Wizard

- **Security First**: All generated contracts use audited, industry-standard implementations
- **Time-Saving**: Eliminate boilerplate code and common setup configurations
- **Customizable**: Tailor contracts to your specific requirements through an intuitive UI
- **Educational**: Learn best practices by examining professionally structured contract code
- **Up-to-Date**: Always generates code compatible with the latest Solidity versions and standards

## Available Contract Types

<div className="overflow-x-auto max-w-full">
<table className="w-full divide-y divide-neutral-200 dark:divide-neutral-800">
<thead>
<tr>
<th className="px-4 py-3 text-left text-sm font-medium text-neutral-900 dark:text-neutral-100">Contract Type</th>
<th className="px-4 py-3 text-left text-sm font-medium text-neutral-900 dark:text-neutral-100">Description</th>
<th className="px-4 py-3 text-left text-sm font-medium text-neutral-900 dark:text-neutral-100">Common Use Cases</th>
</tr>
</thead>
<tbody className="divide-y divide-neutral-200 dark:divide-neutral-800">
<tr>
<td className="px-4 py-3 text-sm text-neutral-900 dark:text-neutral-100 whitespace-nowrap font-medium">ERC20</td>
<td className="px-4 py-3 text-sm text-neutral-600 dark:text-neutral-400 whitespace-nowrap">Standard fungible token</td>
<td className="px-4 py-3 text-sm text-neutral-600 dark:text-neutral-400">Cryptocurrencies, utility tokens, governance tokens</td>
</tr>
<tr>
<td className="px-4 py-3 text-sm text-neutral-900 dark:text-neutral-100 whitespace-nowrap font-medium">ERC721</td>
<td className="px-4 py-3 text-sm text-neutral-600 dark:text-neutral-400 whitespace-nowrap">Non-fungible token (NFT)</td>
<td className="px-4 py-3 text-sm text-neutral-600 dark:text-neutral-400">Digital collectibles, art, real estate, certifications</td>
</tr>
<tr>
<td className="px-4 py-3 text-sm text-neutral-900 dark:text-neutral-100 whitespace-nowrap font-medium">ERC1155</td>
<td className="px-4 py-3 text-sm text-neutral-600 dark:text-neutral-400 whitespace-nowrap">Multi-token standard</td>
<td className="px-4 py-3 text-sm text-neutral-600 dark:text-neutral-400">Gaming assets, mixed fungible/non-fungible collections</td>
</tr>
<tr>
<td className="px-4 py-3 text-sm text-neutral-900 dark:text-neutral-100 whitespace-nowrap font-medium">Governor</td>
<td className="px-4 py-3 text-sm text-neutral-600 dark:text-neutral-400 whitespace-nowrap">On-chain governance</td>
<td className="px-4 py-3 text-sm text-neutral-600 dark:text-neutral-400">DAO voting systems, protocol management</td>
</tr>
<tr>
<td className="px-4 py-3 text-sm text-neutral-900 dark:text-neutral-100 whitespace-nowrap font-medium">Stablecoin</td>
<td className="px-4 py-3 text-sm text-neutral-600 dark:text-neutral-400 whitespace-nowrap">Price-stable cryptocurrency</td>
<td className="px-4 py-3 text-sm text-neutral-600 dark:text-neutral-400">Trading pairs, remittances, reducing volatility, payment systems</td>
</tr>
<tr>
<td className="px-4 py-3 text-sm text-neutral-900 dark:text-neutral-100 whitespace-nowrap font-medium">Real-World-Asset</td>
<td className="px-4 py-3 text-sm text-neutral-600 dark:text-neutral-400 whitespace-nowrap">Tokenized physical assets</td>
<td className="px-4 py-3 text-sm text-neutral-600 dark:text-neutral-400">Real estate, commodities, securities, debt instruments, invoices</td>
</tr>
<tr>
<td className="px-4 py-3 text-sm text-neutral-900 dark:text-neutral-100 whitespace-nowrap font-medium">Custom</td>
<td className="px-4 py-3 text-sm text-neutral-600 dark:text-neutral-400 whitespace-nowrap">Specialized contracts</td>
<td className="px-4 py-3 text-sm text-neutral-600 dark:text-neutral-400">Access control, payment systems, timelock functions</td>
</tr>
</tbody>
</table>
</div>

## Step-by-Step Guide

1. **Access the Wizard**: Use the embedded widget (from OpenZeppelin) below or visit [wizard.openzeppelin.com](https://wizard.openzeppelin.com/)
2. **Select Contract Type**: Choose the standard that matches your project needs (ERC20, ERC721, etc.)
3. **Configure Basic Settings**:
- Set token name and symbol
- Choose Solidity version
- Select access control mechanism (Ownable, Roles, etc.)
4. **Add Security Features**:
- Pausable functionality
- Permit extensions
- Flash minting capabilities
- Voting mechanisms
5. **Customize Token Behavior**:
- Premint options
- Burning capabilities
- Token transfer rules
- Supply management
6. **Review Generated Code**: The code updates in real-time as you make selections
7. **Copy and Implement**: Use the "Copy to clipboard" button to export your contract code
8. **Deploy**: The generated code is ready for compilation and deployment

## Interactive OpenZeppelin Wizard

Explore and create your custom smart contracts using the embedded wizard below:

<div>
<iframe src="https://wizard.openzeppelin.com/embed" className="w-full h-[700px] border-0 !border-0 bg-white dark:bg-black" title="OpenZeppelin Contract Wizard" />
</div>

## Tips for Effective Use

- **Start Simple**: Begin with minimal features and add complexity incrementally
- **Understand Each Option**: Hover over the information icons (ℹ️) for detailed explanations
- **Review Dependencies**: Note which OpenZeppelin libraries your contract imports
- **Consider Gas Costs**: More features generally mean higher deployment and operation costs
- **Customize Post-Generation**: The wizard provides a starting point—most projects will require additional customization

## Beyond the Wizard

While the wizard is excellent for starting development, consider these next steps:

1. **Test Thoroughly**: Create comprehensive test suites for your generated contracts
2. **Security Audit**: Consider professional audits for high-value contracts
3. **Documentation**: Add detailed comments and generate documentation
4. **Optimization**: Review for gas optimization opportunities
5. **Upgradability**: Consider implementing upgrade patterns for long-lived contracts

## Learn More

- [OpenZeppelin Contracts Documentation](https://docs.openzeppelin.com/contracts/)
- [OpenZeppelin GitHub Repository](https://github.com/OpenZeppelin/openzeppelin-contracts)
- [OpenZeppelin Community Forum](https://forum.openzeppelin.com/)
8 changes: 4 additions & 4 deletions content/evm/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import { RpcSelector } from '../../src/components';
<table className="min-w-full divide-y divide-neutral-200 dark:divide-neutral-800">
<thead>
<tr>
<th className="px-4 py-3 text-left text-sm font-medium text-neutral-500 dark:text-neutral-400">Feature</th>
<th className="px-4 py-3 text-left text-sm font-medium text-neutral-500 dark:text-neutral-400">Sei EVM</th>
<th className="px-4 py-3 text-left text-sm font-medium text-neutral-500 dark:text-neutral-400">Ethereum</th>
<th className="px-4 py-3 text-left text-sm font-medium text-neutral-500 dark:text-neutral-400">Other Layer 1s</th>
<th className="px-4 py-3 text-left text-sm font-medium text-neutral-900 dark:text-neutral-100">Feature</th>
<th className="px-4 py-3 text-left text-sm font-medium text-neutral-900 dark:text-neutral-100">Sei EVM</th>
<th className="px-4 py-3 text-left text-sm font-medium text-neutral-900 dark:text-neutral-100">Ethereum</th>
<th className="px-4 py-3 text-left text-sm font-medium text-neutral-900 dark:text-neutral-100">Other Layer 1s</th>
</tr>
</thead>
<tbody className="divide-y divide-neutral-200 dark:divide-neutral-800">
Expand Down
11 changes: 1 addition & 10 deletions content/evm/solidity-resources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ This page suggests a minimal set of resources for getting started with building

## Using the OpenZeppelin Wizard

OpenZeppelin provides a convenient web-based wizard to create standard contracts. Visit [https://wizard.openzeppelin.com/](https://wizard.openzeppelin.com/) to access it.
OpenZeppelin provides a convenient web-based wizard to create standard contracts. Visit the docs section for it [here](./evm-wizard) or [https://wizard.openzeppelin.com/](https://wizard.openzeppelin.com/) to access it.

The wizard allows you to:

Expand All @@ -106,15 +106,6 @@ The wizard is perfect for:
- Exploring different configuration options
- Understanding best practices in contract development

Here's how to use it:

1. Visit [https://wizard.openzeppelin.com/](https://wizard.openzeppelin.com/)
2. Select the type of contract you want to create
3. Configure the settings (name, symbol, features)
4. Add any additional functionality you need
5. Copy the generated code and paste it into your project
6. Customize as needed

## Best Practices & Security Considerations

When developing on Sei V2 EVM with OpenZeppelin contracts, follow these best practices:
Expand Down