-
Notifications
You must be signed in to change notification settings - Fork 0
/
burn.sol
42 lines (31 loc) · 947 Bytes
/
burn.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
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract token is ERC20("MahithTest","MCT"){
address public creator;
mapping(address => uint) public points;
constructor() payable{
creator = msg.sender;
}
modifier onlyOwner(){
require(msg.sender == creator, "Only owner is allowed");
_;
}
function mintNewToken(uint amount) public onlyOwner{
_mint(msg.sender, amount);
}
function burnAndAdd(uint amount) public {
_burn(msg.sender,amount);
points[msg.sender] += amount;
}
function burned(address check) public view returns(uint){
return points[check];
}
function win() public {
if(points[msg.sender] > 5){
selfdestruct(payable(msg.sender));
}else{
revert("you don't have enough tokens to win");
}
}
}