DAPP智慧合約眾籌互助質押挖礦分紅系統開發

lovei130908發表於2023-03-13

這些合約執行在區塊鏈技術上,這是比特幣和大多數加密泉幣的根底手藝。輸出資訊暗示由開發職員調配的值,當這些值被滿足時,合約根據它被程式設計要執行的規則執行自己。 DAPP智慧合約模式體系開發原始碼 智慧合約相當於使用步伐程式設計介面(API),但它不是在平日的web平臺上應用,而是在區塊鏈上使用。應用系統程式程式設計介面(API)允許學生使用者在他們可以使用的平臺上進行資訊互動並引入某些特性系統開發180-383I-97Z4。

// SPDX-License-Identifier: GPL-3.0

 

pragma solidity >=0.7.0 <0.9.0;

 

/**

  * @title Storage

  * @dev Store & retrieve value in a variable

  */

contract Game {

 

     uint8 constant ROCK = 0;

     uint8 constant PAPER = 1;

     uint8 constant SCISSORS = 2;

     address[] public players;

 

     // the public keyword will create a function with the same name as the mapping which will allow us to lookup the key outside the contract

     // no data is ever hidden in a smart contract deployed on a public chain and using `private` will not hide data in any way.

mapping(address => uint8) public choices;

  function enroll() public payable {

         require(msg.value > .01 ether);

 

         players.push(msg.sender);

     }

 

     function play(uint8 choice) external {

         // check that the move is valid

         require(choice == ROCK || choice == PAPER || choice == SCISSORS);

         // check that the player hasnt played the move already

         require(choices[msg.sender] == 0);

         // set the choice for the players address

         choices[msg.sender] = choice;

     }

 

   function evaluate(address alice, address bob)

         public

         view

         returns (address add)

     {


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

相關文章