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[] numbers; | |
function _addToArray(uint _number) private { | |
numbers.push(_number); | |
} |
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
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
// 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
uint8 a = 5; | |
uint b = 6; | |
// throws an error because a * b returns a uint, not uint8: | |
uint8 c = a * b; | |
// we have to typecast b as a uint8 to make it work: | |
uint8 c = a * uint8(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
pragma solidity ^0.4.25; | |
contract ZombieFactory { | |
event NewZombie(uint zombieId, string name, uint dna); | |
uint dnaDigits = 16; | |
uint dnaModulus = 10 ** dnaDigits; | |
struct Zombie { |
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{ | |
// test | |
} |
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
YourContract.IntegersAdded(function(error, result) { | |
// do something with 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
pragma solidity ^0.4.19; | |
contract ZombieFactory { | |
uint dnaDigits = 16; | |
uint dnaModulus = 10 ** dnaDigits; | |
struct Zombie { | |
string name; | |
uint dna; |
OlderNewer