Last active
March 10, 2019 02:46
-
-
Save alexytiger/d7c74a2dc0da6ac8a89d0326da4e345b to your computer and use it in GitHub Desktop.
Blog = Eth + Angular + NgRx sol file
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.5.2; | |
contract PokemonAttack { | |
//this declares a state variable which means it belongs to the contract's state | |
//This will give us a way to store a string value to the blockchain inside the smart contract. | |
string attack; | |
constructor(string memory initialAttack) public { | |
attack = initialAttack; | |
} | |
// event | |
event attackChangedEvent ( | |
string _attack | |
); | |
//call function | |
function currentAttack() public view returns(string memory) { | |
return attack; | |
} | |
//transaction function | |
function changeAttack(string memory _attack) public returns (bool){ | |
attack = _attack; | |
emit attackChangedEvent(_attack); | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment