Skip to main content

KeeperBotGuard

Git Source

Inherits: Ownable

Title: Keeper Bot Guard

Author: Golem Foundation

Guard that allows authorized keeper bots to trigger strategy report() calls through a Safe

This contract should be enabled as a module on a Safe. It uses execTransactionFromModule to make the Safe itself call strategy.report().

Note: security-contact: [email protected]

State Variables

safe

The Safe that this module will use for execution

IGnosisSafe public immutable safe

authorizedBots

Mapping of authorized keeper bot addresses

mapping(address => bool) public authorizedBots

Functions

onlyAuthorizedBot

Restricts function calls to authorized keeper bots only

modifier onlyAuthorizedBot() ;

constructor

constructor(address _owner, address _safe) Ownable(_owner);

callStrategyReport

Triggers the Safe to call report() on the specified strategy

Can only be called by authorized keeper bots. Uses Safe's execTransactionFromModule to make the Safe itself call strategy.report(). The Safe must be set as a keeper on the strategy. If health check is enabled, it will first disable it before calling report.

function callStrategyReport(address strategy) external onlyAuthorizedBot;

Parameters

NameTypeDescription
strategyaddressAddress of the strategy to call report() on

setBotAuthorization

Authorizes or deauthorizes a keeper bot

Can only be called by contract owner

function setBotAuthorization(address bot, bool authorized) external onlyOwner;

Parameters

NameTypeDescription
botaddressAddress of the bot to authorize/deauthorize
authorizedboolWhether the bot should be authorized

setBotAuthorizationBatch

Batch authorize/deauthorize multiple bots

Can only be called by contract owner

function setBotAuthorizationBatch(address[] calldata bots, bool[] calldata authorized) external onlyOwner;

Parameters

NameTypeDescription
botsaddress[]Array of bot addresses
authorizedbool[]Array of authorization statuses (must match bots array length)

isBotAuthorized

Check if an address is an authorized bot

function isBotAuthorized(address bot) external view returns (bool);

Parameters

NameTypeDescription
botaddressAddress to check

Returns

NameTypeDescription
<none>boolWhether the address is authorized

Events

BotAuthorized

event BotAuthorized(address indexed bot, bool authorized);

StrategyReportCalled

event StrategyReportCalled(address indexed strategy, address indexed bot);

SafeSet

event SafeSet(address indexed safe);

Errors

KeeperBotGuard__NotAuthorizedBot

error KeeperBotGuard__NotAuthorizedBot();

KeeperBotGuard__InvalidStrategy

error KeeperBotGuard__InvalidStrategy();

KeeperBotGuard__InvalidSafe

error KeeperBotGuard__InvalidSafe();

KeeperBotGuard__ModuleTransactionFailed

error KeeperBotGuard__ModuleTransactionFailed();