美文网首页
Solidity: unnamed payable functi

Solidity: unnamed payable functi

作者: susupp | 来源:发表于2018-08-02 10:20 被阅读0次

    Remember the unnamed default public payable function in our Faucet.sol code? It looked like this:

    function () public payable {}
    

    When you sent a transaction to the contract address, with no data specifying which function to call, it called this default function. Because we declared it as a payable, it accepted and deposited the 1 ether into the contract account balance. Your transaction caused the contract to run in the EVM, updating its balance. We have funded our faucet!

    相关文章

      网友评论

          本文标题:Solidity: unnamed payable functi

          本文链接:https://www.haomeiwen.com/subject/fnljvftx.html