/foundry-vyper

A package for deploying and compiling vyper code in foundry

Primary LanguageSolidity

Foundry/Vyper


Vyper logo Vyper logo


A package for running, deploying, and working with vyper contracts in a foundry setup.

Table of Contents

Getting Started

Requirements

The following will need to be installed in order to use this template. Please follow the links and instructions.

  • Git
    • You'll know you've done it right if you can run git --version
  • Foundry / Foundryup
    • This will install forge, cast, and anvil
    • You can test you've installed them right by running forge --version and get an output like: forge 0.2.0 (f016135 2022-07-04T00:15:02.930499Z)
    • To get the latest of each, just run foundryup
  • Vyper Compiler
    • You'll know you've done it right if you can run vyper --version and get an output like: 0.3.4+commit.f31f0ec

Quickstart

  1. Install the package.
forge install PatrickAlphaC/foundry-vyper --no-commit
  1. Update remappings.txt

Either make a remappings.txt file or just add the following to it:

foundry-vyper/=lib/foundry-vyper/src/
  1. Use the Vyper Deployer Contract!
import "foundry-vyper/VyperDeployer.sol";
import "src/interfaces/ISimpleStorage.sol";
.
.
.
function deploy() public {
    string vyperSimpleStorageLocation = "src/VSimpleStorage.vy";
    vyperDeployer = new VyperDeployer();
    address vyContractAddress = vyperDeployer.deployContract(vyperSimpleStorageLocation);
    ISimpleStorage simpleStorage = ISimpleStorage(vyContractAddress); 
}

Deploying with arguments

To deploy with arguments, just abi encode your arguments:

vyperDeployer.deployContract("SimpleStore", abi.encode(1234))

Acknowledgments