Hi starmyc,
Thanks for helping to sort out this equation, which I find really interesting.
I have found that etherscan.io actually hold information about the solidity source code of each contract. However I don't really know if this information is the actual code before being compiled to bytecode, or if it's a simple reconstruction of the code using a decompiler, which isn't the same for my goal.
https://etherscan.io/address/0xa701122c1b67220a8b6883d03c8ad67896b12466#codeSeems like etherscan.io has an API as well, which is available here:
https://etherscan.io/apisHowever it's limited to 5 requests per second, and the options are quite limited, hence it will probably take an ethernity to clone all desired information.
I have found that it's possible to get closer to the goal, using geth, and then processing the data, moreover, I have been recommended to use QuickBlocks (
https://quickblocks.io/) which is mostly based on C++ and seems to work quite fast.
Yet, the code is compiled and I'm not yet aware of any pre-coded function that allows to clone each smart contract into a db (even the compiled version).
I've found as well that it's possible to decompile the code, at least partially using comaeio/porosity (
https://github.com/comaeio/porosity) which makes a quick replacement based on the detected expressions. As following:
- Hash: 0x0A19B14A (trade) (1 references)
- Hash: 0x0B927666 (order) (1 references)
- Hash: 0x19774D43 (orderFills) (1 references)
- Hash: 0x278B8C0E (cancelOrder) (1 references)
- Hash: 0x2E1A7D4D (withdraw) (1 references)
- Hash: 0x338B5DEA (depositToken) (1 references)
- Hash: 0x46BE96C3 (amountFilled) (1 references)
- Hash: 0x508493BC (tokens) (1 references)
- Hash: 0x54D03B5C (changeFeeMake) (1 references)
- Hash: 0x57786394 (feeMake) (1 references)
- Hash: 0x5E1D7AE4 (changeFeeRebate) (1 references)
- Hash: 0x65E17C9D (feeAccount) (1 references)
- Hash: 0x6C86888B (testTrade) (1 references)
- Hash: 0x71FFCB16 (changeFeeAccount) (1 references)
- Hash: 0x731C2F81 (feeRebate) (1 references)
- Hash: 0x8823A9C0 (changeFeeTake) (1 references)
- Hash: 0x8F283970 (changeAdmin) (1 references)
- Hash: 0x9E281A98 (withdrawToken) (1 references)
- Hash: 0xBB5F4629 (orders) (1 references)
- Hash: 0xC281309E (feeTake) (1 references)
- Hash: 0xD0E30DB0 (deposit) (1 references)
- Hash: 0xE8F6BC2E (changeAccountLevelsAddr) (1 references)
- Hash: 0xF3412942 (accountLevelsAddr) (1 references)
- Hash: 0xF7888AEC (balanceOf) (1 references)
- Hash: 0xF851A440 (admin) (1 references)
- Hash: 0xFB6E155F (availableVolume) (1 references)
I'm still wondering exactly which functions or which modifications might be required to make QuickBlocks store the desired information into BigQuery or MongoDB.
The idea seems possible, however not simple to achieve.