How i can make my code work after its done? like i want to make my code start again and again when its done.

#Setup the PancakeSwap contract
contract = web3.eth.contract(address=router_address, abi=PancakeABI)
nonce = web3.eth.get_transaction_count(sender_address)
start = time.time()

pancakeswap2_txn = contract.functions.swapExactETHForTokens(
  0, # here setup the minimum destination token you want to have, you can do some math, or you can put a 0 if you don't want to care
  (int(time.time()) + 1000000)
  'from': sender_address,
  'value': web3.toWei(0.4,'ether'),#This is the Token(BNB) amount you want to Swap from
  'gas': 250000,
  'gasPrice': web3.toWei('5','gwei'),
  'nonce': nonce,

signed_txn = web3.eth.account.sign_transaction(pancakeswap2_txn, private_key=private)
tx_token = web3.eth.send_raw_transaction(signed_txn.rawTransaction)

1 Answer 1

while True:
    your code here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.