pragma solidity ^0.4.0; contract RyanCoin { address public creator; mapping (address => uint) public balances; /** * - msg is global attribute. * - This constructor is 'create' button */ function RyanCoin(){ creator = msg.sender; } /** * - creator use this function to give other people coins * - make sure it is the creator running this function */ function setCoin(address receiver, uint amount){ if(msg.sender != creator) throw; balances[receiver] += amount; } /** * - other participants use this function to transfer coins */ function transfer(address receiver, uint amount){ if(amount > balances[msg.sender]) throw; balances[msg.sender] -= amount; balances[receiver] += amount; } }
// temperature account where store money during transaction
contract Escrow { address public buyer; address public seller; address public arbiter; // settle any dispute function Escrow(address _buyer, address _seller, address _arbiter){ buyer = _buyer; seller = _seller; arbiter = _arbiter; } // we have different stages in this contract function confirmPayment() payable { require (msg.sender == buyer); } }