-
Notifications
You must be signed in to change notification settings - Fork 18
/
ERC20Mock.sol
51 lines (32 loc) · 1.03 KB
/
ERC20Mock.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
pragma solidity >=0.6.0;
import "../../../contracts/utils/ERC20.sol";
import "../../../contracts/utils/SafeMath.sol";
contract ERC20Mock is ERC20 {
using SafeMath for uint;
string private constant _name = "ERC20Mock";
string private constant _symbol = "MOCK";
uint8 private _decimals;
constructor(uint8 decimals) ERC20(_name) public {
_decimals = decimals;
}
function name() override external view returns (string memory) {
return _name;
}
function symbol() override external view returns (string memory) {
return _symbol;
}
function decimals() override external view returns (uint8) {
return _decimals;
}
function reset() external {
_totalSupply = 0;
}
function reset(address addr) external {
removeBalance(addr, balanceOf(addr));
}
function issue(address to, uint value) external {
addBalance(to, value);
_totalSupply = _totalSupply.add(value);
emitTransfer(address(0), to, value);
}
}