Let’s take a look at our smart contract:
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)
Take a look at the first line:
name: public(bytes[24])
The array of bytes is basically a string. The variable called name has a type of array of bytes or string. Its visibility is public. If you want to set it to private, then just omit the public keyword, as follows:
name: bytes[24]
Now, take a look at the next lines:
@public
def __init__():
self.name = “Satoshi Nakamoto”
If you are coming from a Python background, then you will recognize the Python decorator function. There are four of these in Vyper:
- @public means you can execute this method as...