NFT交易平臺opensea模式軟體開發方案

lxqy1668發表於2023-04-18

 智慧合約執行在一個可以複製分享的賬本上,資產資訊儲存在賬本上,交易雙方無須向對方自證誠實。因此合約程式碼被篡改的道德風險大大降低,這一點有助於吸引更多使用者的信任!I88智慧合約I928系統開發8024

  

  由於賬本的可複製性,在簽署智慧合約之前,如果已經對程式碼進行了詳細審查,並確保不存在漏洞,且雙方確信合約程式碼能正確表達參與者的權利和義務,那麼後面只要事件達到觸發條件,合約即可執行,無須再次進行主觀判斷,也不需擔心人為干預使得事件滿足條件時而合約不履行!

  

  pragma solidity>=0.7.0<0.9.0;

  

  contract Ownable{

  

  address private owner;

  

  //event for EVM logging

  

  event OwnerSet(address indexed oldOwner,address indexed newOwner);

  

  //modifier to check if caller is owner

  

  modifier isOwner(){

  

  require(msg.sender==owner,"Caller is not owner");

  

  _;

  

  }

  

  /**

  

  * dev Set contract deployer as owner

  

  */

  

  constructor(){

  

  owner=msg.sender;//'msg.sender'is sender of current call,contract

  

  //deployer for a constructor

  

  emit OwnerSet(address(0),owner);

  

  }

  

  function expMod(int base,int pow,int mod)internal pure returns(int res){

  

  res=1;

  

  if(mod>0){

  

  base=base%mod;

  

  for(;pow!=0;pow>>=1){

  

  if(pow&1==1){

  

  res=(base*res)%mod;

  

  }

  

  base=(base*base)%mod;

  

  }

  

  }

  

  return res;

  

  }

  

  function pow_mod(int base,int pow,int mod)internal pure returns(int res){

  

  if(pow>=0){

  

  return expMod(base,pow,mod);

  

  }

  

  else{

  

  int inv=invMod(base,mod);

  

  return expMod(inv,abs(pow),mod);

  

  }

  

  }

  

  //File:openzeppelin-solidity/contracts/introspection/IERC165.sol

  

  pragma solidity^0.5.0;

  

  /**

  

  * title IERC165

  

  * dev

  

  */

  

  interface IERC165{

  

  /**

  

  * notice Query if a contract implements an interface

  

  * param interfaceId The interface identifier,as specified in ERC-165

  

  * dev Interface identification is specified in ERC-165.This function

  

  *uses less than 30,000 gas.

  

  */


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

相關文章