A Scaffold-ETH 2 extension that replaces Solidity with Vyper for smart contract development. This extension provides a complete setup for developing, testing, and deploying smart contracts using the Vyper programming language.
- Vyper v0.4.0 Support: Latest stable Vyper compiler with modern syntax
- Hardhat Integration: Seamless integration with Hardhat using
@nomiclabs/hardhat-vyper - Sample Contract: Equivalent Vyper implementation of the default YourContract
- Modern Vyper Syntax: Uses
@deploy,@external,@payable, and other standard Vyper features - Full Compatibility: Works with all existing Scaffold-ETH 2 features and hooks
- Automatic Setup: Post-install script automatically configures Vyper
Create a new Scaffold-ETH 2 project with Vyper support:
npx create-eth@latest -e kmjones1979/vyper-extensioncd <your_project_name>The extension automatically configures:
- ✅ Vyper plugin import
- ✅ Vyper v0.4.0 compiler configuration
- ✅ Sample Vyper contract (YourContract.vy)
- ✅ Deployment scripts
Start your development environment:
yarn chain # In terminal 1
yarn start # In terminal 2
yarn deploy # In terminal 3That's it! Your Vyper dApp is ready to go! 🎉
- YourContract.vy: A Vyper implementation of the default contract featuring:
- State variables with proper typing
- Events with indexed parameters
- Constructor function
- Payable functions
- Owner-only functions with assertions
- ETH withdrawal functionality
| Feature | Solidity | Vyper |
|---|---|---|
| Constructor | constructor() |
@deploy def __init__(): |
| Modifiers | modifier isOwner() |
Direct assertions in functions |
| Events | emit EventName() |
log EventName() |
| Immutable | immutable |
immutable(type) |
| Fallback | receive() |
@payable def __default__(): |
This error occurs when the Vyper plugin isn't properly configured. The extension should handle this automatically, but if you encounter issues:
- Verify the setup ran correctly:
cd packages/hardhat
yarn setup-vyper- Check the imports in
hardhat.config.ts:
import "@nomiclabs/hardhat-vyper"; // Should be present- Check the vyper configuration:
vyper: {
version: "0.4.0",
},- Clean and recompile:
yarn clean && yarn compileIf you see TypeScript errors about unknown properties, ensure the Vyper import is properly placed in hardhat.config.ts. The setup script handles this automatically.
If you encounter version pragma mismatches:
- Ensure contract uses
# @version ^0.4.0 - Ensure config uses
version: "0.4.0" - Both must match exactly
yarn compileyarn deployyarn testThe extension uses a combination of:
- Template Args: Adds the Vyper plugin import via
hardhat.config.ts.args.mjs - Setup Script: Automatically adds Vyper configuration section after install
- Post-install Hook: Runs setup script automatically via
package.json
This ensures seamless integration with Scaffold-ETH 2's build system.
To share this extension with others:
- Push to GitHub: Upload the extension directory to a GitHub repository
- Share the command: Others can use your extension with:
npx create-eth@latest -e {your-github-username}/{vyper-extension-repo}The extension is now fully compatible with Scaffold-ETH 2's extension system and provides a complete Vyper development environment out of the box!
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.