/
WaxToken.sol
94 lines (81 loc) · 3.16 KB
/
WaxToken.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
pragma solidity ^0.4.13;
import "zeppelin-solidity/contracts/token/StandardToken.sol";
import "zeppelin-solidity/contracts/lifecycle/Pausable.sol";
/**
* @title WaxToken
* @dev ERC20 Wax Token (WAX)
*
* WAX Tokens are divisible by 1e8 (100,000,000) base
* units referred to as 'Grains'.
*
* WAX are displayed using 8 decimal places of precision.
*
* 1 WAX is equivalent to:
* 100000000 == 1 * 10**8 == 1e8 == One Hundred Million Grains
*
* 1 Billion WAX (total supply) is equivalent to:
* 100000000000000000 == 1000000000 * 10**8 == 1e17 == One Hundred Quadrillion Grains
*
* All initial WAX Grains are assigned to the creator of
* this contract.
*
*/
contract WaxToken is StandardToken, Pausable {
string public constant name = 'Wax Token'; // Set the token name for display
string public constant symbol = 'WAX'; // Set the token symbol for display
uint8 public constant decimals = 8; // Set the number of decimals for display
uint256 public constant INITIAL_SUPPLY = 1000000000 * 10**uint256(decimals); // 1 Billion VEE specified in Grains
/**
* @dev WaxToken Constructor
* Runs only on initial contract creation.
*/
function WaxToken() {
totalSupply = INITIAL_SUPPLY; // Set the total supply
balances[msg.sender] = INITIAL_SUPPLY; // Creator address is assigned all
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
/**
* @dev Transfer token for a specified address when not paused
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) whenNotPaused returns (bool) {
require(_to != address(0));
require(_to != address(this));
return super.transfer(_to, _value);
}
/**
* @dev Transfer tokens from one address to another when not paused
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) whenNotPaused returns (bool) {
require(_to != address(0));
require(_to != address(this));
return super.transferFrom(_from, _to, _value);
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender when not paused.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function() payable {
revert();
}
/**
* Adding whenNotPaused
*/
function increaseApproval (address _spender, uint _addedValue) whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
/**
* Adding whenNotPaused
*/
function decreaseApproval (address _spender, uint _subtractedValue) whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}