最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊

3M/MMM互助智能合約開發(fā)穩(wěn)定版,MMM/3M互助智能合約系統(tǒng)開發(fā)詳細(xì)說明及案例源碼

2023-04-06 16:15 作者:姐我不信  | 我要投稿

  web3.js是一個(gè)JavaScript API庫。要讓DApp在以太坊上運(yùn)行,我們可以使用web3.js庫提供的web3對(duì)象。web3.js通過RPC調(diào)用與本地節(jié)點(diǎn)通信,它可以與任何公開RPC層的以太坊節(jié)點(diǎn)一起使用。web3包含eth對(duì)象-web3.eth(用于與以太坊區(qū)塊鏈交互)和shh對(duì)象-web3.shh(用于與Whisper交互)


  dapp定制開發(fā)技術(shù)主要包括以太坊智能合約定制開發(fā),詳細(xì)流程:I35功能7O98開發(fā)O7I8 包括智能合約語言Solidity開發(fā),以太坊智能合約框架Truffle開發(fā),Web3.js開發(fā),以太坊區(qū)塊鏈瀏覽器Mist開發(fā)等。這些技術(shù)可以幫助開發(fā)者快速構(gòu)建出功能強(qiáng)大、可靠性高的dapp。


  此外,dapp定制開發(fā)還涉及到以太坊智能合約測試、以太坊智能合約安全性測試、以太坊智能合約部署測試等。這些技術(shù)可以幫助開發(fā)者快速測試和部署dapp,從而確保dapp的可靠性和安全性。


  數(shù)據(jù)作為新型生產(chǎn)要素,能為實(shí)體經(jīng)濟(jì)帶來放大、疊加和倍增作用,是做強(qiáng)做優(yōu)做大數(shù)字經(jīng)濟(jì)的關(guān)鍵。


  建立數(shù)據(jù)可信流通體系,增強(qiáng)數(shù)據(jù)的可用、可信、可流通、可追溯水平,是激活數(shù)據(jù)要素潛能、賦能實(shí)體經(jīng)濟(jì)的重要途徑。區(qū)塊鏈技術(shù)具有去中心化、共識(shí)機(jī)制、不可篡改、可以追溯、規(guī)則透明等特點(diǎn)。


  ERC-721的基礎(chǔ)知識(shí)在這個(gè)Infura博客中有所介紹。我們選擇使用ERC721URIStorage,這樣就不必使用靜態(tài)元數(shù)據(jù)文件來填充tokenURI。目前為止,我們導(dǎo)入了剛才自己創(chuàng)建的接口和OpenZeppelin的ERC721URIStorage實(shí)現(xiàn),并讓我們的ERC4907智能合約繼承它們的屬性,如下:


  //SPDX-License-Identifier:MIT


  pragma solidity>=0.4.22<0.9.0;


  import"openzeppelin/contracts/token/ERC721/ERC721URIStorage.sol";


  import"./IERC4907.sol";


  contract ERC4907 is ERC721URIStorage,IERC4907{


  constructor()public{


  }


  }


  contract ERC4907 is ERC721,IERC4907{


  constructor(string memory _name,string memory _symbol)ERC721(_name,_symbol){


  }


  }


  contract ERC4907 is ERC721URIStorage,IERC4907{


  struct UserInfo{


  address user;//address of user role


  uint64 expires;//unix timestamp,user expires


  }


  mapping(uint256=>UserInfo)internal _users;


  ///notice set the user and expires of a NFT


  ///dev The zero address indicates there is no user


  ///Throws if`tokenId`is not valid NFT


  ///param user The new user of the NFT


  ///param expires UNIX timestamp,The new user could use the NFT before expires


  function setUser(uint256 tokenId,address user,uint64 expires)public virtual override{


  require(_isApprovedOrOwner(msg.sender,tokenId),"ERC721:transfer caller is not owner nor approved");


  UserInfo storage info=_users[tokenId];


  info.user=user;


  info.expires=expires;


  emit UpdateUser(tokenId,user,expires);


  }


  ///notice Get the user address of an NFT


  ///dev The zero address indicates that there is no user or the user is expired


  ///param tokenId The NFT to get the user address for


  ///return The user address for this NFT


  function userOf(uint256 tokenId)


  public


  view


  virtual


  override


  returns(address)


  {


  if(uint256(_users[tokenId].expires)>=block.timestamp){


  return _users[tokenId].user;


  }else{


  return address(0);


  }


  }


3M/MMM互助智能合約開發(fā)穩(wěn)定版,MMM/3M互助智能合約系統(tǒng)開發(fā)詳細(xì)說明及案例源碼的評(píng)論 (共 條)

分享到微博請遵守國家法律
微博| 高要市| 南溪县| 扬州市| 东港市| 民丰县| 泾源县| 邹平县| 阜平县| 读书| 广东省| 铜山县| 望奎县| 博野县| 西乡县| 信宜市| 九江县| 新巴尔虎右旗| 牟定县| 茌平县| 九寨沟县| 襄樊市| 原平市| 纳雍县| 寿宁县| 科技| 安阳县| 台北县| 平舆县| 晋城| 正阳县| 塔城市| 福建省| 黄平县| 依兰县| 浠水县| 丹凤县| 武安市| 铜陵市| 璧山县| 壶关县|