-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathUnburnableToken.sol
More file actions
36 lines (28 loc) · 1007 Bytes
/
Copy pathUnburnableToken.sol
File metadata and controls
36 lines (28 loc) · 1007 Bytes
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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract UnburnableToken {
string private salt = "value";
mapping(address => uint256) public balances;
uint256 public totalSupply;
uint256 public totalClaimed;
mapping(address => bool) private claimed;
error TokensClaimed();
error AllTokensClaimed();
error UnsafeTransfer(address _to);
constructor() {
totalSupply = 100000000;
}
function claim() public {
if (totalClaimed >= totalSupply) revert AllTokensClaimed();
if (claimed[msg.sender]) revert TokensClaimed();
balances[msg.sender] += 1000;
totalClaimed += 1000;
claimed[msg.sender] = true;
}
function safeTransfer(address _to, uint256 _amount) public {
if (_to == address(0) || _to.balance == 0) revert UnsafeTransfer(_to);
require(balances[msg.sender] >= _amount, "Insufficient balance");
balances[msg.sender] -= _amount;
balances[_to] += _amount;
}
}