External call options
Attach value and gas options to a typed external function call.
Solidity 0.8.36REPL mode
Why use this example
Use this pattern to test contract composition, external calls, events, and return values inside one reproducible run. The entry isolates external call options so its input, result, and state changes stay easy to compare.
Solidity to run
contract PayableTarget {
function deposit(uint256 bonus) external payable returns (uint256) {
return msg.value + bonus;
}
}
PayableTarget target = new PayableTarget()
target.deposit{ value: 1 ether, gas: 100000 }(2)Official Solidity reference
Compare this focused investigation with the complete language definition in the Solidity documentation.
External function callsWhat to expect
The typed call forwards 1 ether with an explicit gas allowance and returns that value plus two wei.
Continue the investigation
Change a value, add another expression, or open Inspect after the run. Accepted entries remain available to the next entry, and the clean replay keeps the complete result reproducible.
Read about calls and logs Reproducible investigation