-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy path0x4a536c1ce7ad7f6e8d2e59135e17aef5ef4dd4e6-GEC-GECoin.sol
100 lines (83 loc) · 3.46 KB
/
0x4a536c1ce7ad7f6e8d2e59135e17aef5ef4dd4e6-GEC-GECoin.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
pragma solidity 0.4.15;
contract ERC20 {
function totalSupply() constant returns (uint256 totalSupply) {}
function balanceOf(address _owner) constant returns (uint256 balance) {}
function transfer(address _recipient, uint256 _value) returns (bool success) {}
function transferFrom(address _from, address _recipient, uint256 _value) returns (bool success) {}
function approve(address _spender, uint256 _value) returns (bool success) {}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
event Transfer(address indexed _from, address indexed _recipient, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract StandardToken is ERC20 {
uint256 public totalSupply;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
modifier when_can_transfer(address _from, uint256 _value) {
if (balances[_from] >= _value) _;
}
modifier when_can_receive(address _recipient, uint256 _value) {
if (balances[_recipient] + _value > balances[_recipient]) _;
}
modifier when_is_allowed(address _from, address _delegate, uint256 _value) {
if (allowed[_from][_delegate] >= _value) _;
}
function transfer(address _recipient, uint256 _value)
when_can_transfer(msg.sender, _value)
when_can_receive(_recipient, _value)
returns (bool o_success)
{
balances[msg.sender] -= _value;
balances[_recipient] += _value;
Transfer(msg.sender, _recipient, _value);
return true;
}
function transferFrom(address _from, address _recipient, uint256 _value)
when_can_transfer(_from, _value)
when_can_receive(_recipient, _value)
when_is_allowed(_from, msg.sender, _value)
returns (bool o_success)
{
allowed[_from][msg.sender] -= _value;
balances[_from] -= _value;
balances[_recipient] += _value;
Transfer(_from, _recipient, _value);
return true;
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) returns (bool o_success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 o_remaining) {
return allowed[_owner][_spender];
}
}
contract GECToken is StandardToken {
//FIELDS
string public name = "GECoin";
string public symbol = "GEC";
uint public decimals = 3;
// Initialization contract assigns address of crowdfund contract and end time.
function GECToken (address _bank, uint _totalSupply) {
balances[_bank] += _totalSupply;
totalSupply += _totalSupply;
}
// Transfer amount of tokens from sender account to recipient.
// Only callable after the crowd fund end date.
function transfer(address _recipient, uint _amount)
returns (bool o_success)
{
return super.transfer(_recipient, _amount);
}
// Transfer amount of tokens from a specified address to a recipient.
// Only callable after the crowd fund end date.
function transferFrom(address _from, address _recipient, uint _amount)
returns (bool o_success)
{
return super.transferFrom(_from, _recipient, _amount);
}
}