42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
import logging
|
|
import pandas as pd
|
|
import matplotlib.pyplot as plt
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
# Initialize a DataFrame with max gas values for each function across different pool sizes
|
|
# Row index: number of assets in the pool
|
|
# Columns: function names
|
|
# Cell values: max gas values
|
|
|
|
gas_data = {
|
|
'allTokens': [7489, 25754, 48587, 117095, 231306],
|
|
'balanceOf': [2806, 2806, 2806, 2806, 2806],
|
|
'burn': [121374, 388107, 721563, 1722086, 3390257],
|
|
'burnSwap': [129791, 410564, 758861, 1799954, 3560756],
|
|
'mint': [149100, 425896, 771933, 1810329, 3541934],
|
|
'swap': [145931, 156792, 171186, 213066, 283078],
|
|
'swapMint': [429036, 2612211, 5339543, 13644860, 27527806]
|
|
}
|
|
|
|
# Create DataFrame with row indices as the number of assets in the pool
|
|
gas_df = pd.DataFrame(gas_data, index=[2, 10, 20, 50, 100])
|
|
gas_df.index.name = 'Assets in Pool'
|
|
|
|
# Print the DataFrame
|
|
gas_df['swap'].plot(xticks=gas_df.index)
|
|
plt.ylim(140_000, 300_000)
|
|
plt.title('Swap Gas Cost')
|
|
plt.show()
|
|
|
|
gas_df[['mint', 'burn']].plot(xticks=gas_df.index)
|
|
plt.ylim(40_000, 4_000_000)
|
|
plt.title('Mint/Burn Gas Cost')
|
|
plt.show()
|
|
|
|
gas_df[['swapMint', 'burnSwap']].div(1_000_000).plot(xticks=gas_df.index)
|
|
plt.title('SwapMint/BurnSwap Gas Cost')
|
|
plt.ylim(0, 30)
|
|
plt.ylabel('Gas Cost (millions)')
|
|
plt.show()
|