mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			516 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			516 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
| contract helper {
 | |
|     function getBalance() public payable returns (uint256 myBalance) {
 | |
|         return address(this).balance;
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 | |
| contract test {
 | |
|     helper h;
 | |
| 
 | |
|     constructor() payable {
 | |
|         h = new helper();
 | |
|     }
 | |
| 
 | |
|     function sendAmount(uint256 amount) public returns (uint256 bal) {
 | |
|         return h.getBalance{value: amount + 3, gas: 1000}();
 | |
|     }
 | |
| }
 | |
| // ----
 | |
| // constructor(), 20 wei ->
 | |
| // gas irOptimized: 173271
 | |
| // gas legacy: 253820
 | |
| // gas legacyOptimized: 180784
 | |
| // sendAmount(uint256): 5 -> 8
 |