-
Notifications
You must be signed in to change notification settings - Fork 0
/
CyberCoin.sol
27 lines (23 loc) · 855 Bytes
/
CyberCoin.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
solidity ^0.4.9;
contract CyberCoin {
//Creating a map where the key is address and the value is a number.
//Since this is public it will be visible to everyone.
//The mapping is created into the contract storage.
mapping (address => uint256) public balanceOf;
//Constructor
function CyberCoin(){
balanceOf[msg.sender] = 10000;
}
//Creating a method that will be used to send amount
//from one account to another;
function sendTo(address receiver, uint amount) returns(bool hasSufficient) {
if(balanceOf[msg.sender] < amount ) return false;
balanceOf[msg.sender] -= amount;
balanceOf[receiver] += amount;
return true;
}
//Just displays current sender's address
function sender() returns(address senderAddress){
return msg.sender;
}
}