Skip to content

Instantly share code, notes, and snippets.

@CJ42
Last active July 26, 2022 17:37
Show Gist options
  • Select an option

  • Save CJ42/87d0a8cd8cee49bcc5eb7d2089406d21 to your computer and use it in GitHub Desktop.

Select an option

Save CJ42/87d0a8cd8cee49bcc5eb7d2089406d21 to your computer and use it in GitHub Desktop.
Run this example in Remix + debug it to show that memory is erased between function calls
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Source {
Target target;
constructor(Target _target) {
target = _target;
}
function callTarget() public {
target.doSomething();
}
}
contract Target {
function doSomething() public {
// do whatever
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment