This project is a Solidity-based Ethereum smart contract for a sniping bot that aims to capitalize on trading opportunities using Uniswap V3. It includes setup instructions, deployment scripts, and interaction scripts to automate the process of buying and selling tokens on the Ethereum blockchain.
- Deploy a sniping bot smart contract
- Execute token sniping on Uniswap V3
- Sell sniped tokens for profit
- Withdraw funds (ETH or ERC-20 tokens) from the contract
- Node.js and npm
- Infura Project ID
- Ethereum account with sufficient ETH for transactions
git clone https://github.com/your-username/SnipingBotProject.git
cd SnipingBotProject
npm install
Create a .env
file in the root directory with the following content:
INFURA_PROJECT_ID=your_infura_project_id
PRIVATE_KEY=your_private_key
Replace your_infura_project_id
and your_private_key
with your actual Infura project ID and Ethereum private key.
npx hardhat compile
npx hardhat run scripts/deploy.js --network mainnet
Edit the scripts/interact.js
file to include the correct contract address and token addresses. Then run:
npx hardhat run scripts/interact.js --network mainnet
contracts/
: Contains the Solidity smart contractSnipingBot.sol
.scripts/
: Contains deployment and interaction scripts.deploy.js
: Script to deploy the smart contract.interact.js
: Script to interact with the deployed contract.
test/
: (Optional) Directory for test scripts if you want to add tests.hardhat.config.js
: Hardhat configuration file..env
: Environment variables file.package.json
: Project dependencies.
constructor(address _uniswapRouter)
: Initializes the contract with the Uniswap V3 router address.snipe(address tokenIn, address tokenOut, uint24 fee, uint amountIn, uint amountOutMin, uint160 sqrtPriceLimitX96)
: Executes a token snipe on Uniswap V3.sell(address tokenIn, address tokenOut, uint24 fee, uint amountOut, uint amountInMax, uint160 sqrtPriceLimitX96)
: Sells the sniped tokens on Uniswap V3.withdrawETH(uint amount)
: Withdraws specified amount of ETH from the contract to the owner's address.withdrawToken(address token, uint amount)
: Withdraws specified amount of ERC-20 tokens from the contract to the owner's address.
npx hardhat run scripts/deploy.js --network mainnet
Edit scripts/interact.js
with appropriate parameters and run:
npx hardhat run scripts/interact.js --network mainnet
This project is licensed under the MIT License.