广州杰肯狸网络科技有限公司
动漫游戏开发 , 计算机系统服务 , 新材料技术研发 , 能量回收系统研发
数字货币SWAP去中心交易所系统开发项目方案

  SWAP trading refers to the use of mechanisms such as leveraged trading to buy and sell assets on an exchange without actually owning the asset.In SWAP trading,the exchange will adjust asset prices and transaction fees based on market conditions and trading needs.注意I80開發2857技术8624过程!


  ***:一种技术创新,能够实现可验证的数字所有权、透明度和不可更改性


  Crypto:加密货币的简称,描述了***网络上加密安全的代币


  Web3:包括***、加密货币,以及建立在它们之上的所有生态系统和创新


  pragma solidity^0.8.0;


  contract MyToken{


  //合约的发行者


  address public owner;


  //代币名称


  string public name;


  //代币符号


  string public symbol;


  //代币的小数位


  uint8 public decimals;


  //代币的总发行量


  uint256 public totalSupply;


  mapping(address=>uint256)public balanceOf;


  mapping(address=>mapping(address=>uint256))public allowance;


  //构造函数


  constructor(string memory _name,string memory _symbol,uint8 _decimals,uint256 _totalSupply){


  owner=msg.sender;


  name=_name;


  symbol=_symbol;


  decimals=_decimals;


  totalSupply=_totalSupply;


  balanceOf[owner]=totalSupply;


  }


  //转账


  function transfer(address _to,uint256 _value)public returns(bool success){


  require(balanceOf[msg.sender]>=_value);


  balanceOf[msg.sender]-=_value;


  balanceOf[_to]+=_value;


  emit Transfer(msg.sender,_to,_value);


  return true;


  }


  //授权


  function approve(address _spender,uint256 _value)public returns(bool success){


  allowance[msg.sender][_spender]=_value;


  emit Approval(msg.sender,_spender,_value);


  return true;


  }


  //接收授权后转账


  function transferFrom(address _from,address _to,uint256 _value)public returns(bool success){


  require(_value<=balanceOf[_from]);


  require(_value<=allowance[_from][msg.sender]);


  balanceOf[_from]-=_value;


  balanceOf[_to]+=_value;


  allowance[_from][msg.sender]-=_value;


  emit Transfer(_from,_to,_value);


  return true;


  }


  //事件通知


  event Transfer(address indexed _from,address indexed _to,uint256 _value);


  event Approval(address indexed _owner,


发布时间:2024-05-03
展开全文
优质商家推荐 拨打电话