This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// declare the event | |
event IntegersAdded(uint x, uint y, uint result); | |
function add(uint _x, uint _y) public { | |
uint result = _x + _y; | |
// fire an event to let the app know the function was called: | |
emit IntegersAdded(_x, _y, result); | |
return result; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragama ^0.4.25; | |
contract ZombieFactory{ | |
uint dnaDigits = 16; // set zombie DNA | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.25; | |
contract ZombieFactory { | |
uint dnaDigits = 16; | |
uint dnaModulus = 10 ** dnaDigits; | |
struct Zombie { | |
string name; | |
uint dna; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.25; | |
contract ZombieFactory { | |
uint dnaDigits = 16; | |
uint dnaModulus = 10 ** dnaDigits; | |
struct Zombie { | |
string name; | |
uint dna; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
people.push(Person(16, "Vitalik")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.25; | |
contract ZombieFactory { | |
uint dnaDigits = 16; | |
uint dnaModulus = 10 ** dnaDigits; | |
struct Zombie { | |
string name; | |
uint dna; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sayHello() public view returns (string) { | |
function _multiply(uint a, uint b) private pure returns (uint) { | |
return a * b; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Person { | |
uint age; | |
string name; | |
} | |
Person[] public people; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint x = 5 ** 2; // equal to 5^2 = 25 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function eatHamburgers(string _name, uint _amount) { | |
} |