Skip to content

Instantly share code, notes, and snippets.

@alexytiger
Last active March 10, 2019 02:46
Show Gist options
  • Save alexytiger/d7c74a2dc0da6ac8a89d0326da4e345b to your computer and use it in GitHub Desktop.
Save alexytiger/d7c74a2dc0da6ac8a89d0326da4e345b to your computer and use it in GitHub Desktop.
Blog = Eth + Angular + NgRx sol file
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