-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAnimeyen Coin
132 lines (109 loc) · 3.63 KB
/
Animeyen Coin
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
pragma solidity ^0.4.11;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Interface
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Interface {
uint256 public totalSupply;
function balanceOf(address who) constant public returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Erc20token
* @dev Basic version of token, with no allowances.
*/
contract ERC20Token is ERC20Interface
{
using SafeMath for uint256;
mapping(address => uint256) tokenBalances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(tokenBalances[msg.sender]>=_value);
tokenBalances[msg.sender] = tokenBalances[msg.sender].sub(_value);
tokenBalances[_to] = tokenBalances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) constant public returns (uint256 balance) {
return tokenBalances[_owner];
}
}
contract Animeyen is ERC20Token,Ownable {
using SafeMath for uint256;
string public constant name = "AnimeYen";
string public constant symbol = "ANIME";
uint256 public constant decimals = 18;
uint256 public constant UPPER_CAP = 1000000000;
/**
* @dev Contructor that gives msg.sender all of existing tokens.
*/
//TODO: Change the name of the constructor
function Animeyen() public {
owner = 0x5B9f8701328C8A06Ecb117aa41C657Aa7a928d7a; //this is the owner address
totalSupply = UPPER_CAP;
tokenBalances[owner] = UPPER_CAP * (10 ** uint256(decimals)); //Since we divided the token into 10^18 parts
}
function getTokenBalance() public view returns (uint256 balance) {
balance = tokenBalances[msg.sender]; // show token balance in full tokens not part
}
}