Difference between revisions of "Solidity ethereum Language"

From rbachwiki
Jump to navigation Jump to search
(Created page with "== Solidity Contract == pragma solidity ^0.4.0; contract HelloWorldContract{ string word = "Hello"; address public issuer; // constructor function Hello...")
 
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Solidity Contract ==
==[[Solidity Contracts]]==
 
==[[Setting Up Local Mining Environment]]==
pragma solidity ^0.4.0;
==[[Setting up Coding Environment]]==
 
==[[Setting up Truffle]]==
contract HelloWorldContract{
==[[Setting up Truffle to interact with Ganache]]==
    string word = "Hello";
==[[Building a Dapp Store]]==
    address public issuer;
==[[Solidity Terms]]==
    // constructor
    function HelloWorldContract(){
        issuer = msg.sender;
    }
   
    modifier ifIssuer(){
        if(issuer != msg.sender){
            throw;
        }
        else{
            _; // this means continue
        }
    }
   
    // creating a getter
    // the keyword constant is used to make it a getter without it the contract would
    // use gas and would be a setter
    function getWord() constant returns(string){
        return word;
    }
   
    // setter
    function setWord(string newWord) returns(string){
        word = newWord;
        return word;
    }
   
}

Latest revision as of 15:03, 21 March 2018