抢土狗机器人——无代码基础可以使用

上次分享了一个抢土狗的机器人,感觉大家的关注度还是比较高的,目前升级啦一下,写了一个页面。截个图看一下:

简单介绍一下 : 这个就是自己写了一个本地html版本的,可以在页面上输入,密码啥都在自己本地,也很安全。

有需要这个软件的朋友可以私信我。

 下面贴一点核心代码 :

import ethers from 'ethers';

import express from 'express';

import chalk from 'chalk';

import dotenv from 'dotenv';

import inquirer from 'inquirer';

const app = express();

dotenv.config();

const data = {

WBNB: process.env.WBNB_CONTRACT, //wbnb

to_PURCHASE: process.env.TO_PURCHASE, // token that you will purchase = BUSD for test '0xe9e7cea3dedca5984780bafc599bd69add087d56'

AMOUNT_OF_WBNB : process.env.AMOUNT_OF_WBNB, // how much you want to buy in WBNB

factory: process.env.FACTORY, //PancakeSwap V2 factory

router: process.env.ROUTER, //PancakeSwap V2 router

recipient: process.env.YOUR_ADDRESS, //your wallet address,

Slippage : process.env.SLIPPAGE, //in Percentage

gasPrice : ethers.utils.parseUnits(`${process.env.GWEI}`, 'gwei'), //in gwei

gasLimit : process.env.GAS_LIMIT, //at least 21000

minBnb : process.env.MIN_LIQUIDITY_ADDED //min liquidity added

}

let initialLiquidityDetected = false;

let jmlBnb = 0;

const bscMainnetUrl = 'https://bsc-dataseed1.defibit.io/' //https://bsc-dataseed1.defibit.io/ https://bsc-dataseed.binance.org/

const wss = 'wss://bsc-ws-node.nariox.org:443';

const mnemonic = process.env.YOUR_MNEMONIC //your memonic;

const tokenIn = data.WBNB;

const tokenOut = data.to_PURCHASE;

const provider = new ethers.providers.WebSocketProvider(wss);

const wallet = new ethers.Wallet(mnemonic);

const account = wallet.connect(provider);


 

const factory = new ethers.Contract(

data.factory,

[

'event PairCreated(address indexed token0, address indexed token1, address pair, uint)',

'function getPair(address tokenA, address tokenB) external view returns (address pair)'

],

account

);

const router = new ethers.Contract(

data.router,

[

'function getAmountsOut(uint amountIn, address[] memory path) public view returns (uint[] memory amounts)',

'function swapExactTokensForTokens(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts)',

'function swapExactTokensForTokensSupportingFeeOnTransferTokens(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts)'

],

account

);

const erc = new ethers.Contract(

data.WBNB,

[{"constant": true,"inputs": [{"name": "_owner","type": "address"}],"name": "balanceOf","outputs": [{"name": "balance","type": "uint256"}],"payable": false,"type": "function"}],

account

);

const run = async () => {

await checkLiq();

}

let checkLiq = async() => {

const pairAddressx = await factory.getPair(tokenIn, tokenOut);

console.log(chalk.blue(`pairAddress: ${pairAddressx}`));

if (pairAddressx !== null && pairAddressx !== undefined) {

if (pairAddressx.toString().indexOf('0x0000000000000') > -1) {

console.log(chalk.cyan(`pairAddress ${pairAddressx} not detected. Auto restart`));

return await run();

}

}

const pairBNBvalue = await erc.balanceOf(pairAddressx);

jmlBnb = await ethers.utils.formatEther(pairBNBvalue);

console.log(`value BNB : ${jmlBnb}`);

if(jmlBnb > data.minBnb){

setTimeout(() => buyAction(), 1);

}

else{

initialLiquidityDetected = false;

console.log(' run again...');

return await run();

}

}

let buyAction = async() => {

if(initialLiquidityDetected === true) {

console.log('not buy cause already buy');

return null;

}

console.log('ready to buy');

try{

initialLiquidityDetected = true;

let amountOutMin = 0.;

//We buy x amount of the new token for our wbnb

const amountIn = ethers.utils.parseUnits(`${data.AMOUNT_OF_WBNB}`, 'ether');

//if ( parseInt(data.Slippage) !== 0 ){

// const amounts = await router.getAmountsOut(amountIn, [tokenIn, tokenOut]);

//Our execution price will be a bit different, we need some flexbility

// amountOutMin = amounts[1].sub(amounts[1].div(`${data.Slippage}`));

// }

console.log(

chalk.green.inverse(`Start to buy \n`)

+

`Buying Token

=================

tokenIn: ${(amountIn * 1e-18).toString()} ${tokenIn} (BNB)

tokenOut: ${(amountOutMin / 1e-18).toString()} ${tokenOut}

`);

console.log('Processing Transaction.....');

console.log(chalk.yellow(`amountIn: ${(amountIn * 1e-18)} ${tokenIn} (BNB)`));

console.log(chalk.yellow(`amountOutMin: ${amountOutMin / 1e-18}`));

console.log(chalk.yellow(`tokenIn: ${tokenIn}`));

console.log(chalk.yellow(`tokenOut: ${tokenOut}`));

console.log(chalk.yellow(`data.recipient: ${data.recipient}`));

console.log(chalk.yellow(`data.gasLimit: ${data.gasLimit}`));

console.log(chalk.yellow(`data.gasPrice: ${data.gasPrice}`));

const tx = await router.swapExactTokensForTokensSupportingFeeOnTransferTokens( //uncomment this if you want to buy deflationary token

// const tx = await router.swapExactTokensForTokens( //uncomment here if you want to buy token

amountIn,

amountOutMin,

[tokenIn, tokenOut],

data.recipient,

Date.now() + 1000 * 60 * 5, //5 minutes

{

'gasLimit': data.gasLimit,

'gasPrice': data.gasPrice,

'nonce' : null //set you want buy at where position in blocks

});

const receipt = await tx.wait();

console.log(`Transaction receipt : https://www.bscscan.com/tx/${receipt.logs[1].transactionHash}`);

setTimeout(() => {process.exit()},2000);

}catch(err){

let error = JSON.parse(JSON.stringify(err));

console.log(`Error caused by :

{

reason : ${error.reason},

transactionHash : ${error.transactionHash}

message : Please check your BNB/WBNB balance, maybe its due because insufficient balance or approve your token manually on pancakeSwap

}`);

console.log(error);

inquirer.prompt([

{

type: 'confirm',

name: 'runAgain',

message: 'Do you want to run again thi bot?',

},

])

.then(answers => {

if(answers.runAgain === true){

console.log('= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =');

console.log('Run again');

console.log('= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =');

initialLiquidityDetected = false;

run();

}else{

process.exit();

}

});

}

}

run();

const PORT = 5001;

app.use(express.static('../app'));


 

app.listen(PORT, console.log(chalk.yellow(`Listening for Liquidity Addition to token ${data.to_PURCHASE}`)));

  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
https://assetstore.unity.com/packages/tools/level-design/bakery-gpu-lightmapper-122218 Bakery is a high-end, production-ready, hassle-free GPU lightmapper, designed as an alternative to Enlighten and Progressive. NOTE: Requires modern Nvidia GPU (6xx or newer) and 64-bit Windows (7 or higher). Doesn't support AMD cards for baking. Doesn't support Macs. Tested on everything from Unity 5.6 to 2019.3.4. Resulting lightmaps are compatible with all platforms. Manual - make sure you read FAQ Forum thread Features: - Physically correct baked lighting. All results were compared against Mitsuba offline renderer. - Performance: uses GPU for ray-tracing. - Can take advantage of (but not requires) RTX hardware. - Uses NVidia AI Denoiser to remove noise, powered by deep learning. - Fixes common baking artifacts, such as lighting leaks and UV seams. - Global Illumination (supports custom shaders). - Sky lighting (HDRI or color). - Emissive textured meshes. - IES Lights. - Directional, point, spot light sources. - Materials: supports albedo, emissive, opacity. - Can produce both complete and indirect lightmaps, or even mix both per-light. - Can produce shadowmasks. - Supports directional baking (bump/specular) with 4 modes: dominant direction (compatible with most shaders), Radiosity Normal Mapping, per-pixel spherical harmonics, as well as simply baking normal maps to diffuse. - Selective render is supported. - Light probes. - Automatic atlas packing. - Supports Mesh Renderers, Skinned Meshes and Terrains. - Supports LODs. - Supports baked prefabs. - Real-time ray traced preview can be additionally installed. Some notable games shipped using Bakery: Call of Duty Mobile Totally Accurate Battle Simulator Dead and Buried II ... and many more!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值