Mimic provides a relaying mechanism that enables users to automate task execution in a trustless manner. While Mimic’s Relayers handle the execution, individual users are responsible for covering the associated gas costs. This document is intended to explain the seamless process through which gas payments are managed, relieving users of the need to handle it themselves.
How it works?
The tasks to be executed in order to pay transaction gas depend on:
Whether the tokens are in the smart vault or somewhere else
Which token will be used to cover the gas costs
The following diagram represents the process of depositing tokens into the Relayer:
Process of depositing tokens into the relayer
The Relayer only accepts native token deposits. Therefore, if you would like to use another token than the native token to pay for a transaction gas, you will have to set up some tasks to make sure your assets are properly swapped and deposited into the Relayer to cover you gas costs.
If the tokens you're willing to use to cover you gas costs are already in the smart vault, then there are three possible scenarios:
If you have nativetokens in your smart vault, then you can deposit those directly into the Relayer. In order to do so you can use the DepositorRelayerFunder task.
If you have wrappednativetokens in your smart vault, then you will need to unwrap these before depositing them, which means you can use the UnwrapperRelayerFunder task along with the RelayerDepositor task.
If you have anothertoken in your smart vault, then you will need to use a swapper task (e.g. OneInchV5RelayerFunder) along with the Unwrapper and the RelayerDepositor tasks.
But, if your willing to use tokens held outside of the smart vault in order to cover your transactions gas costs, you will need first to set up a CollectorRelayerFunder task. This task will be in charge of moving funds to smart vault in order to continue with the rest of the paying process.