Forsage佛薩奇智慧合約3.0NFT模式軟體開發詳情

lxqy1668發表於2023-04-14

 Web3.0時代,未來,使用者可以自主掌握自己的資訊,這裡就涉及到資料確權的問題,使用者可以創造價值,不受平臺約束。內容的創造者擁有者控制者都是使用者自己,利益分配掌握主動權,像是契約網際網路時代。I88智慧合約I928系統開發8024

  

  // SPDX-License-Identifier: GPL-3.0

  

  pragma solidity >=0.4.22 <0.9.0;

  

  contract MappingExample {

  

  mapping (address => uint256) private _balances;

  

  mapping (address => mapping (address => uint256)) private _allowances;

  

  event Transfer(address indexed from, address indexed to, uint256 value);

  

  event Approval(address indexed owner, address indexed spender, uint256 value);

  

  function allowance(address owner, address spender) public view returns (uint256) {

  

  return _allowances[owner][spender];

  

  }

  

  function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {

  

  require(_allowances[sender][msg.sender] >= amount, "ERC20: Allowance not high enough.");

  

  _allowances[sender][msg.sender] -= amount;

  

  _transfer(sender, recipient, amount);

  

  return true;

  

  }

  

  function approve(address spender, uint256 amount) public returns (bool) {

  

  require(spender != address(0), "ERC20: approve to the zero address");

  

  _allowances[msg.sender][spender] = amount;

  

  emit Approval(msg.sender, spender, amount);

  

  return true;

  

  }

  

  struct User{

  

  uint name;

  

  bool isUsed;

  

  }

  

  mapping(address => User) users;

  

  mapping(uint => address) addresses;

  

  function isExistEntry(address _addr) public view returns(bool){

  

  return users[_addr].isUsed;

  

  }

  

  function isExistAddress(uint _key) public view returns(bool){

  

  return addresses[_key] != address(0);

  

  }

  

  }


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

相關文章