A tutorial contract testing struct definitions and for loops in early Solidity.
Key Facts
Description
A tutorial contract from Cyrus Adkisson's solidity-baby-steps series (contract #65) testing struct definitions and for loop iteration. Combines structs with array storage and iterates over them, testing the interaction between these language features.
Deployed on September 13, 2015. Part of a numbered tutorial progression that systematically explored Solidity language features on mainnet.
Source Verified
Exact creation bytecode match. Author Cyrus Adkisson published source at https://github.com/cyrusadkisson/solidity-baby-steps/blob/master/contracts/65_struct_and_for_loop_tester.sol. Batch-matched against 357 deploy TXs from deployer 0xcf684dfb8304729355b58315e8019b1aa2ad1bac.
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
Frontier Era
The initial release of Ethereum. A bare-bones implementation for technical users.
Bytecode Overview
Verified Source Available
Source verified through compiler archaeology and exact bytecode matching.
View Verification ProofShow source code (Solidity)
// This contract creates a 9x9 map of Tile objects.
// Each tile has an elevation value (as well as an owner and descriptorContract which aren't used here)
//
// In the constructor, the elevations are set to standard values via for loops.
contract StructAndFor {
address creator;
uint8 mapsize = 9;
Tile[9][9] tiles;
struct Tile
{
address owner;
address descriptorContract;
uint8 elevation;
}
function StructAndFor()
{
creator = msg.sender;
for(uint8 y = 0; y < mapsize; y++)
{
for(uint8 x = 0; x < mapsize; x++)
{
tiles[x][y].elevation = mapsize*y + x; // row 0: 0, 1, 2, 3, 4... row 1: 9, 10, 11, 12
}
}
}
function getElevation(uint8 x, uint8 y) constant returns (uint8)
{
return tiles[x][y].elevation;
}
/**********
Standard kill() function to recover funds
**********/
function kill()
{
if (msg.sender == creator)
{
suicide(creator); // kills this contract and sends remaining funds back to creator
}
}
}