Relayer

The Relayer contract is a core component of the Mimic protocol, responsible for executing automated tasks on behalf of users in a trustless and efficient manner. It acts as an intermediary between the users and the tasks they set up within Mimic. The Relayer contract ensures that tasks are executed accurately and securely, providing a seamless experience for users.

The contract code of the Relayer can be found here.

Functionality

Execute

This function enables Mimic relayers to execute tasks on behalf of users. However, it is essential to emphasize that users must grant permission to Mimic relayers through their Authorizer in order to enable the automatic execution of their tasks.

It is crucial to understand that users have control over the tasks executed by relayers. By managing the permissions in their Authorizer contract, users can specify which tasks can be executed and by which relayers. This level of control empowers users to automate their DeFi operations while maintaining security and trust in the Mimic protocol.

/**
 * @dev Executes a task
 * @param task Address of the task to execute
 * @param data Calldata to execute on the given task
 */
function execute(address task, bytes calldata data) external;

Deposit

This function serves a crucial role in the Relayer contract by allowing users to deposit native tokens. These deposited tokens are then utilized by Mimic relayers to cover the gas costs associated with executing the users' tasks.

/**
 * @dev Deposits native tokens for a given smart vault
 * @param smartVault Address of smart vault to deposit balance for
 * @param amount Amount of native tokens to be deposited, must match msg.value
 */
function deposit(address smartVault, uint256 amount) external payable;

Mimic offers some standard tasks designed to ensure that users do no run out of deposited balance required for executing their tasks automatically. Note that it is important for users to maintain a sufficient balance of native tokens in the Relayer contract to ensure the smooth execution of their tasks.

Withdraw

This function basically allows users to withdraw their deposited balance at any point in time:

/**
 * @dev Withdraws native tokens from a given smart vault
 * @param amount Amount of native tokens to be withdrawn
 */
function withdraw(uint256 amount) external;

Last updated