forked from flare-foundation/developer-hub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile_contract.py
34 lines (31 loc) · 1.09 KB
/
compile_contract.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from solcx import compile_standard, install_solc
from utils import load_contract, save_compiled_contract
if __name__ == "__main__":
contract_name = "FtsoV2FeedConsumer"
contract_code = load_contract(contract_name)
# Install the solc compiler
# Versions >0.8.25 may work, but have not been tested
solc_version = "0.8.25"
install_solc(solc_version)
compiled_sol = compile_standard(
{
"language": "Solidity",
"sources": {f"{contract_name}.sol": {"content": contract_code}},
"settings": {
"outputSelection": {
"*": {
"*": [
"abi",
"metadata",
"evm.bytecode",
"evm.bytecode.sourceMap",
],
}
},
"optimizer": {"enabled": True, "runs": 200},
"evmVersion": "london",
},
},
solc_version=solc_version,
)
save_compiled_contract(contract_name, compiled_sol)