This GitHub repository entails the source code and files developed for the evaluation and analysis of the Deferral solution, which is part of the Master's Thesis of Tobias Boner at the University of Zurich in 2022/2023.
The Deferral main repository contains all other source files and code concerning the solution of the thesis.
This repository contains Python and other scripts that are used to analyze and evaluate the results.
Follow the instructions below to set up a virtual environment and install the required dependencies.
- Python 3.x
- pip (included with Python 3.4 and later)
Be aware that file paths differ between Windows and Mac & Linux due to their differing syntax. Hence, this can lead to errors in the code and scripts when using Windows. Therefore it is recommended to use Mac or Linux.
- Clone this repository:
git clone https://github.com/dydent/visualizations-deferral
Ensure this repository is included and located in the root folder of the Deferral main repository. To set up the main repository, follow the instructions in the corresponding README file.
This repository can also be located in a different folder. However, the file and folder paths used in the code must then be adjusted.
-
Open a terminal/command prompt and navigate to the project directory.
-
Run the following command to create a virtual environment:
- For Linux and macOS:
python3 -m venv myenv
- For Windows:
py -m venv myenv
Replace
myenv
with the desired name for your virtual environment directory. - For Linux and macOS:
-
Activate the virtual environment:
- For Linux and macOS:
source myenv/bin/activate
- For Windows:
myenv\Scripts\activate.bat
Make sure to replace
myenv
with the name of your virtual environment directory. - For Linux and macOS:
With the virtual environment activated, run the following command to install the required packages from
the requirements.txt
file:
pip install -r requirements.txt
It is necessary to create a local .env
file containing key-value pairs of environment variables the project requires.
The .env.example
file shows examples of all the values that must be set up and includes explanations for the different values.
Once you've set up the virtual environment and installed the dependencies, you can run the Python scripts in the project.
For example, if there's a script called main.py in the project, you can run it using the following command:
python script.py
Replace script.py with the name of the script you want to run.
Additionally, the generate_visualization_results.sh
shell script can be run to execute all visualization scripts at once by running .\generate_visualization_results.sh
in the terminal.
All the generated visualization and visualization result files are stored locally in the visualization-result-files
directory.
The result folder structure looks like this:
- historical/ contains results related to historical gas and fiat prices
- overall/ contains results for the overall view across all contracts
- referral-multilevel-token-rewards/ contains contract-specific evaluation results grouped by the contracts
- referral-payment-multilevel-rewards/ contains contract-specific evaluation results grouped by the contracts
- referral-payment-quantity/ contains contract-specific evaluation results grouped by the contracts
- referral-payment-transmitter/ contains contract-specific evaluation results grouped by the contracts
- referral-payment-value/ contains contract-specific evaluation results grouped by the contracts