0

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()
print(web3.toWei('0.03','ether'))

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
  [spend,contract_id],
  sender_address,
  (int(time.time()) + 1000000)
).buildTransaction({
  '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)
print(web3.toHex(tx_token))```

1 Answer 1

1
while True:
    your code here
0

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.