web3是一种观点,指的是以区块链和智能合约【l8l-案例259l-系统3365微電】为基础的下一代网络。相比于中心化服务器,去中心化网络运行着你的逻辑。智能合约可以允许你创建无需审核的合同和逻辑。
web1指的是一个有着固定内容的非许可的开源网络
web2是指的是一个有着动态内容的许可网络,你所有的逻辑和协议运行在中心化的服务器上,这些中心化的服务器控制着你的信息。
Fail as early and loudly as possible Favor pull over push payments Order your function code: conditions, actions, interactions Be aware of platform limits Write tests Fault tolerance and Automatic bug bounties Limit the amount of funds deposited Write simple and modular code Don’t write all your code from scratch Timestamp dependency: Do not use timestamps in critical parts of the code, because miners can manipulate them Call stack depth limit: Don’t use recursion, and be aware that any call can fail if stack depth limit is reached Reentrancy: Do not perform external calls in contracts. If you do, ensure that they are the very last thing you do
//SPDX-License-Identifier: SimPL-2.0 pragma solidity >=0.7.0 <0.8.9;
contract zhongchou{ //投资者投资记录:投资目标,投资金额
struct toMoney{ address payable addressReceiptor; uint money; } //投资者基本信息:地址,是否被激活,总投资金额,投资次数,映射记录投资记录 struct funder{ address payable addressfunder; bool isActive; uint totalMoney; uint numberGive; mapping(uint=>toMoney)expMap; } //众筹合约:合约创建者,是否被激活,金额总需求,已投资金额,投资人数量,映射记录投资人 struct needMoneyContract{ address payable addressNeeder; // payable address addressContract; bool isActive; uint totalMoney; uint giveMoney; uint amountFunder; mapping (uint=>funder)mapFunder; } //众筹发起者:地址,激活状态,需求总金额,已经被投资的金额,发起的众筹的数量,映射记录投资合约 struct needer{ address addressNeeder; bool isActive; uint amountMoneyNeed; uint amountHasFunded; uint numberContract; mapping(uint=>needMoneyContract)expMap; } //记录众筹合约总数,合约地址(资金池地址) uint amountContract; address payable public addressFinance;