mint-snipe/README.md
2023-03-06 19:48:40 +01:00

55 lines
2.6 KiB
Markdown

[![status-badge](https://ci.enzofoucaud.fr/api/badges/open-source/mint-snipe/status.svg)](https://ci.enzofoucaud.fr/open-source/mint-snipe) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
## Mint sniper
_Having issues? Contact Querty#0001 on Discord_
### Installation
##### Requirements
- [Rust and Cargo](https://win.rustup.rs/)
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
Then, run the command bellow to install the sniper:
```bash
cargo install --git https://git.enzofoucaud.fr/open-source/mint-sniper.git
cd mint-sniper && cp .env.example .env && cp src/abi/abi.example.json src/abi/abi.json
```
Replace the values in the `.env` file with your own.
- `NETWORK_RPC` is your provider URL. You can use [Infura](https://infura.io/) or [Alchemy](https://www.alchemy.com/)
- `NETWORK_WSS` is your websocket provider URL. You can use [Infura](https://infura.io/) or [Alchemy](https://www.alchemy.com/)
- `PRIVATE_KEY` is your wallet's private key
Copy the contract's abi in the file `src/abi.json`.
### Usage
To run the sniper, you have to provide the following arguments:
- `--contract-address` is the address of the contract you want to snipe
- `--mint-method` is the name of the method used to mint the NFT
- `--price` is the price of one NFT in wei, you can get it from [here](https://eth-converter.com/)
- `--quantity` is the quantity of NFT you want to buy
- `--timestamp` is the timestamp of the sale in seconds, you can get it from [here](https://www.epochconverter.com/)
- `--retry-max` is the maximum number of retries if the transaction fails
- `--backrun` is the backrun mode. If set, the sniper will monitor the mempool and wait for the transaction that activate the sale. You can set timestamp to 0 in this mode. If not set, the sniper will wait for the sale to start and then send the transaction.
**The mint function must have one parameter, the quantity that you want to buy. If it's a free mint you can set the price to 0.**
##### Example
If the mint function is:
```solidity
function mint(uint256 qty) public payable
```
You can run the sniper with:
```bash
cargo run -- --contract-address 0x9601482fD8EacE73745Dd7353e17c19F4Ce9142d --mint-method mint --price 1000000000000000 --amount 2 --timestamp 1676816130 --retry-max 5
```
If backrun is set, you have to change the mint activation method directly in the code (see `src/mempool.rs lines 18 and 32`).
### TODO
- [x] Add support for multiple mint functions directly from the abi
- [ ] Add the max fees feature
- [ ] Add the gas price escalator to avoid the transaction to be stuck in the mempool