NFT質押LP挖礦系統開發技術方案

caiayu1234發表於2023-04-07

 智慧合約是一種計算機協議,在協議制定和部署後,不需要外加人為幹預,即可實現自我執行和自我驗證。從技術角度來說,智慧合約可以被看作一種計算機程式,這種程式可以自主地執行全部或部分和合約相關的操作,併產生相應的可以被驗證的證據,來說明執行合約操作的有效性。在部署智慧合約之前,與合約相關的所有條款的邏輯流程就已經被制定好了。

  

  智慧合約通常具有一個使用者介面,以供使用者與已制定的合約進行互動,這些互動行為都嚴格遵守此前制定的邏輯。得益於密碼學技術,這些互動行為能夠被嚴格地驗證,I88智慧合約I928系統開發8024,以確保合約能夠按照此前制定的規則順利執行,從而防止出現違約行為。

  

  }

  

  contract Caller{

  

  address public richest;

  

  uint public mostSent;

  

  constructor()payable{

  

  richest=msg.sender;

  

  mostSent=msg.value;

  

  }

  

  //第一種合約調合約方法,Callee _callee,隱式轉換地址為合約

  

  function callSetx(Callee _callee,uint256 _x)public{

  

  uint256 x=_callee.setX(_x);

  

  }

  

  //第二種合約調合約方法,Callee(_addr)顯式轉換地址為合約

  

  function callSeXAddress(address _addr,uint256 _x)public{

  

  Callee callee=Callee(_addr);

  

  callee.setX(_x);

  

  }

  

  //第三種合約調合約方法,傳送ether

  

  function callsetXandSendEther(address _addr,uint256 _x)public payable{

  

  Callee callee=Callee(_addr);

  

  //{value:msg.value}傳送ether或者全域性變數

  

  (uint x,uint value)=callee.setXandSendEther{value:msg.value}(_x);

  

  }

  

  }

  

  //contract CallTest{

  

  //

  

  ////需要0.4的版本pragma solidity^0.8;

  

  //function callByFun(address addr,uint256 _x)public returns(bool){

  

  ////bytes4 methodId=bytes4(keccak256("increaseAge(string,uint256)"));

  

  ////return addr.call(methodId,"jack",1);

  

  ////下面這句等於上面2行

  

  //return addr.call(abi.encodeWithSignature("setX(uint256)",_x));

  

  //}

  

  //function callData(address addr)public returns(bool){

  

  //return addr.call("abc",256);//找不到abc函式,會調fallback函式

  

  //}

  

  //}


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

相關文章