@@ -10,9 +10,9 @@ import "openzeppelin-solidity/contracts/math/SafeMath.sol";
10
10
contract PolyTokenFaucet {
11
11
12
12
using SafeMath for uint256 ;
13
- uint256 totalSupply_ = 1000000 ;
13
+ uint256 totalSupply_;
14
14
string public name = "Polymath Network " ;
15
- uint8 public decimals = 18 ;
15
+ uint8 public decimals;
16
16
string public symbol = "POLY " ;
17
17
18
18
mapping (address => uint256 ) balances;
@@ -21,10 +21,19 @@ contract PolyTokenFaucet {
21
21
event Transfer (address indexed _from , address indexed _to , uint256 _value );
22
22
event Approval (address indexed _owner , address indexed _spender , uint256 _value );
23
23
24
+ constructor () public {
25
+ decimals = 18 ;
26
+ totalSupply_ = 1000000 * uint256 (10 )** decimals;
27
+ balances[msg .sender ] = totalSupply_;
28
+ emit Transfer (address (0 ), msg .sender , totalSupply_);
29
+ }
30
+
24
31
/* Token faucet - Not part of the ERC20 standard */
25
32
function getTokens (uint256 _amount , address _recipient ) public returns (bool ) {
26
- balances[_recipient] += _amount;
27
- totalSupply_ += _amount;
33
+ require (_amount <= 1000000 * uint256 (10 )** decimals, "Amount can not be more than 1 million " );
34
+ require (_recipient != address (0 ), "Recipient address can not be empty " );
35
+ balances[_recipient] = balances[_recipient].add (_amount);
36
+ totalSupply_ = totalSupply_.add (_amount);
28
37
emit Transfer (address (0 ), _recipient, _amount);
29
38
return true ;
30
39
}
0 commit comments