去中心化应用(Dapp)一般是指运行在分布式网络上,参与者的信息被安全保护(也可能是匿名的),通过网络节点不同人,进行去中心化操作的应用。从以太坊角度来说它是一个交易协议,根据区块链上设定的条件来执行的一个合约或者一组合约系统開发180-383I-97Z4。
ragma solidity ^0.8.0;
contract SimpleStorage {
uint public storedData;
address public owner=0x5B38Da6a701c568545dCfcB03FcB875f56beddC4;
uint256 public money;
address public thisAddress=address(this);
address public thisAddress2=msg.sender;
uint public etherTest=1 gwei;
mapping(address => uint256) public balances;
event Set(uint x);//事件
enum State { Created, Locked, InValid } // 枚举
State public state;
modifier onlyOwner(){
require(owner == msg.sender,"only owner can call this function");
_;
}
struct Voter { // 结构体
uint weight;
bool voted;
}
Voter[] public voter;
function set(uint x) public onlyOwner {
storedData = x; // 错误的,多加了一个加号
emit Set(storedData);
}
function setState(State _state) public{
state=_state;
}
function f(uint len) public pure {
uint[] memory a = new uint[](7);
bytes memory b = new bytes(len);
assert(a.length == 7);
assert(b.length == len);
a[6] = 8;
}
function setVoter( uint _weight,bool _voted) public {
voter.push(Voter(_weight,_voted));
}
function bal() public view returns(uint){//返回余额
return msg.sender.balance;
}
function testPure(uint x) public pure returns(uint){//纯
return x*2;
}
function buy() public payable{
assert(msg.value>0);//必须大于0,不然不执行下面的
money =msg.value;
}
function mint(address account,uint256 amount) public onlyOwner{//铸币,当前账号才有权限
balances[account] = amount;由系统开发对接威:lovei130908编辑整理发布
}
}
行业标签:
阿凡达泰山众筹平台开发(模式搭建)网商汇-中国免费发布信息平台、优秀B2B电子商务网站,汇集海量免费企业黄页信息、供求信息,企业可以免费发布信息、免费发布供求信息、免费发布求购信息。网商汇免费发布信息网是帮助企业网络销售产品、免费发布信息、免费刊登黄页、免费网站推广的首选免费信息发布平台,而且各地区有分站,推荐北京免费发布信息、上海免费发布信息、广州免费发布信息。