Logo

dev-resources.site

for different kinds of informations.

Try Vyper in Truffle v5.

Published at
12/19/2018
Categories
ethereum
vyper
truffle
Author
sot528
Categories
3 categories in total
ethereum
open
vyper
open
truffle
open
Author
6 person written this
sot528
open
Try Vyper in Truffle v5.

Truffle v5 supported Vyper.
I made Docker image to try it easialy.(Dockerfile)

How to use

docker run -it sot528/truffle-vyper-test

In the container

It unboxed vyper-example-box. So you can use below.

$ truffle test

Using network 'test'.



  Contract: VyperStorage
    โœ“ ...should store the value 89. (114ms)


  1 passing (129ms)

It works.
You can try anything via editing ./contracts/VyperStorage.vy and truffle compile.

stored_data: uint256

@public
def set(new_value : uint256):
    self.stored_data = new_value

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

The test file is ./test/vyperStorage.js.

const VyperStorage = artifacts.require("VyperStorage");

contract("VyperStorage", () => {
  it("...should store the value 89.", async () => {
    const storage = await VyperStorage.deployed();

    // Set value of 89
    await storage.set(89);

    // Get stored value
    const storedData = await storage.get();

    assert.equal(storedData, 89, "The value 89 was not stored.");
  });
});

If you see the error below, then you should remove all of the files in build.

Error parsing /code/contracts/VyperStorage.vy: ParsedContract.sol:1:1: ParserError: Expected pragma, import directive or contract/interface/library definition.
stored_data: uint256
^---------^
Compilation failed. See above.
Truffle v5.0.0 (core: 5.0.0)
vyper Article's
24 articles in total
Favicon
Vyper - Write your First Python Smart Contract (Series)
Favicon
vyperๆŒบๅฅฝ็Žฉ็š„
Favicon
How to use 'initializes' and 'exports' in vyper: Modular Vyper code arrangement.
Favicon
A Simple Vyper smart contract to fetch the price of BTC using Chainlink and Apeworx.
Favicon
Vyper beginner's tutorial: Variables.
Favicon
Mastering Vyper Functions(part1 )
Favicon
How to compile, deploy and interact with smart contracts using Apeworx(ape) and VS Code.
Favicon
Vyper: For loops and Arrays.
Favicon
Mastering functions in Vyper(part2)
Favicon
Vyper Beginner's tutorial: Syntax and Structure.
Favicon
How to interact with Smart Contracts using Python and Django.
Favicon
How to Interact with Smart Contracts locally using web3.py
Favicon
Writing Smart Contracts using Vyper, Remix IDE and deploying them on BNB Smart Chain.
Favicon
Create your own Uniswap DeFi Application๐Ÿฆ„! From scratch using Vyper & Python๐Ÿ
Favicon
Challenge #2: ๐Ÿช™ Multi Token Vendor | Speedrun Ethereum With Vyper
Favicon
Introduction to EVM Smart Contract development
Favicon
Challenge #1: ๐Ÿฅฉ Decentralized Staking App | Speedrun Ethereum With Vyper ๐Ÿ
Favicon
Challenge #0: ๐Ÿ–ผ๏ธ Simple NFT Example | Speedrun Ethereum With Vyper ๐Ÿ
Favicon
Understanding Chainlink VRF: A Tool for Random Number Generation on the Blockchain
Favicon
Constant Product Market Maker (CAMM): The standard in Decentralized Finance
Favicon
Compiling and testing Vyper contract using Foundry
Favicon
Usando constant e immutable para reduzir o custo de gรกs
Favicon
ERC20 Token with Vyper and Brownie
Favicon
Try Vyper in Truffle v5.

Featured ones: