Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- import config
- import asyncio
- import datetime
- import time
- from web3 import Web3
- ## Common Settings ##
- bsc = "https://bsc-dataseed.binance.org/"
- web3 = Web3(Web3.HTTPProvider(bsc))
- sender_address = 'Your Wallet'
- PCSRouter_address = '0x10ED43C718714eb63d5aA57B78B54704E256024E'
- ###############
- ## Check connected
- print("Connect Status: ", Web3.isConnected(web3))
- ## ABI Setting ## Get from contract ABI
- panabi = ''
- #########
- ## Check Sender Address balance ##
- balance = web3.eth.get_balance(sender_address)
- balance_converted = web3.fromWei(balance,'ether')
- print("Wallet balance:" , balance_converted,"BNB")
- ####
- contract = web3.eth.contract(address=PCSRouter_address , abi=panabi)
- ## Setting token want to swap
- tokenToBuy = web3.toChecksumAddress(input("Enter Token Address: ")) #
- ## Setting BUSD/USDT for swapping
- #spend =web3.toChecksumAddress("0x55d398326f99059ff775485246999027b3197955") # USDT
- spend =web3.toChecksumAddress("0xe9e7cea3dedca5984780bafc599bd69add087d56") # BUSD
- ## Check total transaction of sender Wallet ##
- nonce = web3.eth.get_transaction_count(sender_address)
- count = 1
- MaxTx = 5 ## Setting Number of Tx you want to APE
- start = time.time()
- while count <= MaxTx:
- pancakeswap2_txn = contract.functions.swapExactTokensForTokensSupportingFeeOnTransferTokens(
- web3.toWei('0.2','ether'), # BUSD AMMOUNT You want to spend
- 0, # set to 0 means dont care slippage, or specify minimum amount of token you want to receive - consider Decimal!
- [spend,tokenToBuy],
- sender_address,
- (int(time.time()) + 10000)
- ).buildTransaction({
- 'from': sender_address,
- 'gas': 300000,
- 'gasPrice': web3.toWei('5','gwei'),
- 'nonce': nonce,
- })
- signed_txn = web3.eth.account.sign_transaction(pancakeswap2_txn, private_key='Your Private Key')
- tx_token = web3.eth.send_raw_transaction(signed_txn.rawTransaction)
- print("TX Hash: ", Web3.toHex(tx_token))
- nonce = nonce +1
- count = count + 1
- print("Done!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement