¡El código fuente de este contrato está verificado!
Metadatos del Contrato
Compilador
0.8.7+commit.e28d00a7
Idioma
Solidity
Código Fuente del Contrato
Archivo 1 de 8: AntiSniper.sol
//SPDX-License-Identifier: UNLICENSEDpragmasolidity 0.8.7;import"./Libraries.sol";
import"./Interfaces.sol";
import"./BaseErc20.sol";
interfaceIPinkAntiBot{
functionsetTokenOwner(address owner) external;
functiononPreTransferCheck(addressfrom, address to, uint256 amount) external;
}
abstractcontractAntiSniperisBaseErc20{
IPinkAntiBot public pinkAntiBot;
boolprivate pinkAntiBotConfigured;
boolpublic enableSniperBlocking;
boolpublic enableBlockLogProtection;
boolpublic enableHighTaxCountdown;
boolpublic enablePinkAntiBot;
uint256public msPercentage;
uint256public mhPercentage;
uint256public maxGasLimit;
uint256public launchTime;
uint256public launchBlock;
uint256public snipersCaught;
mapping (address=>bool) public isSniper;
mapping (address=>bool) public isNeverSniper;
mapping (address=>uint256) public transactionBlockLog;
// Overridesfunctionconfigure(address _owner) internalvirtualoverride{
isNeverSniper[_owner] =true;
super.configure(_owner);
}
functionlaunch() overridevirtualpubliconlyOwner{
super.launch();
launchTime =block.timestamp;
launchBlock =block.number;
}
functionpreTransfer(addressfrom, address to, uint256 value) overridevirtualinternal{
require(enableSniperBlocking ==false|| isSniper[msg.sender] ==false, "sniper rejected");
if (launched &&from!= owner && isNeverSniper[from] ==false&& isNeverSniper[to] ==false) {
if (maxGasLimit >0) {
require(gasleft() <= maxGasLimit, "this is over the max gas limit");
}
if (mhPercentage >0&& exchanges[to] ==false) {
require (_balances[to] + value <= mhAmount(), "this is over the max hold amount");
}
if (msPercentage >0&& exchanges[to]) {
require (value <= msAmount(), "this is over the max sell amount");
}
if(enableBlockLogProtection) {
if (transactionBlockLog[to] ==block.number) {
isSniper[to] =true;
snipersCaught ++;
}
if (transactionBlockLog[from] ==block.number) {
isSniper[from] =true;
snipersCaught ++;
}
if (exchanges[to] ==false) {
transactionBlockLog[to] =block.number;
}
if (exchanges[from] ==false) {
transactionBlockLog[from] =block.number;
}
}
if (enablePinkAntiBot) {
pinkAntiBot.onPreTransferCheck(from, to, value);
}
}
super.preTransfer(from, to, value);
}
functioncalculateTransferAmount(addressfrom, address to, uint256 value) internalvirtualoverridereturns (uint256) {
uint256 amountAfterTax = value;
if (launched && enableHighTaxCountdown) {
if (from!= owner && sniperTax() >0&& isNeverSniper[from] ==false&& isNeverSniper[to] ==false) {
uint256 taxAmount = (value * sniperTax()) /10000;
amountAfterTax = amountAfterTax - taxAmount;
}
}
returnsuper.calculateTransferAmount(from, to, amountAfterTax);
}
// Public methodsfunctionmhAmount() publicviewreturns (uint256) {
return (_totalSupply * mhPercentage) /10000;
}
functionmsAmount() publicviewreturns (uint256) {
return (_totalSupply * msPercentage) /10000;
}
functionsniperTax() publicvirtualviewreturns (uint256) {
if(launched) {
if (block.number- launchBlock <3) {
return9900;
}
}
return0;
}
// Admin methodsfunctionconfigurePinkAntiBot(address antiBot) externalonlyOwner{
pinkAntiBot = IPinkAntiBot(antiBot);
pinkAntiBot.setTokenOwner(owner);
pinkAntiBotConfigured =true;
enablePinkAntiBot =true;
}
functionsetSniperBlocking(bool enabled) externalonlyOwner{
enableSniperBlocking = enabled;
}
functionsetBlockLogProtection(bool enabled) externalonlyOwner{
enableBlockLogProtection = enabled;
}
functionsetHighTaxCountdown(bool enabled) externalonlyOwner{
enableHighTaxCountdown = enabled;
}
functionsetPinkAntiBot(bool enabled) externalonlyOwner{
require(pinkAntiBotConfigured, "pink anti bot is not configured");
enablePinkAntiBot = enabled;
}
functionsetMsPercentage(uint256 amount) externalonlyOwner{
msPercentage = amount;
}
functionsetMhPercentage(uint256 amount) externalonlyOwner{
mhPercentage = amount;
}
functionsetMaxGasLimit(uint256 amount) externalonlyOwner{
maxGasLimit = amount;
}
functionsetIsSniper(address who, bool enabled) externalonlyOwner{
isSniper[who] = enabled;
}
functionsetNeverSniper(address who, bool enabled) externalonlyOwner{
isNeverSniper[who] = enabled;
}
// private methods
}
Código Fuente del Contrato
Archivo 2 de 8: BaseErc20.sol
//SPDX-License-Identifier: UNLICENSEDpragmasolidity 0.8.7;import"./Interfaces.sol";
import"./Libraries.sol";
abstractcontractBaseErc20isIERC20, IOwnable{
mapping (address=>uint256) internal _balances;
mapping (address=>mapping (address=>uint256)) internal _allowed;
uint256internal _totalSupply;
boolinternal _useSafeTransfer;
stringpublic symbol;
stringpublic name;
uint8public decimals;
addresspublicoverride owner;
boolpublic isTradingEnabled =true;
boolpublic launched;
mapping (address=>bool) public canAlwaysTrade;
mapping (address=>bool) public excludedFromSelling;
mapping (address=>bool) public exchanges;
modifieronlyOwner() {
require(msg.sender== owner, "can only be called by the contract owner");
_;
}
modifierisLaunched() {
require(launched, "can only be called once token is launched");
_;
}
// @dev Trading is allowed before launch if the sender is the owner, we are transferring from the owner, or in canAlwaysTrade listmodifiertradingEnabled(addressfrom) {
require((isTradingEnabled && launched) ||from== owner || canAlwaysTrade[msg.sender], "trading not enabled");
_;
}
functionconfigure(address _owner) internalvirtual{
owner = _owner;
canAlwaysTrade[owner] =true;
}
/**
* @dev Total number of tokens in existence
*/functiontotalSupply() externaloverrideviewreturns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/functionbalanceOf(address _owner) externaloverrideviewreturns (uint256) {
return _balances[_owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/functionallowance(address _owner, address spender) externaloverrideviewreturns (uint256) {
return _allowed[_owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/functiontransfer(address to, uint256 value) externaloverridetradingEnabled(msg.sender) returns (bool) {
_transfer(msg.sender, to, value);
returntrue;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/functionapprove(address spender, uint256 value) externaloverridetradingEnabled(msg.sender) returns (bool) {
require(spender !=address(0), "cannot approve the 0 address");
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
returntrue;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/functiontransferFrom(addressfrom, address to, uint256 value) externaloverridetradingEnabled(from) returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender] - value;
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
returntrue;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/functionincreaseAllowance(address spender, uint256 addedValue) externaltradingEnabled(msg.sender) returns (bool) {
require(spender !=address(0), "cannot approve the 0 address");
_allowed[msg.sender][spender] = _allowed[msg.sender][spender] + addedValue;
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
returntrue;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/functiondecreaseAllowance(address spender, uint256 subtractedValue) externaltradingEnabled(msg.sender) returns (bool) {
require(spender !=address(0), "cannot approve the 0 address");
_allowed[msg.sender][spender] = _allowed[msg.sender][spender] - subtractedValue;
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
returntrue;
}
// Virtual methodsfunctionlaunch() virtualpubliconlyOwner{
launched =true;
}
functionpreTransfer(addressfrom, address to, uint256 value) virtualinternal{ }
functioncalculateTransferAmount(addressfrom, address to, uint256 value) virtualinternalreturns (uint256) {
require(from!= to, "you cannot transfer to yourself");
return value;
}
functionpostTransfer(addressfrom, address to) virtualinternal{ }
// Admin methodsfunctionchangeOwner(address who) externalonlyOwner{
require(who !=address(0), "cannot be zero address");
owner = who;
}
functionremoveBnb() externalonlyOwner{
uint256 balance =address(this).balance;
payable(owner).transfer(balance);
}
functiontransferTokens(address token, address to) externalonlyOwnerreturns(bool){
uint256 balance = IERC20(token).balanceOf(address(this));
return IERC20(token).transfer(to, balance);
}
functionsetCanAlwaysTrade(address who, bool enabled) externalonlyOwner{
canAlwaysTrade[who] = enabled;
}
functionsetExchange(address who, bool isExchange) externalonlyOwner{
exchanges[who] = isExchange;
}
// Private methodsfunctiongetRouterAddress() internalviewreturns (address routerAddress) {
if (block.chainid==1||block.chainid==3||block.chainid==4||block.chainid==5) {
routerAddress =0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ; // ETHEREUM
} elseif (block.chainid==56) {
routerAddress =0x10ED43C718714eb63d5aA57B78B54704E256024E; // BSC MAINNET
} elseif (block.chainid==97) {
routerAddress =0xc99f3718dB7c90b020cBBbb47eD26b0BA0C6512B; // BSC TESTNET - https://pancakeswap.rainbit.me/
} else {
revert("Unknown Chain ID");
}
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/function_transfer(addressfrom, address to, uint256 value) private{
require(to !=address(0), "cannot be zero address");
require(excludedFromSelling[from] ==false, "address is not allowed to sell");
if (_useSafeTransfer) {
_balances[from] = _balances[from] - value;
_balances[to] = _balances[to] + value;
emit Transfer(from, to, value);
} else {
preTransfer(from, to, value);
uint256 modifiedAmount = calculateTransferAmount(from, to, value);
_balances[from] = _balances[from] - value;
_balances[to] = _balances[to] + modifiedAmount;
emit Transfer(from, to, modifiedAmount);
postTransfer(from, to);
}
}
}
Código Fuente del Contrato
Archivo 3 de 8: Burnable.sol
//SPDX-License-Identifier: UNLICENSEDpragmasolidity 0.8.7;import"./Libraries.sol";
import"./Interfaces.sol";
import"./BaseErc20.sol";
abstractcontractBurnableisBaseErc20, IBurnable{
mapping (address=>bool) public ableToBurn;
modifieronlyBurner() {
require(ableToBurn[msg.sender], "no burn permissions");
_;
}
// Overridesfunctionconfigure(address _owner) internalvirtualoverride{
ableToBurn[_owner] =true;
super.configure(_owner);
}
// Admin methodsfunctionsetAbleToBurn(address who, bool enabled) externalonlyOwner{
ableToBurn[who] = enabled;
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param value The amount that will be burnt.
*/functionburn(uint256 value) externaloverrideonlyBurner{
_burn(msg.sender, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/functionburnFrom(address account, uint256 value) externaloverrideonlyBurner{
_allowed[account][msg.sender] = _allowed[account][msg.sender] - value;
_burn(account, value);
emit Approval(account, msg.sender, _allowed[account][msg.sender]);
}
// Private methodsfunction_burn(address account, uint256 value) internal{
require(account !=address(0));
_totalSupply = _totalSupply - value;
_balances[account] = _balances[account] - value;
emit Transfer(account, address(0), value);
}
}
//SPDX-License-Identifier: UNLICENSEDpragmasolidity 0.8.7;/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/librarySafeMath{
int256constantprivate INT256_MIN =-2**255;
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/functionmul(uint256 a, uint256 b) internalpurereturns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the// benefit is lost if 'b' is also tested.// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522if (a ==0) {
return0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Multiplies two signed integers, reverts on overflow.
*/functionmul(int256 a, int256 b) internalpurereturns (int256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the// benefit is lost if 'b' is also tested.// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522if (a ==0) {
return0;
}
require(!(a ==-1&& b == INT256_MIN)); // This is the only case of overflow not detected by the check belowint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/functiondiv(uint256 a, uint256 b) internalpurereturns (uint256) {
// Solidity only automatically asserts when dividing by 0require(b >0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't holdreturn c;
}
/**
* @dev Integer division of two signed integers truncating the quotient, reverts on division by zero.
*/functiondiv(int256 a, int256 b) internalpurereturns (int256) {
require(b !=0); // Solidity only automatically asserts when dividing by 0require(!(b ==-1&& a == INT256_MIN)); // This is the only case of overflowint256 c = a / b;
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/functionsub(uint256 a, uint256 b) internalpurereturns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Subtracts two signed integers, reverts on overflow.
*/functionsub(int256 a, int256 b) internalpurereturns (int256) {
int256 c = a - b;
require((b >=0&& c <= a) || (b <0&& c > a));
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/functionadd(uint256 a, uint256 b) internalpurereturns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Adds two signed integers, reverts on overflow.
*/functionadd(int256 a, int256 b) internalpurereturns (int256) {
int256 c = a + b;
require((b >=0&& c >= a) || (b <0&& c < a));
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/functionmod(uint256 a, uint256 b) internalpurereturns (uint256) {
require(b !=0);
return a % b;
}
}