Skip to content

Instantly share code, notes, and snippets.

@k1rill-fedoseev
Created September 21, 2020 14:36
Show Gist options
  • Select an option

  • Save k1rill-fedoseev/52f460bfc8e41ad7b7a6d0d9d90ff91c to your computer and use it in GitHub Desktop.

Select an option

Save k1rill-fedoseev/52f460bfc8e41ad7b7a6d0d9d90ff91c to your computer and use it in GitHub Desktop.
pragma solidity 0.4.24;
contract Test {
uint256 public x;
function dummy() external {
for (uint256 i = 0; i < 1000; i++) {
x = i;
}
}
}
contract Caller {
event Status(bool status);
// call with 2000000 gas - status == true
// call with 890000 gas - status == false
function call(address _contract) external {
emit Status(_contract.call.gas(1000000)(abi.encodeWithSelector(Test(this).dummy.selector)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment