-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy path0x8bbf4dd0f11b3a535660fd7fcb7158daebd3a17e-EGAS-ETHGAS.sol
231 lines (196 loc) · 6.1 KB
/
0x8bbf4dd0f11b3a535660fd7fcb7158daebd3a17e-EGAS-ETHGAS.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
/**
* @First Smart Airdrop eGAS
* @http://ethgas.stream
*/
pragma solidity ^0.4.16;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Owned {
// The address of the account of the current owner
address public owner;
// The publiser is the inital owner
function Owned() public {
owner = msg.sender;
}
/**
* Access is restricted to the current owner
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* Transfer ownership to `_newOwner`
*
* @param _newOwner The address of the account that will become the new owner
*/
function transferOwnership(address _newOwner) public onlyOwner {
owner = _newOwner;
}
}
contract EGAS is Owned {
using SafeMath for uint256;
string public symbol = "EGAS";
string public name = "ETHGAS";
uint8 public constant decimals = 8;
uint256 _initialSupply = 100000000000000;
uint256 _totalSupply = 0;
uint256 _maxTotalSupply = 1279200000000000;
uint256 _dropReward = 26000000000; //260 eGAS - per entry with 30% bonus to start
uint256 _maxDropReward = 1300000000000; //13000 eGAS - per block 10min with 30% bonus to start - 50 entry max
uint256 _rewardBonusTimePeriod = 86400; //1 day each bonus stage
uint256 _nextRewardBonus = now + _rewardBonusTimePeriod;
uint256 _rewardTimePeriod = 600; //10 minutes
uint256 _rewardStart = now;
uint256 _rewardEnd = now + _rewardTimePeriod;
uint256 _currentAirdropped = 0;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
mapping(address => uint256) balances;
mapping(address => mapping (address => uint256)) allowed;
function OwnerReward() public {
balances[owner] = _initialSupply;
transfer(owner, balances[owner]);
}
function withdraw() public onlyOwner {
owner.transfer(this.balance);
}
function totalSupply() constant returns (uint256) {
return _totalSupply + _initialSupply;
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function transfer(address _to, uint256 _amount) returns (bool success) {
if (balances[msg.sender] >= _amount
&& _amount > 0
&& balances[_to] + _amount > balances[_to]) {
balances[msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(msg.sender, _to, _amount);
return true;
} else {
return false;
}
}
function transferFrom(
address _from,
address _to,
uint256 _amount
) returns (bool success) {
if (balances[_from] >= _amount
&& allowed[_from][msg.sender] >= _amount
&& _amount > 0
&& balances[_to] + _amount > balances[_to]) {
balances[_from] -= _amount;
allowed[_from][msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(_from, _to, _amount);
return true;
} else {
return false;
}
}
function approve(address _spender, uint256 _amount) returns (bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
function SmartAirdrop() payable returns (bool success)
{
if (now < _rewardEnd && _currentAirdropped >= _maxDropReward)
revert();
else if (now >= _rewardEnd)
{
_rewardStart = now;
_rewardEnd = now + _rewardTimePeriod;
_currentAirdropped = 0;
}
if (now >= _nextRewardBonus)
{
_nextRewardBonus = now + _rewardBonusTimePeriod;
_dropReward = _dropReward - 1000000000;
_maxDropReward = _maxDropReward - 50000000000;
_currentAirdropped = 0;
_rewardStart = now;
_rewardEnd = now + _rewardTimePeriod;
}
if ((_currentAirdropped < _maxDropReward) && (_totalSupply < _maxTotalSupply))
{
balances[msg.sender] += _dropReward;
_currentAirdropped += _dropReward;
_totalSupply += _dropReward;
Transfer(this, msg.sender, _dropReward);
return true;
}
return false;
}
function MaxTotalSupply() constant returns(uint256)
{
return _maxTotalSupply;
}
function DropReward() constant returns(uint256)
{
return _dropReward;
}
function MaxDropReward() constant returns(uint256)
{
return _maxDropReward;
}
function RewardBonusTimePeriod() constant returns(uint256)
{
return _rewardBonusTimePeriod;
}
function NextRewardBonus() constant returns(uint256)
{
return _nextRewardBonus;
}
function RewardTimePeriod() constant returns(uint256)
{
return _rewardTimePeriod;
}
function RewardStart() constant returns(uint256)
{
return _rewardStart;
}
function RewardEnd() constant returns(uint256)
{
return _rewardEnd;
}
function CurrentAirdropped() constant returns(uint256)
{
return _currentAirdropped;
}
function TimeNow() constant returns(uint256)
{
return now;
}
}