TransferSendCall fájl update
parent
6970cecf58
commit
e1eb6c3928
|
@ -1 +1,41 @@
|
|||
Ez egy demo
|
||||
// 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 = 9;
|
||||
b = 10;
|
||||
}
|
||||
|
||||
function balance() public view returns (uint) {
|
||||
return address(this).balance;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue