forked from ShowCoin/token-contract
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShowCoinTokenContract.sol
96 lines (88 loc) · 4.33 KB
/
ShowCoinTokenContract.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
pragma solidity ^0.4.11;
contract ShowCoinToken{
mapping (address => uint256) balances;
address public owner;
address public lockOwner;
string public name;
string public symbol;
uint8 public decimals;
uint256 public lockAmount ;
uint256 public startTime ;
// total amount of tokens
uint256 public totalSupply;
// `allowed` tracks any extra transfer rights as in all ERC20 tokens
mapping (address => mapping (address => uint256)) allowed;
function ShowCoinToken() public {
owner = 0xd32c3c303BD6bd65066C1373720b5442A414f9CC; // Set owner of contract
lockOwner = 0xC9BA6e5Eda033c66D34ab64d02d14590963Ce0c2;
startTime = 1514649600;
name = "ShowCoin"; // Set the name for display purposes
symbol = "Show"; // Set the symbol for display purposes
decimals = 18; // Amount of decimals for display purposes
totalSupply = 10000000000000000000000000000; // Total supply
balances[owner] = totalSupply * 90 /100 ;
lockAmount = totalSupply / 10 ;
}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) public returns (bool success) {
require(_value > 0 ); // Check send token value > 0;
require(balances[msg.sender] >= _value);
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(balances[_from] >= _value); // Check if the sender has enough
require(balances[_to] + _value >= balances[_to]); // Check for overflows
require(_value <= allowed[_from][msg.sender]); // Check allowance
balances[_from] -= _value;
balances[_to] += _value;
allowed[_from][_to] -= _value;
Transfer(_from, _to, _value);
return true;
}
/// @notice `msg.sender` approves `_spender` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of tokens to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/* This unnamed function is called whenever someone tries to send ether to it */
function () private {
revert(); // Prevents accidental sending of ether
}
function releaseToken() public{
require(now >= startTime +2 years);
uint256 i = ((now - startTime -2 years) / (0.5 years));
uint256 releasevalue = totalSupply /40 ;
require(lockAmount > (4 - i - 1) * releasevalue);
lockAmount -= releasevalue ;
balances[lockOwner] += releasevalue ;
}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}