-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnburnableToken.sol
More file actions
41 lines (33 loc) · 1.17 KB
/
UnburnableToken.sol
File metadata and controls
41 lines (33 loc) · 1.17 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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
contract UnburnableToken {
mapping (address => uint) public balances;
mapping (address => bool) public hasClaimed;
uint public totalSupply;
uint public totalClaimed;
uint private claimAmount = 1000;
error TokensClaimed();
error UnsafeTransfer(address);
constructor(){
totalSupply = 100_000_000;
}
function claim() public {
if(hasClaimed[msg.sender]) {
revert TokensClaimed();
}
require(totalClaimed <= totalSupply, "no more tokens left");
balances[msg.sender]+= claimAmount;
hasClaimed[msg.sender] = true;
totalClaimed+= claimAmount;
}
function safeTransfer(address _to, uint _amount) public{
if(_to==0x0000000000000000000000000000000000000000){
revert UnsafeTransfer(_to);
}
if(_to.balance == 0){
revert UnsafeTransfer(_to);
}
balances[msg.sender]-=_amount;
balances[_to]+=_amount;
}
}