Skip to content

Instantly share code, notes, and snippets.

@andrecronje
Created March 26, 2021 09:48
Show Gist options
  • Save andrecronje/3ca7869c6216e309f40de1684a6c4b84 to your computer and use it in GitHub Desktop.
Save andrecronje/3ca7869c6216e309f40de1684a6c4b84 to your computer and use it in GitHub Desktop.

// Important! use callStatic for all methods (even workable and work) to avoid spending gas // only send work transaction if callStatic.work succeeded, // even if workable is true, the job might not have credits to pay and the work tx will revert const jobs = await Keep3rLiquidityManagerJob.callStatic.jobs(); for (const job of jobs) { const workable = await Keep3rLiquidityManagerJob.callStatic.workable(job); console.log({ job, workable }); if (!workable) continue; await Keep3rLiquidityManagerJob.connect(keeper).callStatic.work(job); await Keep3rLiquidityManagerJob.connect(keeper).work(job); console.log('worked!'); }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment