0

Say I have an internal contract which returns a uint256 variable which is 1.

Internal Function (some input) returns (1)

This internal function is called by a public function. Is there any way to intercept the internal transaction call and see what data is being returned specifically for that transaction? Or is it a case of being specific to temporary memory where once retrieved, the data is more or less "burned."

1 Answer 1

0

That design (i.e. a public function that calls a private function) is pretty commun since private function uses less gas than public.

I'm not sure what you mean by intercept the internal transaction call tho... Can you explain?

If you want to see what the internal function returns then just do

function myInternalFunction(some input) internal returns(uint) {
     //Here do whatever you need
    return (results);
}
function myPublicFunction(some input) public returns(uint) {
    return myInternalFunction(some input);
}
2
  • It is possible to clone a solidity contract and view in-between contract calls (data being passed back and forth), I'm wondering if I clone a contract's bytecode and launch privately on my own network if I can see what an internal function returns to a public function simply through bytecode alone. Nov 30, 2022 at 8:53
  • Well you can use Forge/Foundry as a test tool. When you run the test, you can ask to see every traces from your contract call. See this. Hope this helps! Nov 30, 2022 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.