MCPcopy Create free account
hub / github.com/ChainSafe/Delorean-Protocol / main

Function main

contracts/scripts/python/build_selector_library.py:67–118  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65 return "" + enc.hex()
66
67def main():
68 contract_selectors = {}
69 filepaths_to_target = [
70 'src/GatewayDiamond.sol',
71 'src/SubnetActorDiamond.sol',
72 'src/SubnetRegistryDiamond.sol',
73 'src/OwnershipFacet.sol',
74 'src/diamond/DiamondCutFacet.sol',
75 'src/diamond/DiamondLoupeFacet.sol',
76 'src/gateway/GatewayGetterFacet.sol',
77 'src/gateway/GatewayManagerFacet.sol',
78 'src/gateway/GatewayMessengerFacet.sol',
79 'src/gateway/router/CheckpointingFacet.sol',
80 'src/gateway/router/TopDownFinalityFacet.sol',
81 'src/gateway/router/XnetMessagingFacet.sol',
82 'src/subnet/SubnetActorGetterFacet.sol',
83 'src/subnet/SubnetActorManagerFacet.sol',
84 'src/subnet/SubnetActorPauseFacet.sol',
85 'src/subnet/SubnetActorRewardFacet.sol',
86 'src/subnet/SubnetActorCheckpointingFacet.sol',
87 'src/subnetregistry/RegisterSubnetFacet.sol',
88 'src/subnetregistry/SubnetGetterFacet.sol',
89 'test/helpers/ERC20PresetFixedSupply.sol',
90 'test/helpers/NumberContractFacetEight.sol',
91 'test/helpers/NumberContractFacetSeven.sol',
92 'test/helpers/SelectorLibrary.sol',
93 'test/helpers/TestUtils.sol',
94 'test/mocks/SubnetActorMock.sol',
95 ]
96
97 for filepath in filepaths_to_target:
98
99 # Extract just the contract name (without path and .sol extension)
100 contract_name = os.path.splitext(os.path.basename(filepath))[0]
101
102 #skip lib or interfaces
103 if contract_name.startswith("Lib") or contract_name.startswith("I") or contract_name.endswith("Helper"):
104 continue
105
106 # Format full path
107 # Call get_selectors for each contract
108 try:
109 selectors = get_selectors(filepath + ':' + contract_name)
110 if selectors:
111 contract_selectors[contract_name] = selectors
112 except Exception as oops:
113 print(f"Error processing {filepath}: {oops}")
114
115
116 # Print the final JSON
117 solidity_library_code = generate_solidity_function(contract_selectors)
118 writeToFile(solidity_library_code)
119
120if __name__ == "__main__":
121 main()

Callers 1

Calls 3

get_selectorsFunction · 0.85
writeToFileFunction · 0.85

Tested by

no test coverage detected