Open tartarus256 opened 3 years ago
Never mind, did some reading and got it working. Probably not the most elegant solution but does the gist of what I was trying.
def checkledger(): predictionContract = web3.toChecksumAddress(config["predictionContract"]) contract = web3.eth.contract(address=predictionContract, abi=PancakePredictionV2ABI) sender_address = web3.toChecksumAddress(config["walletAddress"]) nonce = web3.eth.get_transaction_count(sender_address) epochs = [] lastEpoch = (int(getEpoch()) - 2) epochs.append(lastEpoch) ledger = contract.functions.ledger(lastEpoch, sender_address).call() if ledger[1] == 0: ledger[1] = .005 return ledger[1] else: ledger[1] = ledger[1]/1000000000000000000 print (ledger[1]) return ledger[1]
if doubleDown: if claims != True: print("We lost the last bet, doubling down.") amount = float(lastbet) * float(multiplier) print("Total bet: {}".format(amount)) betBull(amount) else: betBull(amount)
I did some more tinkering and everything functions as intended, carnac will get the previous bet amount and double down but gets the following error.
ValueError: {'code': -32000, 'message': 'replacement transaction underpriced'}
which traces back to a json-rpc betBull/betBear and I think has something to do with the transaction.
tx_token = web3.eth.send_raw_transaction(signed_txn.rawTransaction)
Very nice. Great idea! Where are you calling checkledger() from?
Very nice. Great idea! Where are you calling checkledger() from?
How to set up this. I want to use comand python3 Carnac.py --amount 0.01 --multiplier 1.25
Excellent work on Carnac. I've been playing with a while and its a great base for interacting with pancakeswap prediction. Can you add a function that queries the ledger from the previous match to get the bet amount? I was trying to write it myself but am not great at python. I was able to query the ledger but it returns several fields and is giving me a TypeError: float() argument must be a string or a number, not 'list'.
I think this would be useful for making a multiplier that queries the previous bet amount and claimwinnings function to multply the bet if we lost the previous round. If we won the previous round it would place the same bet. I'll fire off a tip to your wallet if you respond to this. Thanks dude, great work regardless.