-
Notifications
You must be signed in to change notification settings - Fork 1
/
JincorToken.sol
executable file
·99 lines (79 loc) · 2.94 KB
/
JincorToken.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
pragma solidity ^0.4.11;
import "./Burnable.sol";
import "zeppelin-solidity/contracts/ownership/Ownable.sol";
/**
* @title JincorToken
*
* @dev Burnable Ownable ERC20 token
*/
contract JincorToken is Burnable, Ownable {
string public constant name = "Jincor Token";
string public constant symbol = "JCR";
uint8 public constant decimals = 18;
uint public constant INITIAL_SUPPLY = 35000000 * 1 ether;
/* The finalizer contract that allows unlift the transfer limits on this token */
address public releaseAgent;
/** A crowdsale contract can release us to the wild if ICO success. If false we are are in transfer lock up period.*/
bool public released = false;
/** Map of agents that are allowed to transfer tokens regardless of the lock down period. These are crowdsale contracts and possible the team multisig itself. */
mapping (address => bool) public transferAgents;
/**
* Limit token transfer until the crowdsale is over.
*
*/
modifier canTransfer(address _sender) {
require(released || transferAgents[_sender]);
_;
}
/** The function can be called only before or after the tokens have been releasesd */
modifier inReleaseState(bool releaseState) {
require(releaseState == released);
_;
}
/** The function can be called only by a whitelisted release agent. */
modifier onlyReleaseAgent() {
require(msg.sender == releaseAgent);
_;
}
/**
* @dev Contructor that gives msg.sender all of existing tokens.
*/
function JincorToken() {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
/**
* Set the contract that can call release and make the token transferable.
*
* Design choice. Allow reset the release agent to fix fat finger mistakes.
*/
function setReleaseAgent(address addr) onlyOwner inReleaseState(false) public {
require(addr != 0x0);
// We don't do interface check here as we might want to a normal wallet address to act as a release agent
releaseAgent = addr;
}
function release() onlyReleaseAgent inReleaseState(false) public {
released = true;
}
/**
* Owner can allow a particular address (a crowdsale contract) to transfer tokens despite the lock up period.
*/
function setTransferAgent(address addr, bool state) onlyOwner inReleaseState(false) public {
require(addr != 0x0);
transferAgents[addr] = state;
}
function transfer(address _to, uint _value) canTransfer(msg.sender) returns (bool success) {
// Call Burnable.transfer()
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint _value) canTransfer(_from) returns (bool success) {
// Call Burnable.transferForm()
return super.transferFrom(_from, _to, _value);
}
function burn(uint _value) onlyOwner returns (bool success) {
return super.burn(_value);
}
function burnFrom(address _from, uint _value) onlyOwner returns (bool success) {
return super.burnFrom(_from, _value);
}
}