Skip to content

Vyper language features

Denis Bogdanas edited this page Apr 9, 2018 · 5 revisions

Here we briefly enumerate the features of Vyper language. All of them are fully supported by K Vyper semantics. The semantics is based on the following commit of Vyper compiler: https://github.com/ethereum/vyper/commit/9fb7281cddfdea9174008860edbeedb062c53aa0

For more information please look at the Vyper documentation (currently work in progress):

https://github.com/ethereum/vyper

https://github.com/ethereum/vyper/blob/master/docs/types.rst

https://github.com/ethereum/vyper/blob/master/docs/built-in-functions.rst

Enumeration of Vyper features

Contract members:

  • functions
  • global variables
  • events
  • contract interfaces

Types:

  • int128
  • uint256
  • decimal
  • bytes32
  • address
  • bool
  • unit types
  • bytes[n] - variable-size byte arrays
  • list
  • struct
  • tuple
  • map

Statements:

  • variable declaration: a: int128 or a: int128 = e
  • assignment: a = e
  • augmented assignment: a += e
  • if
  • for in range: for i in in range(rounds) or for i in in range(start, end)
  • for in list: for elem in [1, 2, 3]
  • break
  • continue
  • return
  • assert
  • throw
  • log - event logging
  • del - deleting elements from a map
  • function calls
  • external contract calls

Binary operators: + - * / % **

Unary operators: ! -

Boolean operators: and or

Comparison operators: < <= > >= == != in

Reserved expressions:

  • balance
  • codesize
  • is_contract
  • msg.sender
  • msg.value
  • msg.gas
  • block.difficulty
  • block.timestamp
  • block.coinbase
  • block.number
  • block.prevhash

Functions:

  • floor
  • ceil
  • decimal
  • as_unitless_number
  • convert
  • slice
  • len
  • concat
  • keccak256
  • method_id
  • ecrecover
  • ecadd
  • ecmul
  • extract32
  • as_wei_value
  • raw_call
  • create_with_code_of
  • RLPlist
  • blockhash
  • bitwise_and
  • bitwise_or
  • bitwise_xor
  • bitwise_not
  • uint256_add
  • uint256_sub
  • uint256_mul
  • uint256_div
  • uint256_exp
  • uint256_mod
  • uint256_addmod
  • uint256_mulmod
  • uint256_gt
  • uint256_ge
  • uint256_lt
  • uint256_le
  • shift
  • min
  • max
  • sha3
  • raw_log
  • RLPList
Clone this wiki locally