This project is a static analysis based metric calculator tool for Solidity smart contract programs. It is a Work In Progress, supporting the following metrics
Parameter | Description | Data Type |
---|---|---|
Address | The smart cotract Address on the ethereum blockchain | address (20 bytes) |
CV | Compiler Version | String |
FS | The First time the smart contract has been Seen on the blockchain | Date |
LS | The Last time the smart contract has been Seen on the blockchain | Date |
NA | Number of Asserts | Number |
NC | Number of contracts | Number |
NCL | Number of Comment Lines | Number |
NF | Number of Functions | Number |
NFM | Number of function modifiers | Number |
NM | Number of Mapping types | Number |
NP | Number of modifier Payable | Number |
NRq | Number of requires | Number |
NRv | Number of reverts | Number |
NSCL | Number of Source Code Lines | Number |
McCC | McCabe’s cyclomatic complexity | Number |
cd examples
python3 smartcontracs-from-etherscan.py
python3 metrics-from-solmet.py
python3 join_metrics.py
cd examples
jupyter notebook &
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
df = pd.read_csv('solmetant.csv', sep=';')
df.sort_values(by=['CV'], inplace=True)
df.head()
plt.figure(figsize=(20,5))
sns.swarmplot(x = 'CV',y='SLOC',data=df, size=5)
plt.show()
The parser is based on the excellent antlr4 grammar available at https://github.com/solidityj/solidity-antlr4.