//SPDX-License-Identifier:UNLICENSE
pragma solidity ^0.8.19;
contract PlotsFinance {
uint256 public totalSupply;
uint256 public maxSupply = 1000000000000000000000000000;
string public name;
string public symbol;
uint8 public decimals;
address private ZeroAddress = address(0);
address public distributor;
// Event Declarations
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event BurnEvent(address indexed burner, uint256 indexed buramount);
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) public allowance;
constructor(string memory _name, string memory _symbol) {
totalSupply = 0;
name = _name;
symbol = _symbol;
decimals = 18;
distributor = ZeroAddress; // Set distributor to address zero
}
function setDistributor(address _distributor) external {
require(distributor == ZeroAddress, "Distributor already set");
require(msg.sender == 0xc932b3a342658A2d3dF79E4661f29DfF6D7e93Ce, "Unauthorized sender");
distributor = _distributor;
}
function balanceOf(address Address) public view returns (uint256 balance) {
return balances[Address];
}
function approve(address delegate, uint256 _amount) public returns (bool) {
allowance[msg.sender][delegate] = _amount;
emit Approval(msg.sender, delegate, _amount);
return true;
}
function transferFrom(address _from, address _to, uint256 _amount) public returns (bool) {
require(_amount <= balances[_from]);
require(_amount <= allowance[_from][msg.sender]);
balances[_from] -= _amount;
allowance[_from][msg.sender] -= _amount;
balances[_to] += _amount;
emit Transfer(_from, _to, _amount);
return true;
}
function transfer(address _to, uint256 _amount) public returns (bool) {
require(_amount <= balances[msg.sender]);
balances[msg.sender] -= _amount;
balances[_to] += _amount;
emit Transfer(msg.sender, _to, _amount);
return true;
}
function mint(address _MintTo, uint256 _MintAmount) public returns (bool success) {
require(msg.sender == distributor, "Unauthorized distributor");
require(totalSupply + _MintAmount <= maxSupply, "Exceeds max supply");
balances[_MintTo] += _MintAmount;
totalSupply += _MintAmount;
emit Transfer(ZeroAddress, _MintTo, _MintAmount);
return true;
}
function burn(uint256 _BurnAmount) public {
require(balances[msg.sender] >= _BurnAmount, "Insufficient balance");
balances[msg.sender] -= _BurnAmount;
totalSupply -= _BurnAmount;
emit Transfer(msg.sender, ZeroAddress, _BurnAmount);
emit BurnEvent(msg.sender, _BurnAmount);
}
}
{
"compilationTarget": {
"PlotsFinance.sol": "PlotsFinance"
},
"evmVersion": "shanghai",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"burner","type":"address"},{"indexed":true,"internalType":"uint256","name":"buramount","type":"uint256"}],"name":"BurnEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"Address","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_BurnAmount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distributor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_MintTo","type":"address"},{"internalType":"uint256","name":"_MintAmount","type":"uint256"}],"name":"mint","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_distributor","type":"address"}],"name":"setDistributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]