Skip to content

Commit 41cca82

Browse files
committed
Initial commit
0 parents  commit 41cca82

File tree

3 files changed

+182
-0
lines changed

3 files changed

+182
-0
lines changed

.gitignore

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
.hypothesis/
51+
.pytest_cache/
52+
53+
# Translations
54+
*.mo
55+
*.pot
56+
57+
# Django stuff:
58+
*.log
59+
local_settings.py
60+
db.sqlite3
61+
db.sqlite3-journal
62+
63+
# Flask stuff:
64+
instance/
65+
.webassets-cache
66+
67+
# Scrapy stuff:
68+
.scrapy
69+
70+
# Sphinx documentation
71+
docs/_build/
72+
73+
# PyBuilder
74+
target/
75+
76+
# Jupyter Notebook
77+
.ipynb_checkpoints
78+
79+
# IPython
80+
profile_default/
81+
ipython_config.py
82+
83+
# pyenv
84+
.python-version
85+
86+
# pipenv
87+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
88+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
89+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
90+
# install all needed dependencies.
91+
#Pipfile.lock
92+
93+
# celery beat schedule file
94+
celerybeat-schedule
95+
96+
# SageMath parsed files
97+
*.sage.py
98+
99+
# Environments
100+
.env
101+
.venv
102+
env/
103+
venv/
104+
ENV/
105+
env.bak/
106+
venv.bak/
107+
108+
# Spyder project settings
109+
.spyderproject
110+
.spyproject
111+
112+
# Rope project settings
113+
.ropeproject
114+
115+
# mkdocs documentation
116+
/site
117+
118+
# mypy
119+
.mypy_cache/
120+
.dmypy.json
121+
dmypy.json
122+
123+
# Pyre type checker
124+
.pyre/

LICENSE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
The MIT License (MIT)
3+
4+
Copyright (c) 2025 Kai
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Quick solc
2+
The qsolc.py Python script creates a standard-JSON compiler input based on the provided input flags (see `python qsolc.py --help`). Then, it runs solc on the created compiler input. You can save the output to a file by using the `--output` flag. If no output flag is given, the result will be printed to the standard output. You can observe the generated compiler_input.json by setting the `--debug` flag. It will generate a compiler_input.json.
3+
4+
You provide compiler input flags as key-value parameters. Use "\\." to escape "." (dot). For instance the following key-value pair is used to define the source contract: `sources.example/BeerBar\.sol.urls[0]='example/BeerBar.sol'`.
5+
Which will be translated to:
6+
```json
7+
{
8+
"sources": {
9+
"example/BeerBar.sol": {
10+
"urls": ["example/BeerBar.sol"]
11+
}
12+
}
13+
}
14+
```
15+
Follow this scheme to set any arbritrary parameter for the compiler input. Refer to the solidity documentation for further information about [Input Description](https://docs.soliditylang.org/en/latest/using-the-compiler.html#input-description).
16+
17+
Note: This implementation of qsolc is slightly modified. It already sets the required input variables to create a valid output.json needed to run the solidity_address_mapper, such as useLiteralContent and outputSelection.
18+
19+
## Complete Example
20+
After you installed the library contracts for the example BeerBar.sol using `npm i @openzeppelin/contracts` <ins>in the example folder</ins>, you can run qsolc.py from the "workdir/quick-solc" folder as follows:
21+
22+
```bash
23+
python .\qsolc.py
24+
settings.remappings[0]='./=example/'
25+
settings.remappings[1]='@openzeppelin/=example/node_modules/@openzeppelin/'
26+
sources.example/BeerBar\.sol.urls[0]='example/BeerBar.sol'
27+
```
28+
29+
30+
Note: The name of the contract source will be changed from "Beerbar.sol" to "example/Beerbar.sol." If you don't want this, you have to move qsolc.py into the "example" folder and run it like this:
31+
```bash
32+
python .\qsolc.py
33+
settings.remappings[0]='@openzeppelin/=node_modules/@openzeppelin/'
34+
sources.BeerBar\.sol.urls[0]='BeerBar.sol'
35+
```
36+
Refer to the solidity documentation for further information about [Base Path and Import Remapping](https://docs.soliditylang.org/en/latest/using-the-compiler.html#base-path-and-import-remapping).

0 commit comments

Comments
 (0)