current position:Home>How to use the keyword "solid payable"?

How to use the keyword "solid payable"?

2022-02-03 20:51:49 Q & A of Denglian community

pragma solidity ^0.4.0;contract PayTest {    function getBalance() returns (uint){        return this.balance;    }    function deposit() payable returns (address addr,uint amount,bool success){        return (msg.sender,msg.value,this.send(msg.value));    }}

added payable Deposit with the current contract , But I didn't see the amount paid to the contract address ? This is an example I found online

Take the answer 1:

When a function is payable modification , Indicates that when this function is called , You can send some additional ETH( Of course not ).

No addition payable Function of , There is no way to accept ETH, additional ETH The call will go wrong .

copyright notice
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.

Random recommended