-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmTBILL.sol
103 lines (92 loc) · 2.32 KB
/
mTBILL.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
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PausableUpgradeable.sol";
import "./interfaces/IMTbill.sol";
import "./access/Blacklistable.sol";
/**
* @title mTBILL
* @author RedDuck Software
*/
//solhint-disable contract-name-camelcase
contract mTBILL is ERC20PausableUpgradeable, Blacklistable, IMTbill {
/**
* @notice metadata key => metadata value
*/
mapping(bytes32 => bytes) public metadata;
/**
* @dev leaving a storage gap for futures updates
*/
uint256[50] private __gap;
/**
* @notice upgradeable pattern contract`s initializer
* @param _accessControl address of MidasAccessControll contract
*/
function initialize(address _accessControl) external initializer {
__Blacklistable_init(_accessControl);
__ERC20_init("mTBILL", "mTBILL");
}
/**
* @inheritdoc IMTbill
*/
function mint(address to, uint256 amount)
external
onlyRole(M_TBILL_MINT_OPERATOR_ROLE, msg.sender)
{
_mint(to, amount);
}
/**
* @inheritdoc IMTbill
*/
function burn(address from, uint256 amount)
external
onlyRole(M_TBILL_BURN_OPERATOR_ROLE, msg.sender)
{
_burn(from, amount);
}
/**
* @inheritdoc IMTbill
*/
function pause()
external
override
onlyRole(M_TBILL_PAUSE_OPERATOR_ROLE, msg.sender)
{
_pause();
}
/**
* @inheritdoc IMTbill
*/
function unpause()
external
override
onlyRole(M_TBILL_PAUSE_OPERATOR_ROLE, msg.sender)
{
_unpause();
}
/**
* @inheritdoc IMTbill
*/
function setMetadata(bytes32 key, bytes memory data)
external
onlyRole(DEFAULT_ADMIN_ROLE, msg.sender)
{
metadata[key] = data;
}
/**
* @dev overrides _beforeTokenTransfer function to ban
* blaclisted users from using the token functions
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
)
internal
virtual
override(ERC20PausableUpgradeable)
onlyNotBlacklisted(from)
onlyNotBlacklisted(to)
{
ERC20PausableUpgradeable._beforeTokenTransfer(from, to, amount);
}
}