-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathBlockToken.sol
More file actions
51 lines (39 loc) · 1.77 KB
/
Copy pathBlockToken.sol
File metadata and controls
51 lines (39 loc) · 1.77 KB
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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract BlockToken is ERC20{
address public owner;
modifier onlyOwner {
require(msg.sender == owner, "BlockToken:: Unauthorized User");
_;
}
modifier notAmount0(uint256 _amount){
require(_amount != 0, "BlockToken:: Zero amount not supported");
_;
}
constructor(string memory _name, string memory _symbol, address _owner) ERC20(_name, _symbol){
require(_owner != address(0), "BlockToken:: Zero address not supported");
owner = _owner;
}
function mint(uint256 _amount, address _recepient) onlyOwner notAmount0(_amount) external {
_mint(_recepient, _amount);
}
function burn(uint256 _amount) notAmount0(_amount) external {
_burn(msg.sender, _amount);
}
function burnFrom(address _user, uint256 _amount)onlyOwner notAmount0(_amount) external {
_burn(_user, _amount);
}
function transfer(address _owner, uint256 _amount) public notAmount0(_amount) override returns (bool){
require(_owner != address(0), "BlockToken:: Zero address not supported");
_transfer(msg.sender, _owner, _amount);
}
// function transferFrom(address _owner, address _recepient, uint256 _amount) public notAmount0(_amount) override returns (bool){
// require(_recepient != address(0), "BlockToken:: Zero address not supported");
// _transfer(_owner, _recepient, _amount);
// uint256 currentAllowance = allowance(_owner, msg.sender);
// require(currentAllowance >= _amount, "BlockToken:: Transfer amount exceeds allowance");
// _approve(_owner, msg.sender, currentAllowance - _amount);
// return true;
// }
}