Sushi Gas Efficiency
This dashboard aims to provide insight into what transaction type requires the most gas.
Introduction
In this dashboard, we'll look at different types of transactions of Sushiswap and determine their relative gas requirements. We'll look at 7 types of transactions since 2022.
- Swapping
- Adding Liquidity
- Removing Liquidity
- Adding assets for Lending
- Removing assets for Lending
- Borrowing
- Repaying
Methodology
Three tables were used to determine the gas consumption for each type of transaction: ethereum.core.fact_event_logs
, ethereum_core.fact_transactions
and ethereum.sushi.ez_swaps
.
For each transaction type, the following steps were taken:
-
Find all transaction hashes for a given transaction type. This was done using
ethereum.sushi.ez_swaps
for swapping transactions. For the other type of transactions the tableethereum.core.fact_event_logs
was used in combination withcontract_name = 'KashiPairMediumRiskV1'
andevent_name = 'LogRepay'
for repaying transactions. For each type of transaction only theevent_name
changed. The following event names were used to find all types of transactions.-
adding liquidity:
LogAddAsset
-
removing liquidity:
LogRemoveAsset
-
adding asset for lending:
LogAddCollateral
-
removing asset for lending:
LogRemoveCollateral
-
borrowing:
LogBorrow
-
repaying:
LogRepay
-
-
Once all transactions since 2022 have been retrieved for each transaction type, the table
ethereum_core.fact_transactions
was used to find the gas and fee each transaction consumed. -
We take the average of the gas and fee used per day per transaction type.
-
Finally, we calculate the 30-day moving average per transaction type to more reliably determine the relative gas and fee consumed per transaction type.
Conclusion
- Based on the 30d moving average, adding liquidity is the most expensive and swapping the least expensive transaction in terms of gas.
- In terms of fees, adding liquidity is also the most expensive, at around 0.018 ETH. Swapping is the second most expensive transaction in terms of fees. Adding an asset for lending is the cheapest transaction in terms of fees.
We can see that the fee was extremely high at the beginning of the year. The user was paying 0.04 ETH when the ETH price was $3800. This equates to around $150 for every transaction. The fee has come down since then. We can see the same increase in fee for adding liquidity at the end of March. Why the gas and fee increased so much at the end of March is unknown.
We can see that borrowing required the most gas for a couple of months. However, since the end of March, the amount of gas required for adding liquidity has increased drastically.
In the table above we can see the latest value of the 30-day moving average of gas per transaction type since 2022. We can see that adding liquidity is the most expensive and swapping is the cheapest in terms of gas.
The fee determines the final amount of ETH users have to pay to finalize a transaction. Using this metric, we can see that adding liquidity is also the most expensive transaction in terms of fee. However, now swapping is second on the list and adding an asset for lending has the least expensive fee on average.