Skip to content

Commit

Permalink
feat: only buy whitelist flag
Browse files Browse the repository at this point in the history
  • Loading branch information
JayArrowz committed Sep 18, 2021
1 parent fe66e7b commit b63009b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions Models/SniperConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ public class SniperConfiguration
public string[] WhitelistedTokens { get; set; }
public int BuyDelaySeconds { get; set; }
public bool CheckRouterAddressInContract { get; set; }
public bool OnlyBuyWhitelist { get; set; }
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ There are specific checks involved that this sniper does when buying tokens. Som
6. If `RugdocCheckEnabled` is true the sniper will use the Rugdoc honeypot checker to check the contract
7. The `WhitelistedTokens` can be used to bypass any honeypot and rug checks. This field accepts multiple token addresses
8. If the `CheckRouterAddressInContract` is enabled the sniper will check if the contract contains the router address
9. If the `OnlyBuyWhitelist` is enabled the contract will only interact with whitelisted tokens

## Buying
The amount to snipe is denoted in the config as `AmountToSnipe`. This value will trade the `LiquidityPairAddress` in your wallet with the coin to snipe at the current trade price.
Expand Down
7 changes: 7 additions & 0 deletions SniperService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ private async Task PairCreated(PairCreatedEvent pair)
pair.Symbol = symbol;

var addressWhitelisted = _sniperConfig.WhitelistedTokens.Any(t => t.Equals(otherPairAddress));
if(_sniperConfig.OnlyBuyWhitelist && !addressWhitelisted)
{
Log.Logger.Warning("Address is not in the whitelist blocked {0}", otherPairAddress);
return;
}


var rugCheckPassed = _sniperConfig.RugCheckEnabled && !addressWhitelisted ? await _rugChecker.CheckRugAsync(pair) : true;
var otherTokenIdx = pair.Token0.Equals(_sniperConfig.LiquidityPairAddress, StringComparison.InvariantCultureIgnoreCase) ? 1 : 0;
var honeypotCheck = !addressWhitelisted && _sniperConfig.HoneypotCheck;
Expand Down
1 change: 1 addition & 0 deletions appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"0x000000000000000000000000000000000000dEaD",
"0x0000000000000000000000000000000000000000"
],
"OnlyBuyWhitelist": false,
"WhitelistedTokens": [
"0x0000000000000000000000000000000000000000"
],
Expand Down

0 comments on commit b63009b

Please sign in to comment.