Skip to content

Latest commit

 

History

History
52 lines (29 loc) · 2.19 KB

contract_structure.md

File metadata and controls

52 lines (29 loc) · 2.19 KB

Chapter 1: Contracts

Starting with the absolute basics:

A contract is the fundamental building block of Ethereum applications — all variables and functions belong to a contract, and this will be the starting point of all your projects.

Vyper contracts are contained within files. Each file contains exactly one contract.

Version Pragma

Vyper supports a version pragma to ensure that a contract is only compiled by the intended compiler version, or range of versions. Version strings use NPM style syntax.

For the scope of this tutorial, we'll want to compile our smart contracts with any compiler version in the range of 0.2.0 (inclusive) to 0.3.0 (exclusive). It looks like this:

# @version >=0.2.0 <0.3.0

Put it to the test

  1. In the box to the right, let's create a contract that can be compiled by any compiler version in the range of 0.2.4 (inclusive) to 0.3.0 (exclusive).

  2. When you're finished, you can switch from 🛠 Your code tab to the ✅ Solution tab to check if your answer matches with the solution (Tabs are on the bottom right of the screen).

  3. Check the difference between 🛠 Your code and ✅ Solution in the 𝌡 Difference tab.

  4. If you have any questions just click Open Chat and ask in the chat 😊

Congratulations 🎉

You just completed Chapter 1. Tweet about it to share your amazing feat!

Tweet

** Template **

embedded-code

** Solution **

embedded-code-final

** Previous Chapter Solution **

embedded-code-previous