frontend icon indicating copy to clipboard operation
frontend copied to clipboard

contract ABI: jump to method implementation

Open tom2drum opened this issue 1 year ago • 2 comments

It is nice to have a link next to contract method (read or write) to its actual implementation in contract source code

In theory we can achieve it by doing something like this

  1. Get the selector
  2. Find this selector in the selector switch in the raw proxy or implementation bytecode (http://blog.openzeppelin.com/deconstructing-a-solidity-contract-part-iii-the-function-selector-6a9b6886ea49)
  3. Get the source maps of the contract in whose bytecode we found the selector
  4. Using the JUMP instruction from the selector switch and source map, find the desired line in the desired file
  5. Check function name just in case

🔗 rust team issue - https://github.com/blockscout/blockscout-rs/issues/571

tom2drum avatar Jul 13 '23 21:07 tom2drum