Payable

Functions and addresses declared as payable can receive Ether.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

contract Payable {
    // Payable address can receive Ether
    address payable public owner;

    // Payable constructor can receive Ether
    constructor() payable {
        owner = payable(msg.sender);
    }

    function deposit() external payable{
        // code here
    }
}

Last updated

Was this helpful?