2020-03-09 21:14:07 +00:00
|
|
|
contract helper {
|
|
|
|
function getBalance() public payable returns (uint256 myBalance) {
|
|
|
|
return address(this).balance;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
contract test {
|
|
|
|
helper h;
|
|
|
|
|
2020-06-23 12:14:24 +00:00
|
|
|
constructor() payable {
|
2020-03-09 21:14:07 +00:00
|
|
|
h = new helper();
|
|
|
|
}
|
|
|
|
|
|
|
|
function sendAmount(uint256 amount) public returns (uint256 bal) {
|
2020-04-03 14:29:17 +00:00
|
|
|
return h.getBalance{value: amount + 3, gas: 1000}();
|
2020-03-09 21:14:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-19 13:12:56 +00:00
|
|
|
// ====
|
|
|
|
// compileViaYul: also
|
2020-03-09 21:14:07 +00:00
|
|
|
// ----
|
|
|
|
// constructor(), 20 wei ->
|
|
|
|
// sendAmount(uint256): 5 -> 8
|