Template repository for getting started quickly with Vyper using a Foundry project.
Star this project on GitHub to make it reach more developers.
Click Use this template on GitHub to create a new repository with this repo as the initial state.
You will need the following dependencies:
For direct local use, use the following Forge command to create a new project (replace project with your project name):
forge init --template https://github.com/Patronum-Labs/foundry-vyper <project>├── src/
│ └── Greeting.vy # Vyper contract
├── test/
│ └── Greeting.t.sol # Solidity tests for the Vyper contract
├── script/
│ └── Greeting.s.sol # Deployment scripts
├── interfaces/
│ └── IGreeting.sol # Interfaces for the contracts
└── foundry.toml
- src/: This is where your Vyper contracts are located.
- test/: This is where you write Solidity tests for your Vyper contracts.
- script/: This is where you write scripts to deploy your contracts.
- interfaces/: This is where you create interfaces for the contracts you want to test or use in scripts.
To compile a Vyper contract, use the following command:
vyper src/Greeting.vyMake sure you have Vyper version 0.4.0 or higher:
vyper --version
> 0.4.0+commit.e9db8d9To run tests, use the following command:
forge testTo deploy your contracts using the script, you need to add PRIVATE_KEY in the .env file.
Then run the deployment script with the following command (replace <YOUR_RPC> with a link to an RPC provider):
forge script script/Greeting.s.sol:GreetingScript --rpc-url <YOUR_RPC> --broadcastThis repository is inspired by and uses code from the following projects:
We are grateful to the authors and contributors of these projects for their valuable work and inspiration.
- The Vyper deployer originally used the
pythoncommand. In this repository, it has been changed topython3for simplicity. If you encounter any issues running the tests, try switching back to python. - If
vyper --versionreturns a version lower than 0.4.0, please refer to the Vyper installation documentation. (If you experience issues with pip, try runningpython3 -m pip install vyper==0.4.0)