智能合约;水龙头合约()
发布时间
阅读量:
阅读量
初学智能合约不久便觉得这门技术非常有趣且富有挑战性。
未来计划将自己撰写的各类合同样进行详细记录并定期更新。
欢迎交流讨论。
以本项目的为例说明一下:
确保里面包含有eth,
每次调用智能合约后都会提取一笔eth,
我们将其命名为水流源合同。
pragma solidity >=0.4.22;
contract Faucet{
function withdraw(uint amount) public payable{
//amount 需要小于等于1
require(amount<=1);
// 向msg.sender发送amount数量的eth
msg.sender.transfer(amount);
}
function() public payable{}
}
全部评论 (0)
还没有任何评论哟~
