Add proper Token contract

This commit is contained in:
2018-03-15 08:55:17 +01:00
parent 68fb8b2bee
commit f0211ff4c1
10 changed files with 130 additions and 52 deletions

33
contracts/Token.sol Normal file
View File

@@ -0,0 +1,33 @@
pragma solidity ^0.4.18;
import 'zeppelin-solidity/contracts/token/ERC20/BasicToken.sol';
import './upgradeable/Upgradeable.sol';
contract Token is Upgradeable, BasicToken {
string public name;
string public symbol;
uint8 public decimals;
event LogMint(address indexed recipient, uint256 amount, string reference);
modifier requireRegistry() {
require(address(registry) != 0x0);
_;
}
function initialize(address sender) public payable {
require(msg.sender == address(registry));
name = 'Kredits';
symbol = 'K';
decimals = 18;
}
function mintFor(address _recipient, uint256 _amount, string _reference) requireRegistry returns (bool success) {
totalSupply_ = totalSupply_.add(_amount);
balances[_recipient] = balances[_recipient].add(_amount);
LogMint(_recipient, _amount, _reference);
return true;
}
}