-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathNEC.sol
60 lines (46 loc) · 1.64 KB
/
NEC.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
pragma solidity ^0.4.18;
import "./MiniMeToken.sol";
/*
Copyright 2017, Will Harborne (Ethfinex)
*/
contract NEC is MiniMeToken {
function NEC(
address _tokenFactory,
address efxVaultWallet
) public MiniMeToken(
_tokenFactory,
0x0, // no parent token
0, // no snapshot block number from parent
"Ethfinex Nectar Token", // Token name
18, // Decimals
"NEC", // Symbol
true // Enable transfers
) {
generateTokens(efxVaultWallet, 1000000000000000000000000000);
enableBurning(false);
}
// Flag that determines if the token can be burned for rewards or not
bool public burningEnabled;
////////////////
// Enable token burning by users
////////////////
function enableBurning(bool _burningEnabled) public onlyController {
burningEnabled = _burningEnabled;
}
function burnAndRetrieve(uint256 _tokensToBurn) public returns (bool success) {
require(burningEnabled);
var previousBalanceFrom = balanceOfAt(msg.sender, block.number);
if (previousBalanceFrom < _tokensToBurn) {
return false;
}
// Alerts the token controller of the burn function call
// If enabled, controller will distribute fees and destroy tokens
// Or any other logic chosen by controller
if (isContract(controller)) {
require(TokenController(controller).onBurn(msg.sender, _tokensToBurn));
}
Burned(msg.sender, _tokensToBurn);
return true;
}
event Burned(address indexed who, uint256 _amount);
}