60 lines
1.6 KiB
Solidity
60 lines
1.6 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
|
|
pragma solidity 0.8.28;
|
|
|
|
contract Kanel42_token {
|
|
string public name = "Kanel42";
|
|
string public symbol = "KNL42";
|
|
uint8 public decimals = 6;
|
|
uint256 public totalSupply = 8000000000; // 8000
|
|
uint256 public totalMinted;
|
|
mapping(address => uint256) public balanceOf;
|
|
mapping(address => mapping(address => uint256)) public allowance;
|
|
|
|
function transfer(address _to, uint256 _value)
|
|
public
|
|
returns (bool success)
|
|
{
|
|
balanceOf[msg.sender] -= _value;
|
|
balanceOf[_to] += _value;
|
|
emit Transfer(msg.sender, _to, _value);
|
|
success = true;
|
|
}
|
|
|
|
function transferFrom(address _from, address _to, uint256 _value)
|
|
public
|
|
returns (bool success)
|
|
{
|
|
allowance[_from][msg.sender] -= _value;
|
|
balanceOf[_from] -= _value;
|
|
balanceOf[_to] += _value;
|
|
emit Transfer(_from, _to, _value);
|
|
success = true;
|
|
}
|
|
|
|
function approve(address _spender, uint256 _value)
|
|
public
|
|
returns (bool success)
|
|
{
|
|
allowance[msg.sender][_spender] = _value;
|
|
emit Approval(msg.sender, _spender, _value);
|
|
success = true;
|
|
}
|
|
|
|
function mint(uint256 _value) public {
|
|
if ((totalSupply / 16) <= _value) {
|
|
revert("can't mint more than 1/16 of the supply at a time");
|
|
}
|
|
|
|
balanceOf[msg.sender] += _value;
|
|
totalMinted += _value;
|
|
|
|
emit Transfer(address(0), msg.sender, _value);
|
|
}
|
|
|
|
event Transfer(address indexed _from, address indexed _to, uint256 _value);
|
|
event Approval(
|
|
address indexed _owner, address indexed _spender, uint256 _value
|
|
);
|
|
}
|