Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity ^0.4.11;
- contract HelloWorldContract {
- string word = "Hello World";
- address issuer;
- //constructor
- function HelloWorldContract() {
- issuer = msg.sender;
- }
- //modifier is like function, it will call before executing function.
- modifier ifIssuer() {
- //msg.sender is the
- if(issuer != msg.sender) {
- throw; //Throw exception error
- }
- else {
- _; //continue
- }
- }
- //getter function, only thing to note down is 'constant'
- function getWord() constant returns (string) {
- return word;
- }
- //setter function with 'ifIssuer' as modifier
- function setWord(string newWord) ifIssuer returns (string) {
- word = newWord;
- return "This is the creator";
- }
- }
Add Comment
Please, Sign In to add comment