-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBAGGIDetailed.sol
149 lines (132 loc) · 3.88 KB
/
BAGGIDetailed.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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
pragma solidity ^0.4.23;
import "./BAGGI.sol";
/**
* @title BAGGIDetailed token
* @dev The decimals are only for visualization purposes.
* All the operations are done using the smallest and indivisible token unit,
* just as on TRON all the operations are done in sun.
*
* Example inherits from basic BAGGI implementation but can be modified to
* extend from other ITRC20-based tokens:
* https://github.com/OpenZeppelin/openzeppelin-solidity/issues/1536
*/
contract BAGGIDetailed is BAGGI {
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _multipleForGift;
address private owner;
constructor (string name, string symbol, uint8 decimals, uint256 amountToCreate) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
_mint(msg.sender,1000000 * amountToCreate);
_multipleForGift = 1000;
owner = msg.sender;
}
modifier onlyOwner() {
if (msg.sender == owner) _;
}
/**
* @return the name of the token.
*/
function name() public view returns (string) {
return _name;
}
/**
* Set the name of the token.
*/
function setName(string newNam) public onlyOwner returns (bool) {
_name = newNam;
return true;
}
/**
* Set the owner of the token.
*/
function setOwner(address newOwn) public onlyOwner returns (bool) {
owner = newOwn;
return true;
}
/**
* Set the token multiplicator for gift in freeze amount.
*/
function setMultiple(uint256 newMul) public onlyOwner returns (bool) {
_multipleForGift = newMul;
return true;
}
/**
* Set the token multiplicator for gift in freeze amount.
*/
function sendGiftToFreezed(uint256 value) public onlyOwner view returns (uint256) {
return _sendGift(value, _multipleForGift);
}
/**
* @dev Burns a specific amount of tokens.
* @param value The amount of token to be burned.
*/
function burn(uint256 value) public returns (bool) {
_burn(msg.sender, value);
return true;
}
/**
* @dev Get the acounts with freezed tokens.
*/
function getFreezeAccounts() public view returns (address[]) {
return _getFreezeAccounts();
}
/**
* @dev Freeze a specific amount of tokens.
* @param value The amount of token to be freezed.
*/
function freeze(uint256 value) public returns (bool) {
_freeze(msg.sender, value);
return true;
}
/**
* @dev Unfreeze a specific amount of tokens.
* @param value The amount of token to be unfreezed.
*/
function unfreeze(uint256 value) public returns (bool) {
_unfreeze(msg.sender, value);
return true;
}
/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param from address The address which you want to send tokens from
* @param value uint256 The amount of token to be burned
*/
function burnFrom(address from, uint256 value) public returns (bool) {
if(msg.sender == owner){
_burn(from, value);
}else{
_burnFrom(from, value);
}
return true;
}
/**
* Mint new tokens to address.
*/
function mint(address to, uint256 value) public onlyOwner returns (bool) {
_mint(to, value);
return true;
}
/**
* @return the symbol of the token.
*/
function symbol() public view returns (string) {
return _symbol;
}
/**
* Set the symbol of the token.
*/
function setSymbol(string newSym) public onlyOwner returns (bool) {
_symbol = newSym;
return true;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view returns (uint8) {
return _decimals;
}
}