github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/internal/abis/README.md (about) 1 ## chifra abis 2 3 The `chifra abis` tool retrieves one or more ABI files for the given address(es). It searches 4 for ABIs, sequentially, in the following locations: 5 6 - the current working folder, 7 - the TrueBlocks local cache, 8 - Etherscan, 9 - (in the future) ENS and Sourcify. 10 11 While this tool may be used from the command line, its primary purpose is in support of 12 the `--articulate` option for tools such as `chifra export` and `chifra logs`. 13 14 If possible, the tool will follow proxied addresses searching for the ABI, but that does not 15 always work. In that case, you may use the `--proxy_for` option. 16 17 The `--known` option prints a list of semi-standard function signatures such as the ERC20 standard, 18 ERC 721 standard, various functions from OpenZeppelin, various Uniswap functions, etc. As an 19 optimization, the `known` signatures are searched first during articulation. 20 21 The `--encode` option generates a 32-byte encoding for a given cannonical function or event signature. For 22 functions, you may manually extract the first four bytes of the hash. 23 24 The `--find` option is experimental. Please see the notes below for more information. 25 26 ```[plaintext] 27 Purpose: 28 Fetches the ABI for a smart contract. 29 30 Usage: 31 chifra abis [flags] <address> [address...] 32 33 Arguments: 34 addrs - a list of one or more smart contracts whose ABIs to display (required) 35 36 Flags: 37 -k, --known load common 'known' ABIs from cache 38 -r, --proxy_for string redirects the query to this implementation 39 -l, --list a list of downloaded abi files 40 -c, --count show the number of abis downloaded 41 -f, --find strings search for function or event declarations given a four- or 32-byte code(s) 42 -n, --hint strings for the --find option only, provide hints to speed up the search 43 -e, --encode string generate the 32-byte encoding for a given cannonical function or event signature 44 -o, --cache force the results of the query into the cache 45 -D, --decache removes related items from the cache 46 -x, --fmt string export format, one of [none|json*|txt|csv] 47 -v, --verbose enable verbose output 48 -h, --help display this help screen 49 50 Notes: 51 - Search for either four byte signatures or event signatures with the --find option. 52 ``` 53 54 Data models produced by this tool: 55 56 - [abi](/data-model/other/#abi) 57 - [function](/data-model/other/#function) 58 - [parameter](/data-model/other/#parameter) 59 60 ### further information 61 62 Without the --verbose option, the result is a compacted form of the ABI. Add --verbose for full details. 63 64 The `chifra abis --find` option scans the cross product of two sets. The first set contains more than 100,000 function and event 65 names. The second set contains approximately 700 function signatures. The cross product of these two sets creates 70,000,000 66 combinations of name(signature) each of which is hashed to create either a four-byte or a 32-byte hash. Very infrequently, 67 the tool will find matches for an otherwise unknown signatures. 68 69 ### Other Options 70 71 All tools accept the following additional flags, although in some cases, they have no meaning. 72 73 ```[plaintext] 74 -v, --version display the current version of the tool 75 --output string write the results to file 'fn' and return the filename 76 --append for --output command only append to instead of replace contents of file 77 --file string specify multiple sets of command line options in a file 78 ``` 79 80 **Note:** For the `--file string` option, you may place a series of valid command lines in a file using any 81 valid flags. In some cases, this may significantly improve performance. A semi-colon at the start 82 of any line makes it a comment. 83 84 **Note:** If you use `--output --append` option and at the same time the `--file` option, you may not switch 85 export formats in the command file. For example, a command file with two different commands, one with `--fmt csv` 86 and the other with `--fmt json` will produce both invalid CSV and invalid JSON. 87 88 *Copyright (c) 2024, TrueBlocks, LLC. All rights reserved. Generated with goMaker.*