一篇简单的 solidity 合约代码

男娘i 2024-02-18 10:09 100阅读 0赞

文章目录

    • 前言
    • 代码
    • 中文详细解析

前言

solidity 是编写智能合约的主流语言,分享一个快速个上手的一篇智能合约。

代码

  1. /** 一个简单实例 */
  2. // SPDX-License-Identifier: GPL-3.0
  3. pragma solidity >= 0.7.0;
  4. contract Coin {
  5. // The keyword "public" makes variables
  6. // accessible from other contracts
  7. address public minter;
  8. mapping (address => uint) public balances;
  9. // Events allow clients to react to specific
  10. // contract changes you declare
  11. event Sent(address from, address to, uint amount);
  12. // Constructor code is only run when the contract
  13. // is created
  14. constructor() {
  15. minter = msg.sender;
  16. }
  17. // Sends an amount of newly created coins to an address
  18. /

发表评论

表情:
评论列表 (有 0 条评论,100人围观)

还没有评论,来说两句吧...

相关阅读