Upload BASE.sol
Browse files
BASE.sol
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
// SPDX-License-Identifier: MIT
|
| 3 |
+
pragma solidity ^0.8.0;
|
| 4 |
+
|
| 5 |
+
contract MztacatCommunity {
|
| 6 |
+
string public name = "MztacatCommunity";
|
| 7 |
+
string public symbol = "MZT";
|
| 8 |
+
uint8 public decimals = 18;
|
| 9 |
+
uint256 public totalSupply = 1000000 * (10 ** uint256(decimals));
|
| 10 |
+
address public owner;
|
| 11 |
+
|
| 12 |
+
mapping(address => uint256) balances;
|
| 13 |
+
mapping(address => mapping(address => uint256)) allowances;
|
| 14 |
+
|
| 15 |
+
event Transfer(address indexed from, address indexed to, uint256 value);
|
| 16 |
+
event Approval(address indexed owner, address indexed spender, uint256 value);
|
| 17 |
+
|
| 18 |
+
constructor() {
|
| 19 |
+
owner = msg.sender;
|
| 20 |
+
balances[owner] = totalSupply;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
modifier onlyOwner() {
|
| 24 |
+
require(msg.sender == owner, "Only the owner can call this function.");
|
| 25 |
+
_;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
function balanceOf(address account) public view returns (uint256) {
|
| 29 |
+
return balances[account];
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
function transfer(address recipient, uint256 amount) public returns (bool) {
|
| 33 |
+
require(recipient != address(0), "ERC20: transfer to the zero address");
|
| 34 |
+
require(amount <= balances[msg.sender], "ERC20: transfer amount exceeds balance");
|
| 35 |
+
|
| 36 |
+
balances[msg.sender] -= amount;
|
| 37 |
+
balances[recipient] += amount;
|
| 38 |
+
|
| 39 |
+
emit Transfer(msg.sender, recipient, amount);
|
| 40 |
+
|
| 41 |
+
return true;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
function approve(address spender, uint256 amount) public returns (bool) {
|
| 45 |
+
allowances[msg.sender][spender] = amount;
|
| 46 |
+
|
| 47 |
+
emit Approval(msg.sender, spender, amount);
|
| 48 |
+
|
| 49 |
+
return true;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
|
| 53 |
+
require(recipient != address(0), "ERC20: transfer to the zero address");
|
| 54 |
+
require(amount <= balances[sender], "ERC20: transfer amount exceeds balance");
|
| 55 |
+
require(amount <= allowances[sender][msg.sender], "ERC20: transfer amount exceeds allowance");
|
| 56 |
+
|
| 57 |
+
balances[sender] -= amount;
|
| 58 |
+
balances[recipient] += amount;
|
| 59 |
+
allowances[sender][msg.sender] -= amount;
|
| 60 |
+
|
| 61 |
+
emit Transfer(sender, recipient, amount);
|
| 62 |
+
|
| 63 |
+
return true;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
function allowance(address account, address spender) public view returns (uint256) {
|
| 67 |
+
return allowances[account][spender];
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
function burn(uint256 amount) public returns (bool) {
|
| 71 |
+
require(amount <= balances[msg.sender], "ERC20: burn amount exceeds balance");
|
| 72 |
+
|
| 73 |
+
balances[msg.sender] -= amount;
|
| 74 |
+
totalSupply -= amount;
|
| 75 |
+
|
| 76 |
+
emit Transfer(msg.sender, address(0), amount);
|
| 77 |
+
|
| 78 |
+
return true;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
function mint(uint256 amount) public onlyOwner returns (bool) {
|
| 82 |
+
require(totalSupply + amount <= 2**256 - 1, "ERC20: total supply exceeds uint256");
|
| 83 |
+
|
| 84 |
+
balances[owner] += amount;
|
| 85 |
+
totalSupply += amount;
|
| 86 |
+
|
| 87 |
+
emit Transfer(address(0), owner, amount);
|
| 88 |
+
|
| 89 |
+
return true;
|
| 90 |
+
}
|
| 91 |
+
}
|