Skip to content

Commit

Permalink
feat: add buy delay seconds and stop websocket crash
Browse files Browse the repository at this point in the history
  • Loading branch information
JayArrowz committed Sep 3, 2021
1 parent 28be525 commit 64a214c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Handlers/TradeHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public async Task<bool> Buy(string tokenAddress, int tokenIdx, string pairAddres
{
try
{
if (_sniperConfig.BuyDelaySeconds > 0)
{
await Task.Delay(TimeSpan.FromSeconds(_sniperConfig.BuyDelaySeconds));
}
var buyFunction = _pancakeContract.GetFunction("swapExactETHForTokens");
var gas = new HexBigInteger(_sniperConfig.GasAmount);
var amount = new HexBigInteger(Web3.Convert.ToWei(amt));
Expand Down
1 change: 1 addition & 0 deletions Models/SniperConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ public class SniperConfiguration
public bool RugdocCheckEnabled { get; set; }
public string[] DeadWallets { get; set; }
public string[] WhitelistedTokens { get; set; }
public int BuyDelaySeconds { get; set; }
}
}
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Telegram: https://t.me/PancakeTokenSniper

## Config
The Config is listed in `appsettings.json` There are values which you will have to set yourself, these are denoted with `xxx`.
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.

### Bsc Node and Http Api
Inside the config you will see `BscHttpApi` and `BscNode` keys.
Expand All @@ -24,6 +23,9 @@ Both are obtained from https://moralis.io for free. You will have to navigate to
Remember `BscNode` should be WS mainnet Endpoints and `BscHttpApi` should be Http endpoints
![image](https://user-images.githubusercontent.com/49910176/131349432-a4768c58-526c-407e-8cf6-547e1aacebf5.png)

### Bsc Scan API Key
The BSC Scan API key is obtained for free from https://bscscan.com/myapikey

## Running the project
If you want to run the project you can go to [releases](https://github.com/JayArrowz/PancakeTokenSniper/releases) and a binary that will execute on your OS, or install Net5.0 then compile and run the application. You can use `dotnet run BscTokenSniper` to do this.

Expand All @@ -38,6 +40,10 @@ 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

## 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.
You can set a delay on the buying buy setting the value `BuyDelaySeconds` to greater than 0

## Selling
The Sniper automatically sells once a certain percentage of profit is made. This is defined in the config key `ProfitPercentageMargin`

Expand Down
1 change: 1 addition & 0 deletions appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"V1PancakeswapRouterAddress": "0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F",
"ChainId": "56",
"AmountToSnipe": 0.01,
"BuyDelaySeconds": 0,
"ProfitPercentageMargin": 20,
"TransactionRevertTimeSeconds": 10000,
"GasAmount": 300000,
Expand Down

0 comments on commit 64a214c

Please sign in to comment.