This repository has been archived by the owner on Apr 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LNKSToken.sol
105 lines (76 loc) · 3.03 KB
/
LNKSToken.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
pragma solidity ^0.4.8;
/// @title LNKS Token. This Token will remain the cornerstone of the entire organization. It will have an Ethereum address and from the moment that address is publish until the end, it will remain the same, and should. The Token should be as simple as it possibly can be and should not be able to terminate. It's state remains so that those who control their Tokens will continue to do so.
/// @author Karolis Ramanauskas <hello@karolisram.com>
import "./SafeMath.sol";
import "./OwnableMultiple.sol";
import "./ERC20.sol";
import './LNKSExchange.sol';
/*
* Basic token
* Basic version of StandardToken, with no allowances
*/
contract StandardToken is ERC20 {
using SafeMath for uint;
mapping(address => uint) balances;
mapping (address => mapping (address => uint)) allowed;
uint256 supply = 0;
// Get the total token supply in circulation
function totalSupply() public constant returns (uint) {
return supply;
}
/*
* Fix for the ERC20 short address attack
*/
modifier onlyPayloadSize(uint size) {
require(msg.data.length < size + 4);
_;
}
function balanceOf(address _owner) public constant returns (uint balance) {
return balances[_owner];
}
function transfer(address _to, uint _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint _value) public returns (bool success) {
var allowance = allowed[_from][msg.sender];
require(balances[_from] >= _value && allowance >= _value);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function approveFrom(address _owner, address _spender, uint _value) public returns (bool success) {
allowed[_owner][_spender] = _value;
Approval(_owner, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
return allowed[_owner][_spender];
}
}
contract LNKSToken is StandardToken, OwnableMultiple {
string public constant NAME = "Link Platform";
string public constant SYMBOL = "LNKS";
uint public constant DECIMALS = 3;
function mint(address _spender, uint _value) public onlyOwner {
balances[_spender] += _value;
supply += _value;
}
function destroyTokens(uint _value) external {
require(balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.sender].sub(_value);
supply = supply.sub(_value);
DestroyTokensEvent(msg.sender, _value);
}
event DestroyTokensEvent(address indexed _from, uint _value);
}