A $0.10 fee per tx on Polygon, and a dynamic fee per tx is added on Optimism, is added to each transaction* and paid with existing USDC tokens. You DO NOT need any native (MATIC/ETH) tokens to deposit, transfer, or withdraw from zkBob.
Fees cover the cost of transactions in most situations (see below) and can result in a surplus depending on gas and token prices. USDC (or other pool token) accumulates with the fee receiver and is periodically withdrawn, swapped for native tokens, and sent to the relayer to subsidize future transaction costs. Relayers do not keep any profits from extra fees - all collected fees are used to support the protocol.
Exact tx fees are calculated as the cost of the
calldatafor an operation (deposit, transfer, withdrawal) multiplied by the gas price and the token price. Tx gas examples:
To calculate a baseline for any operation, we take the highest gas cost (deposit) + 15% buffer = 902,000 gas.
Max Fee baseline =
902,000 * gas price * token price
Fees can vary significantly based on the gas price and token price at the time of a transaction. In this table, the top row shows example USD equivalent token prices ($0.35 to $1.05) and the left column shows varying gas costs ranging from 30 to 100 Gwei. These are multiplied with 902,000 to calculate the cost for a max transaction.
Fees are currently collected internally within the pool contract and the
accumulatedFeemethod. They can be manually withdrawn by a separate operator account (a specified account called the fee recipient) rather than a primary relayer account. This maintains safety in the protocol as a primary relayer is responsible for sending transactions and should not have the ability to call the
Once enough USDC has accumulated, it can be withdrawn and swapped for native (MATIC/ETH) tokens. These are then sent to the primary relayer to cover gas fees for future operations.
Anyone can view current fees accumulated by the protocol. This does not represent all fees collected, but only those accumulated since the previous withdrawal.