engine icon indicating copy to clipboard operation
engine copied to clipboard

Atomic Transactions Processing

Open dcapitator opened this issue 6 months ago • 4 comments

Part of my issue is processing transactions from same wallet by order.

I can verify from engine code that queued transactions are fetched from db with asc queuedAt it means FIFO

But here is an example of batch transaction and this happens also when i send 2 seperate TXs 1 after another with 1 second offset in time.

Below are 2 TXs ( Approve and Swap )

Its clear from the code that approval tx status changes to Sent before the swap tx .. But Swap tx is always failing because no allowance.

If i do the aproval first then wait few seconds and i execute same data for the swap , it succeed.

[ { "toAddress": "0xfff9976782d46cc05630d1f6ebab18b2324d6b14", "data": "0x095ea7b30000000000000000000000003bfa4769fb09eefc5a80d6e87c3b9c650f7ae48e00000000000000000000000000000000000004ee2d6d415b85acef8100000000", "value": "0x00", "txOverrides": { "gas": "70000" } }, { "toAddress": "0x3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48E", "data": "0x04e45aaf000000000000000000000000fff9976782d46cc05630d1f6ebab18b2324d6b140000000000000000000000001c7d4b196cb0c7b01d743fbc6116a902379c72380000000000000000000000000000000000000000000000000000000000000bb80000000000000000000000003187fc5d134b4d21331a715abf58b1e9e580e56900000000000000000000000000000000000000000000000000005af3107a400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "value": "0x00", "txOverrides": { "gas": "220000" } } ]

Here is the wallet:

https://sepolia.etherscan.io/address/0x2ef4075c77a6a6da393057880400794da57f4400

Its clear that sometimes only approval gets executed and sometimes both because i offset both tx by few seconds.

Is there a solution for dependent Txs like this use case? ( gas transfer from hot wallet >> Approval if needed >> Swap )

dcapitator avatar Aug 08 '24 09:08 dcapitator