embark/site/source/docs/vyper.md

1.2 KiB

title: Vyper

As of Embark 3.0, Vyper is supported out of the box. You only need to install the compiler yourself.

Embark's Vyper support means that any files with the extension .vy in the contracts directory will be deployed with the file name as the contract name, so, for instance, contracts/Crowdfunding.vy will be deployed as Crowdfunding.

To see Vyper in action, generate a new demo project by running:

$ embark demo

Inside the demo's root directory, remove contracts/simple_storage.sol and replace it with this file instead:

# contracts/SimpleStorage.vy
storedData: public(uint256)

@public
def __init__(initialValue: uint256):
  self.storedData = initialValue

@public
@payable
def set(x: uint256):
  self.storedData = x

@public
def get() -> uint256:
  return self.storedData

This has exactly the same logic as its Solidity counterpart, so the tests will still pass:

$ embark test

The full documentation for Vyper can be found here