Plugin for Ape Ethereum Framework for compiling Vyper contracts
Project description
Quick Start
Ape compiler plugin around VVM
Dependencies
- python3 version 3.8 up to 3.11.
Installation
via pip
You can install the latest release via pip
:
pip install ape-vyper
via setuptools
You can clone the repository and use setuptools
for the most up-to-date version:
git clone https://github.com/ApeWorX/ape-vyper.git
cd ape-vyper
python3 setup.py install
Quick Usage
First, place Vyper contract source files (files with extension .vy
) in your Ape project's contracts folder.
An example Vyper contract can be found here.
Then, from your root Ape project folder, run the command:
ape compile
The .vy
files in your project will compile into ContractTypes
that you can deploy and interact with in Ape.
Compiler Version
By default, the ape-vyper
plugin uses version pragma for version specification.
However, you can also configure the version directly in your ape-config.yaml
file:
vyper:
version: 0.3.7
EVM Versioning
By default, ape-vyper
will use whatever version of EVM rules are set as default in the compiler version that gets used,
or based on what the #pragma evm-version ...
pragma comment specifies (available post-v0.3.10
).
Sometimes, you might want to use a different version, such as deploying on Arbitrum or Optimism where new opcodes are not supported yet.
If you want to require a different version of EVM rules to use in the configuration of the compiler, set it in your ape-config.yaml
like this:
vyper:
evm_version: paris
NOTE: The config value chosen will not override if a pragma is set in a contract.
Interfaces
You can not compile interface source files directly.
Thus, you must place interface files in a directory named interfaces
in your contracts_folder
e.g. contracts/interfaces/IFace.vy
.
Then, these files can be imported in other .vy
sources files via:
import interfaces.IFace as IFace
Alternatively, use JSON interfaces from dependency contract types by listing them under the import_remapping
key:
# Use `voting` example contracts from Vyperlang repo.
dependencies:
- name: VyperVoting
github: vyperlang/vyper
contracts_folder: examples/voting/
version: v0.3.8
# Automatically allow importing voting contracts in your project.
vyper:
import_remapping:
- "voting=VyperVoting@v0.3.8"
Import the voting contract types like this:
# @version 0.3.10
import voting.ballot as ballot
Pragmas
Ape-Vyper supports Vyper 0.3.10's new pragma formats
Version Pragma
#pragma version 0.3.10
EVM Version Pragma
#pragma evm-version paris
Optimization Pragma
#pragma optimize codesize
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ape_vyper-0.7.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae7e2ea395f818bc064329c56353a485ff23a547f69e9bb88f07471ef96dcf36 |
|
MD5 | ae072a082a5bd1e76861dec2d62f7886 |
|
BLAKE2b-256 | b81e4d64fbe9d2c1d7ebb6e3f97722360bd7a35b959a6b8083696a6717b7b316 |