Structure of a Contract¶
Contracts in Viper are contained within files, with each file being one smart-contract. Files in Viper are similar to classes in object-oriented languages. Each file can contain declarations of State Variables, Functions, and structure-structs-types.
State Variables¶
State variables are values which are permanently stored in contract storage.
storedData: num
See the Types section for valid state variable types and visibility-and-getters for possible choices for visibility.
Functions¶
Functions are the executable units of code within a contract.
@payable
function bid(): // Function
// ...
}
function-calls can happen internally or externally and have different levels of visibility (visibility-and-getters) towards other contracts.