Defender: Kovan Autotask example with Maker

I was playing around with OZ Defender (great product!), and I thought it would be nice to share another working example for the first timer. Below is an Autotask script that reads Maker’s ilkRegistry contract and pokes the spot contract on Kovan.

const { ethers } = require("ethers");
const { DefenderRelaySigner } = require('defender-relay-client/lib/ethers');

// Entrypoint for the Autotask
exports.handler = async function(credentials) {
  // Initialize default provider and defender relayer signer
  const provider = ethers.getDefaultProvider('kovan');
  const signer = new DefenderRelaySigner(credentials, provider, {
    speed: 'fast',
    from: '0xABC123',
  let ilkRegistryAddy = '0xedE45A0522CA19e979e217064629778d6Cc2d9Ea'
  let ilkRegistryABI = [
    "function list() external view returns (bytes32[] memory)",
  	"function name(bytes32 ilk) external view returns (string memory)"
  const ilkRegistry = new ethers.Contract(ilkRegistryAddy, 
  let spotAddy = '0x3a042de6413eDB15F2784f2f97cC68C7E9750b2D';
  let spotABI = ["function poke(bytes32 ilk) external"];
  const spot = new ethers.Contract(spotAddy, 
  console.log(`Poking Spotter at ${spotAddy}`);
  let list = await ilkRegistry.list();

  for (const ilk of list) {
    await spot.poke(ilk);
    let name = await;
    console.log(`Poked ${name}`);



Hi @KentonPrescott,

Welcome to the community :wave:

Thanks for sharing!!

1 Like