Keep3r Network: OpenZeppelin | defender

Andre Cronje
3 min readOct 31, 2020

--

The goal with Keep3r is simple, create an agnostic, easy to implement, incentivization layer for routine ecosystem maintenance.

Keepers, as described in the documentation, are technical users, capable of implementing bots and/or scripts and running these in some scheduled manner (cronjobs, tasks managers).

With OpenZeppelin | defender, this is no longer a requirement. We will walk through how to set up a keeper in a few simple steps, earning passive rewards, and not needing to worry about maintenance again.

Prerequisites

Step 1: Setup Relayer

Select Create Relayer fill in a Name and select Create , that simple.

Step 2: Setup Autotask

Select Create Autotask , choose a Name for your task, select how often you would like it to execute 1 for 1 minute , select your relayer (created in the previous step, this is optional). And enter your code snippet. As example, lets look at UniswapV2Oracle;

const workableAbi = <contract ABI>;
const workableAddr = <contract address>;
const from = <from address>;
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);
}
}

For UniswapV2Oracle, there are two important calls;

  1. contract.updateable() returns a boolean true | false if calling contract.work() would be successful.
  2. contract.work() which does the maintenance job and rewards KP3R

Below is an example transaction;

Save the Autotask, and we are done;

The task will execute every minute, call updateable() and if it can update, it will call work

That simple.

--

--

Keep3r Fixed Forex Guide

2 min read

Sep 15, 2021

Keep3r Redeemable KP3R (rKP3R)

2 min read

Sep 15, 2021

vKP3R 101

2 min read

Sep 1, 2021

Keep3r expansion and consolidation

5 min read

Aug 27, 2021

Liquidity Mining Rewards v2

4 min read

Aug 15, 2021

Iron Bank Fixed Forex audit: Why audits are bad

2 min read

Aug 3, 2021

Fair launches, decentralized collaboration, and Fixed Forex

5 min read

Jul 25, 2021

Introducing Fixed Forex (USD, EUR, ZAR, JPY, CNY, etc)

1 min read

Jul 2, 2021

Keep3r V2 Oracles

2 min read

Mar 28, 2021

keep3r.network & unit.xyz

6 min read

Mar 10, 2021