0% found this document useful (0 votes)
133 views4 pages

Anti Sniper Code PDF

The document discusses anti-sniper bot techniques used in cryptocurrency contracts, including: 1. Checking block numbers and timestamps to implement high taxes or blocks to prevent quick trades. 2. Using functions like "getTotalFee()" and variables like "snipeBlockAmt" to calculate fees based on time since liquidity was added to catch sniper bots. 3. Integrating "antiBot" functions that check sender and recipient addresses against bot lists and require delays between trades. 4. Other techniques involve limiting trading after presales, adding cooldowns between trades, and searching keywords to quickly analyze contracts.

Uploaded by

asfsfsaf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
133 views4 pages

Anti Sniper Code PDF

The document discusses anti-sniper bot techniques used in cryptocurrency contracts, including: 1. Checking block numbers and timestamps to implement high taxes or blocks to prevent quick trades. 2. Using functions like "getTotalFee()" and variables like "snipeBlockAmt" to calculate fees based on time since liquidity was added to catch sniper bots. 3. Integrating "antiBot" functions that check sender and recipient addresses against bot lists and require delays between trades. 4. Other techniques involve limiting trading after presales, adding cooldowns between trades, and searching keywords to quickly analyze contracts.

Uploaded by

asfsfsaf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Viperr#9999 Educational Call Notes

Anti-Sniper Bot Code:

● Ctrl + f for the keyword “block.number” or “block.timestamp”

if(block.number <= startBlock + flagLimit) {


if(!isExcluded[recipient] && sender == address(_UniswapV2Pair)) {
tax = 90;
}
}

-------------------------------------------------------------------------------------------------------------------------------

● Ctrl + f keyword “gettotalfee”

function getTotalFee(bool selling) public view returns (uint256) {


if(launchedAt + 2 >= block.number){ return feeDenominator.sub(1); }
if(selling && buybackMultiplierTriggeredAt.add(buybackMultiplierLength) >
block.timestamp){ return getMultipliedFee(); }
return totalFee;

**Note, launched at +1 (can be +2 or more, variable) means block 2, so at least delay 3


blocks. Above means 99 or 100% tax on first 2 blocks**

-------------------------------------------------------------------------------------------------------------------------------

● Ctrl + f for the key word “antibot”


○ Below are two variations seen:

First Variation
function setAntiBotEnabled(bool _enabled) public onlyOwner {
antiBotEnabled = _enabled;

emit antiBotEnabledUpdated(_enabled);
}

function getAntiBotEnabled() public view returns (bool) {


return antiBotEnabled;
}
Viperr#9999 Educational Call Notes

Second Variation
if(m_AntiBot) {
if((_recipient == m_UniswapV2Pair || _sender == m_UniswapV2Pair) &&
m_TradingOpened){
require(!AntiBot.scanAddress(_recipient, m_UniswapV2Pair, tx.origin), "Beep
Beep Boop, You're a piece of poop");
require(!AntiBot.scanAddress(_sender, m_UniswapV2Pair, tx.origin), "Beep
Beep Boop, You're a piece of poop");
}
}
-------------------------------------------------------------------------------------------------------------------------------

● Ctrl + f keyword “snipe” / “snipeblock” (sometimes snip) , almost same as gettotalfee but
this is in seconds instead of blocks, remember 3 seconds is around 1 block
○ Below are three variations seen:

First Variation
bool private sniperProtection = true;
bool private _hasLiqBeenAdded = false;
uint256 private _liqAddBlock = 0;
// snipeBlock in ms , = 10s after lp
uint256 private snipeBlockAmt = 10000;
uint256 private snipersCaught = 0;

Second Variation
if (!_hasLiqBeenAdded) {
_checkLiquidityAdd(sender, recipient);
} else {
if (_liqAddBlock > 0
&& sender == uniswapV2Pair
&& !_liquidityHolders[sender]
&& !_liquidityHolders[recipient]
){
if (block.number - _liqAddBlock < snipeBlockAmt) {
_isSniper[recipient] = true;
snipersCaught ++;
emit SniperCaught(recipient);
}
Viperr#9999 Educational Call Notes

Third Variation
function launch() public {
require(_isAllowedToLaunch[_msgSender()], "Forbidden.");
require(!_hasLaunched, "Already launched.");
_sniperOracle.launch();
_hasLaunched = true;
}

function _approve(address owner, address spender, uint256 amount) private {


require(owner != ZERO_ADDRESS, "ERC20: approve from the zero address");
require(spender != ZERO_ADDRESS, "ERC20: approve to the zero address");
-------------------------------------------------------------------------------------------------------------------------------

● Ctrl + f keyword “checkbot” / “bot”


○ Below are two variations seen:

First Variation
function checkBot(address sender, address recipient) private {
if (block.number < launchedAt + limitBlock && automatedMarketMakerPairs[sender]) {
//fast bot sell
_isBlacklisted[recipient] = true;

Second Variation
function checkBot(address sender,address recipient) private {
if (sender == address(uniswapV2Pair) && recipient != address(0) && recipient !=
address(uniswapV2Router) && recipient != owner()) {
_purchaseHistory[recipient] = block.timestamp;
}
if(!_isExcludedFromFees[sender] && sender != address(0) && sender !=
address(uniswapV2Pair) && (recipient == address(uniswapV2Pair) || recipient ==
address(uniswapV2Router))) {
require(_purchaseHistory[sender].add(_rateLimitSeconds) < block.timestamp, "Error:
Are you a bot?");

Example: uint256 private _rateLimitSeconds = 1;


-------------------------------------------------------------------------------------------------------------------------------
● Ctrl + f keywords such as “snipe” / “marketingfee” / “liquidityfee”

function calculateMarketingFee(uint256 _amount, bool isSniper) private view returns (uint256) {


uint256 this_marketingFee = _marketingFee;
if(isSniper){
this_marketingFee == 98;

**Note, marketing word/snipe might be different, also look for numbers like 98 or 99**
Viperr#9999 Educational Call Notes

-------------------------------------------------------------------------------------------------------------------------------

● Ctrl + f keyword “tradingisenabled”


○ This function is used a lot after presales. Dev will pause trading after adding
liquidity and there will be tax which he manually turns off

function setPresaleOver() external onlyOwner {


require(!tradingIsEnabled, "04");
beginningOn = true;
tradingIsEnabled = true;
}

function offBeginning() external onlyOwner() {


beginningOn = false;
tradingIsEnabled = true;
}

-------------------------------------------------------------------------------------------------------------------------------

● Ctrl + f keyword “cooldown”


○ max tx in seconds

/ Cooldown & timer functionality


bool public buyCooldownEnabled = true;
uint8 public cooldownTimerInterval = 120; //120 seconds
mapping (address => uint) private cooldownTimer;

Quick Checklist if Limited Time:

● Words to search for when your due diligence time is severely limited:
○ Block.number
○ Block.timestamp
○ Launchedat
○ Antibot
○ Snip

You might also like