一篇简单的 solidity 合约代码
文章目录
- 前言
- 代码
- 中文详细解析
前言
solidity 是编写智能合约的主流语言,分享一个快速个上手的一篇智能合约。
代码
/** 一个简单实例 */
// SPDX-License-Identifier: GPL-3.0
pragma solidity >= 0.7.0;
contract Coin {
// The keyword "public" makes variables
// accessible from other contracts
address public minter;
mapping (address => uint) public balances;
// Events allow clients to react to specific
// contract changes you declare
event Sent(address from, address to, uint amount);
// Constructor code is only run when the contract
// is created
constructor() {
minter = msg.sender;
}
// Sends an amount of newly created coins to an address
/
还没有评论,来说两句吧...