42 lines
835 B
Solidity
42 lines
835 B
Solidity
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
pragma solidity ^0.8.11;
|
|
|
|
contract Sender{
|
|
constructor() payable {}
|
|
|
|
|
|
function balance() public view returns (uint) {
|
|
return address(this).balance;
|
|
}
|
|
|
|
function sendwithtransfer(address payable _addr) public {
|
|
_addr.transfer(1 ether);
|
|
}
|
|
|
|
function SendWithSend(address payable _addr) public returns (bool) {
|
|
bool sent = _addr.send(1 ether);
|
|
return sent;
|
|
}
|
|
|
|
function SendWithCall(address payable _addr) public returns (bool) {
|
|
(bool sent,) = _addr.call{value: 1 ether }("");
|
|
return sent;
|
|
}
|
|
}
|
|
|
|
|
|
contract Receiver{
|
|
|
|
uint public a;
|
|
uint public b;
|
|
|
|
receive() external payable{
|
|
a = 10;
|
|
b = 9;
|
|
}
|
|
|
|
function balance() public view returns (uint) {
|
|
return address(this).balance;
|
|
}
|
|
}
|