Payable
Payable Function
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.1;
contract SendMoneyExample {
uint public balanceReceived;
function receiveMoney() public payable {
balancedReceived += msg.value; //msg: global always-existing object
}
}Calling payable functions
targetAddress.someFunction{ value: amount }(arg1, arg2, arg3)Payable Address
Built-in methods
Problems with send() and transfer()
call()
A simple call-statement looks like that:
A practical implementation
Function call
Last updated