Basic Practice Reading Contracts
In this section, we will link to a couple of real, albeit simple smart contracts. See what you can understand from analyzing these contracts using the knowledge you have gained and try to understand what each function does.
SimpleStorage [exercise]
This simple contract stores a single integer in storage and then allows anyone to update the value of this integer.
Incrementor [exercise]
This example is similar to SimpleStorage, however, instead of being able to pass in any new value to update the stored integer, we can now only use the increment function (which takes no arguments) to increment the counter by 1 every time it is called.
Greeter [exercise]
This contract is also similar to SimpleStorage, however, this time instead of an integer being stored, we store and get a String.
Basic Iterator [exercise]
This contract simply instantiates an array upon construction and then calculates the sum every time the getSum function is called.
Creator Balance [exercise]
This contract begins to use some of the global variables we've learned about in order to retrieve and store the ether balance of the contract creator.
Global Variables Kitchen Sink [exercise]
This contract doesn't serve much real purpose, but rather shows many of the other global variables available and provides some details in the contract comments.