NFT鑄造LP質押挖礦dapp系統開發技術原理分析

lxqy1668發表於2023-04-11

 從web1到web2你不難發現,這個過渡期是相對比較平穩的也是很短暫的,那個時候並沒有所謂的web1,web2的階段概念;一切都是隨著網際網路的發展程式自然而然形成了過度!直到近些年區塊鏈的概念被無數次的提起才出現了網際網路web3.0的概念!也就是結合區塊鏈實現去中心化,節點可驗證化,數字內容可價值化,I88智慧合約I928系統開發8024

  

  pragma solidity^0.6.12;

  

  pragma experimental ABIEncoderV2;

  

  library SafeMath{

  

  function add(uint256 a,uint256 b)internal pure returns(uint256){

  

  uint256 c=a+b;

  

  require(c>=a,"SafeMath:addition overflow");

  

  return c;

  

  }

  

  function sub(uint256 a,uint256 b)internal pure returns(uint256){

  

  require(b<=a,"SafeMath:subtraction overflow");

  

  uint256 c=a-b;

  

  return c;

  

  }

  

  function mul(uint256 a,uint256 b)internal pure returns(uint256){

  

  if(a==0){

  

  return 0;

  

  }

  

  uint256 c=a*b;

  

  require(c/a==b,"SafeMath:multiplication overflow");

  

  return c;

  

  }

  

  function div(uint256 a,uint256 b)internal pure returns(uint256){

  

  require(b>0,"SafeMath:division by zero");

  

  uint256 c=a/b;

  

  return c;

  

  }

  

  function transferFrom(address from,address to,uint value)

  

  isTokenTransfer

  

  checkLock

  

  returns(bool success){

  

  //if you don't have enough balance,throw

  

  require(_balances[from]>=value);

  

  //if you don't have approval,throw

  

  require(_approvals[from][msg.sender]>=value);

  

  //transfer and return true

  

  _approvals[from][msg.sender]=_approvals[from][msg.sender].sub(value);

  

  _balances[from]=_balances[from].sub(value);

  

  _balances[to]=_balances[to].add(value);

  

  Transfer(from,to,value);

  

  return true;

  

  }


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

相關文章