Will the autotask still attempt to do the job even when there is no reward available to distribute anymore?

@AlvinP asked in Keep3r Autotask errored with "INVALID_ARGUMENT","reason":"invalid ENS name" - #5 by AlvinP

On another note, I noticed the UniswapOracleV2 job has credits depleted, so will the autotask still attempt to do the job even when there is no reward available to distribute anymore? The job is still listed as active on the keep3r network. Maybe there are fractional KP3R left, which we can’t see as the UI only shows up to 2 decimals.

Hi @alvinp,

The code in the sample (https://docs.openzeppelin.com/defender/guide-keep3r#create_an_autotask) includes the following:

    if (await contract[job.workableFn]()) {
      console.log(`${job.name} is workable`);
      const tx = await contract[job.workFn]();
      console.log(`${job.name} worked: ${tx.hash}`);
    } else {
      console.log(`${job.name} is not workable`);
    }

This checks if a job is workable by calling the smart contract before doing the actual work.

_From: https://docs.openzeppelin.com/defender/guide-keep3r#executing_jobs_

:warning: Keep in mind that sending the transaction does not automatically mean you will get rewarded for it: other Keepers may also be monitoring the job for work, and if their transaction gets mined before yours, you will not get the reward!

I couldn't see in the Keep3r Network documentation https://docs.keep3r.network/jobs#paying-keepers what happens if there isn't enough reward to pay keepers. Options may be to add to the code to check the balance to see if they have a minimum balance (depending on the payment type), or if a job doesn't pay to manually remove from future runs.

It would seem that, if there's not enough reward to pay keepers, the workable() function may still return true, BUT the transaction would end up reverting due to insufficient funds to pay for the reward, and you would end up losing gas in the tx.

I'd suggest asking in the yearn forum on what is the best approach to work around this situation!

1 Like

Will be updating the keeper script templates to include a credit check before performing a job to ensure it is profitable to call work()

It seems Andre is working on this. We'll integrate this change into the guide once ready.

2 Likes

A post was split to a new topic: UniswapV2Oracle has been replaced by UniswapV2SlidingOracle