Guest User

Untitled

a guest
Nov 1st, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. pragma solidity ^0.4.11;
  2.  
  3. contract HelloWorldContract {
  4. string word = "Hello World";
  5. address issuer;
  6.  
  7. //constructor
  8. function HelloWorldContract() {
  9. issuer = msg.sender;
  10. }
  11.  
  12. //modifier is like function, it will call before executing function.
  13. modifier ifIssuer() {
  14. //msg.sender is the
  15. if(issuer != msg.sender) {
  16. throw; //Throw exception error
  17. }
  18. else {
  19. _; //continue
  20. }
  21. }
  22. //getter function, only thing to note down is 'constant'
  23. function getWord() constant returns (string) {
  24. return word;
  25. }
  26. //setter function with 'ifIssuer' as modifier
  27. function setWord(string newWord) ifIssuer returns (string) {
  28. word = newWord;
  29. return "This is the creator";
  30. }
  31.  
  32. }
Add Comment
Please, Sign In to add comment