Error Insuficient Funds Autotask from Defender

Hi, I have problems with the autotak from defender.

I'm running 4 autotasks with a time difference between them of 5 minutes, one of these autotasks run a function in the polygon blockchain that emits an event, and this event active a sentinel that runs another autotask that executes the same function and emits the same event until calculating payment for almost 300 wallets, I execute the sentinel & Autotask in that way cause I do the calculatin by segments of 40 wallets at a time, once I calculate the payment for all the wallets the script stop the calls to the function, but during the execution of this flow the autotask throws me this error constantly:

Error while attempting request: Insufficient funds: 14.734470590104 MATIC required but 1.711063096459762783 MATIC are available for usage on the account(balance is currently 48.311185672899762783 MATIC and the expected cost of all pending transactions is 46.60012257644 MATIC).

why is the defender throwing this error if I have 48 matic and the Tx needs 14?, also the funds asked for the autotask seem exaggerated.

I have configured the speed to fast and the gas limit to 4 million.

can someone help me to know what's going on? or what can I improve to avoid this error?

:computer: Environment

Relayer - autotask - sentinel

:memo:Details

:1234: Code to reproduce

Hi @Mike_Bello -

Defender calculates the cost of all pending transactions (gasLimit * gasPrice) to determine the balance required for the next call. The JSON RPC Provider would perform this same check if we let the call go through. If the balance of the Relayer is lower than the cost of all pending transactions plus the cost of the next transaction, it will throw a 400 error. Note that it is possible that gasLimit is being set higher than it needs to be, which inflates this calculation.

The cost of the pending transaction is only reduced once the transaction is marked Confirmed, which takes 60 blocks on Polygon.

The best course of action to avoid this error is to provide sufficient funds for the Relayer to process all pending transactions.