Forsage matrix system development|Forsage smart contract matrix construction

Smart contract is a new technology that can only be realized through blockchain. Ordinary, standard contracts cover the terms of agreements between the parties and are often enforced by law; smart contracts are digital, stored in the blockchain, and use encrypted codes to enforce the agreement.
In other words, smart contracts are just software programs, and like all programs, they execute exactly as the programmer intended. Smart contracts are like programming applications: "Once they appear, execute them."
Forsage is a popular MLM encryption scheme that allows users to earn Ethereum currency in the following ways with 2 matrix recommendation structures. Forage is a decentralized ecosystem based on smart contracts. Make technical settings fully available and automated, so that it can be safe and stable.
The Forsage program uses a Gifting scheme with a binary matrix structure. There are 2 types of matrix X3 matrix and X4 matrix. You can choose to ride a bicycle with anyone. To start using any matrix loop, you must pay a 0.05ETH fee (join fee), and then start referrals through your referral link.
The matrix size used in the Forsage cycler is 3×1 and 2×2. The 3×1 matrix is ​​very simple in nature, and only needs to fill in three positions. The 2×2 matrix starts from two positions on the first layer and then expands to four positions on the second layer. Positions are filled through direct and indirect recruitment of Forsage members. Once all positions in the matrix are filled, the recurring commission is activated. A new matrix of the same size will also be entered at the position from the matrix.
This smart contract is also known as the Ethereum blockchain matrix project and should provide any participant with "the ability to directly conduct personal and commercial transactions." The website itself is (at most) vague, trying to lure others into the cryptocurrency field with the known terms of this digital asset and blockchain technology. More or less, it seems to be better understood than the use of these terms implies.
The smart contract of the distributed global shared matrix project is public and can always be viewed on the Ethereum blockchain.
Analysis of the advantages of DAPP smart contracts
1. Can not be tampered with
Forsage deployed a self-executing smart contract on the Ethereum blockchain. The contract exists forever and can never be modified by anyone. Indefinite access is an inherent feature of programming in smart contracts to enable continuous participation in matrix projects.
2. Decentralized peer-to-peer on-chain payment
is a smart contract payment gateway that can facilitate peer-to-peer commission payments between participants in its plan, and 100% directly into the participants' decentralized wallets.
3. Autonomy
A crowdfunding decentralized matrix project, specifically designed to stimulate the global repositioning of the crypto ecosystem by providing a seamless introduction for newcomers, allowing Ethereum to gain consensus from more people. (No hierarchical organization)
4. Transparency and anonymity The
project data is transparent and open, statistics and the transaction history of its partners can be publicly queried on the Ethereum blockchain. Decentralized wallets can participate anonymously. (Data transparency, wealth anonymity)
5. Transaction guarantee
Network nodes irrevocably record and extensively store the transaction history of all Forsage network partners on the Ethereum blockchain

pragma solidity >=0.4.23 <0.6.0;

contract SmartMatrixForsage {

struct User {
    uint id;
    address referrer;
    uint partnersCount;
    
    mapping(uint8 => bool) activeX3Levels;
    mapping(uint8 => bool) activeX6Levels;
    
    mapping(uint8 => X3) x3Matrix;
    mapping(uint8 => X6) x6Matrix;
}

struct X3 {
    address currentReferrer;
    address[] referrals;
    bool blocked;
    uint reinvestCount;
}

struct X6 {
    address currentReferrer;
    address[] firstLevelReferrals;
    address[] secondLevelReferrals;
    bool blocked;
    uint reinvestCount;

    address closedPart;
}

uint8 public constant LAST_LEVEL = 12;

mapping(address => User) public users;
mapping(uint => address) public idToAddress;
mapping(uint => address) public userIds;
mapping(address => uint) public balances; 

uint public lastUserId = 2;
address public owner;

mapping(uint8 => uint) public levelPrice;

event Registration(address indexed user, address indexed referrer, uint indexed userId, uint referrerId);
event Reinvest(address indexed user, address indexed currentReferrer, address indexed caller, uint8 matrix, uint8 level);
event Upgrade(address indexed user, address indexed referrer, uint8 matrix, uint8 level);
event NewUserPlace(address indexed user, address indexed referrer, uint8 matrix, uint8 level, uint8 place);
event MissedEthReceive(address indexed receiver, address indexed from, uint8 matrix, uint8 level);
event SentExtraEthDividends(address indexed from, address indexed receiver, uint8 matrix, uint8 level);


constructor(address ownerAddress) public {
    levelPrice[1] = 0.025 ether;
    for (uint8 i = 2; i <= LAST_LEVEL; i++) {
        levelPrice[i] = levelPrice[i-1] * 2;
    }
    
    owner = ownerAddress;
    
    User memory user = User({
        id: 1,
        referrer: address(0),
        partnersCount: uint(0)
    });
    
    users[ownerAddress] = user;
    idToAddress[1] = ownerAddress;
    
    for (uint8 i = 1; i <= LAST_LEVEL; i++) {
        users[ownerAddress].activeX3Levels[i] = true;
        users[ownerAddress].activeX6Levels[i] = true;
    }
    
    userIds[1] = ownerAddress;
}

function() external payable {
    if(msg.data.length == 0) {
        return registration(msg.sender, owner);
    }
    
    registration(msg.sender, bytesToAddress(msg.data));
}

function registrationExt(address referrerAddress) external payable {
    registration(msg.sender, referrerAddress);
}

Guess you like

Origin blog.csdn.net/T13242772558/article/details/109286983