How to incorporate an infura provider into code using Open Zepplin Autotasks?

When you create a new ethers.js provider via ethers.getDefaultProvider() , it uses a set of shared API keys that can be throttled, and end up causing these errors. My suggestion would be to sign up for an API key on either alchemy or infura, and then just create an alchemy provider or infura provider.

Issue: Don’t know how to create/incorporate infura provider into Keep3r code:

Template code that needs to properly have a Infura provider:

const workableAbi = ;
const workableAddr = ;
const from = ;
const { ethers } = require(“ethers”);
const { DefenderRelaySigner } = require(‘defender-relay-client/lib/ethers’);
// Entrypoint for the Autotask
exports.handler = async function(credentials) {
const provider = ethers.getDefaultProvider(‘mainnet’);
const signer = new DefenderRelaySigner(credentials, provider, { speed: ‘fastest’, from });
const contract = new ethers.Contract(workableAddr, workableAbi, signer);
// Run work if needed
if (await contract.updateable()) {
const tx = await contract.work();
console.log(tx.hash);
}
}

Hi @Ali.Dean92 - welcome to the Infura community! I’m not super familiar with OpenZeppelin, but from their docs, it looks like they have a pretty comprehensive guide on connecting to a test network for Infura.