Solidity gyakorlatozgatások
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

41 lines
835 B

// 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;
}
}