-
Notifications
You must be signed in to change notification settings - Fork 0
/
Coin_admin.sol
31 lines (26 loc) · 901 Bytes
/
Coin_admin.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
28
29
30
31
pragma solidity ^0.4.0;
contract Coin {
//0x0ef1ada008aeb134b13a8fa2953604b81433e1d0
// The keyword "public" makes those variables
// readable from outside.
address public minter;
mapping (address => uint) public balances;
// Events allow light clients to react on
// changes efficiently.
event Sent(address from, address to, uint amount);
// This is the constructor whose code is
// run only when the contract is created.
function Coin() {
minter = msg.sender;
}
function mint(address admin_minter, uint amount){
if (msg.sender != minter) return;
balances[admin_minter] += amount;
}
function send(address receiver, uint amount) {
if (balances[msg.sender] < amount) return;
balances[msg.sender] -= amount;
balances[receiver] += amount;
Sent(msg.sender, receiver, amount);
}
}