DAPP互助公排智慧合約矩陣模式系統開發詳情分析

Lyr96246466發表於2023-04-27

 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;


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70012429/viewspace-2949252/,如需轉載,請註明出處,否則將追究法律責任。

相關文章