class: title # Vyper --- background-image: url(bg.jpeg) ## Agenda 1. Course Expectations 2. Vyper Types 3. Using Vyper Structures 4. Comparing and Contrasting Vyper and Solidity --- background-image: url(bg.jpeg) ## Course Expectations - All course submissions are subject to the [Plagiarism Academic Honesty](https://coned.georgebrown.ca/policies/plagiarism-academic-honesty/) at George Brown College - In addition to copying from the internet, this includes lecture slides and all code demos that are provided by professors - Plaigiarized assignments will be given a mark of 0% --- background-image: url(bg.jpeg) ### Deploying a Vyper Contract - Use vyper.online, which provides the ABI and Bytecode of your vyper code - Use MyEtherWallet or MyCrypto to deploy --- class: col-3 ### Types - boolean - signed integer - unsigned integer - decimal - address - uint types - time, wei, custom-defined by developer - bytes32 array - fixed bytesize array - fixed string size - fixed size lists - structs - mappings --- background-image: url(bg.jpeg) ## Defining Variables ### Solidity ```javascript type accessControl varName address public voter ``` ### Vyper ```python varName: accessControl ( type ) voter: public ( address ) ``` #### Defining Variables: A Demo --- background-image: url(bg.jpeg) ## Declaring Constructors ### Solidity ```javascript constructor () public { ... } ``` ### Vyper ```python @public def __init__() ``` #### Defining Constructors: A Demo --- background-image: url(bg.jpeg) ## Defining Functions ### Solidity ```javascript function functionName() public { ... } ``` ### Vyper ```python @public def functionName(): ... ... ``` #### Defining Functions: A Demo --- background-image: url(bg.jpeg) ## Defining Functions with Arguments ### Solidity ```javascript function functionName (type varName) public { ... } ``` ### Vyper ```python @public def functionName(_varName: type): ... ... ``` #### Defining Functions with Arguments: A Demo --- background-image: url(bg.jpeg) ## Defining Payable Functions ### Solidity ```javascript function functionname() public payable { ... } ``` ### Vyper ```python @public @payable def functionName(_varName: type): ... ... ``` #### Defining Payhable Functions: A Demo --- background-image: url(bg.jpeg) ## Require ### Solidity ```javascript require( some boolean operation, "message"); ``` ### Vyper ```python assert (some boolean operation) ``` #### Using Require Statements --- background-image: url(bg.jpeg) ## Self - Required to be able to assign variables in vyper - Omitting the self will not actually assign anything --- background-image: url(bg.jpeg) ## Vyper vs Solidity ### Similarities - Both allow us to control operations on the blockchain ### Differences - Syntactical difference (Solidity - JS; Vyper - Python) --- background-image: url(bg.jpeg) ## Lab: Vyper Contract Write a smart contract in Vyper to address a use case of your choice. Use the following structures: - 4 functions - state variables - at least 1 event - deploy the contract onto a public testnet **Due - By the end of class**