Now let's create a smart contract with Vyper. First, we will create a file with the .vy extension and name it hello.vy, as follows:
name: public(bytes[24])
@public
def __init__():
self.name = "Satoshi Nakamoto"
@public
def change_name(new_name: bytes[24]):
self.name = new_name
@public
def say_hello() -> bytes[32]:
return concat("Hello, ", self.name)
If you come from a Solidity or Python background, you will notice a peculiarity: there is no class (as in the Python programming language) and there is no contract (as in the Solidity programming language) in a smart contract written with the Vyper programming language. However, there is an initializer function. The name of the initializer function is the same as it is in the Python programming language, which is __init__.
While using Python, you can create as many...