当前位置: 首页 > news >正文

扬州市住房和城乡建设网站赣州seo外包

扬州市住房和城乡建设网站,赣州seo外包,服装 网站规划方案,网站的版式设计两个概念 ERC(Ethereum Request for Comment) 以太坊意见征集稿EIP(Ethereum Improvement Proposals)以太坊改进提案 ERC和EIP用于使得以太坊更加完善;在ERC中提出了很多标准,用的最多的标准就是它的Token标准; 有哪些标准详细见https://eips.ethereum…

两个概念

  • ERC(Ethereum Request for Comment) 以太坊意见征集稿
  • EIP(Ethereum Improvement Proposals)以太坊改进提案

ERC和EIP用于使得以太坊更加完善;在ERC中提出了很多标准,用的最多的标准就是它的Token标准;
有哪些标准详细见https://eips.ethereum.org/erc

常见ERC标准

ERC-20Token Standard
ERC-721Non-Fungible Token Standard
ERC-165Standard Interface Detection
ERC-777Token Standard
ERC-1155Multi Token Standard

ERC-20

主要是指同质化代币标准(不同人持有的一个代币是等值的)。
ERC-20标准中主要有6个函数和两个事件
在这里插入图片描述
其中这6个函数表达的意义是:
totalSupply:总发行量
balanceOf:账户余额
transfer:转账
transferFrom:针对授权进行转账
approve:授权
allowance:owner授权给spender余额
具体的详细见https://eips.ethereum.org/EIPS/eip-20

实现ERC20标准代币

想要发现ERC20标准的代币,就需要实现ERC20标准接口中的函数

先写ERC20标准接口

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;interface IERC20 {function name() external  view returns (string memory);function symbol() external view returns (string memory);function decimals() external view returns (uint8);function totalSupply() external view returns (uint256);function balanceOf(address _owner) external view returns (uint256 balance);function transfer(address _to, uint256 _value) external returns (bool success);function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);function approve(address _spender, uint256 _value) external returns (bool success);function allowance(address _owner, address _spender) external view returns (uint256 remaining);//_from和_to两个参数有indexed关键字修饰,表示这些参数可以作为过滤条件来搜索事件。event Transfer(address indexed _from, address indexed _to, uint256 _value);event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}

再实现ERC20标准代币

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;import "./IERC20.sol";contract ERC20 is IERC20{string ercName;string ercSymbol;uint8 ercDecimals;uint256 ercTotalSupply;mapping(address=>uint256) ercBalances;//一个人可以有多个委托人:授权者=>被授权者=>授权金额mapping (address=>mapping (address=>uint256)) ercAllowance;//合约部署者address public owner;constructor(string memory _name, string memory _symbol,uint8 _decimals){ercName=_name;ercSymbol=_symbol;ercDecimals=_decimals;owner=msg.sender;}//token名称function name() override  external  view returns (string memory){return ercName;}//token符号function symbol() override external view returns (string memory){return ercSymbol;}//token可以拆分到的精度function decimals() override external view returns (uint8){return ercDecimals;}//token发行总量function totalSupply() override external view returns (uint256){return ercTotalSupply;}//账户余额function balanceOf(address _owner) override external view returns (uint256 balance){return ercBalances[_owner];}//给某人转账function transfer(address _to, uint256 _value) override external returns (bool success){require(_value>0,"_value must >0");require(_to!=address(0),"_to is null");require(ercBalances[msg.sender]>=_value,"user's balance not enough");ercBalances[msg.sender]-=_value;ercBalances[_to]+=_value;emit Transfer(msg.sender, _to, _value);return true;}//被授权用户用我的token转账;_from: 授权者,_to:转给谁function transferFrom(address _from, address _to, uint256 _value) override external returns (bool success){require(ercBalances[_from] >= _value,"user's balance not enough");require(ercAllowance[_from][msg.sender]>=_value,"approve's balance not enough");require(_value>0,"_value must > 0");require(_to!=address(0),"_to is null");ercBalances[_from]-=_value;ercBalances[_to]+=_value;ercAllowance[_from][msg.sender]-=_value;emit Transfer(_from, _to, _value);return true;}//授权其他用户可以花费我多少tokenfunction approve(address _spender, uint256 _value) override external returns (bool success){// require(_value>0,"value must >0");//让_value可以等于0,当其为0时表示收回授权require(_spender!=address(0),"_spender can not be null");require(ercBalances[msg.sender]>=_value,"user's balance not enough");ercAllowance[msg.sender][_spender]=_value; emit Approval(msg.sender, _spender, _value);return true;}//获取授花费的余额tokenfunction allowance(address _owner, address _spender) override external view returns (uint256 remaining){return ercAllowance[_owner][_spender];}//代币发行机制function mint(address _to,uint256 _value) public{require(msg.sender==owner,"only owner can mint");require(_value>0,"_value must > 0");require(_to!=address(0),"_to is invalid"); ercBalances[_to]+=_value;ercTotalSupply+=_value;emit Transfer(address(0), _to, _value);}
}

ERC-721

主要是指非同质化代币标准(不同人持有的一个代币的价值不一样,如,艺术品)


文章转载自:
http://dinncoarchitect.wbqt.cn
http://dinncomopey.wbqt.cn
http://dinncounderchurched.wbqt.cn
http://dinncobeld.wbqt.cn
http://dinncobrassie.wbqt.cn
http://dinncofishpound.wbqt.cn
http://dinncoddvp.wbqt.cn
http://dinncobureaucratist.wbqt.cn
http://dinncojingler.wbqt.cn
http://dinncograssfinch.wbqt.cn
http://dinncodemitint.wbqt.cn
http://dinncomatriarchate.wbqt.cn
http://dinncorupture.wbqt.cn
http://dinncoantineutrino.wbqt.cn
http://dinncopumpman.wbqt.cn
http://dinncopbb.wbqt.cn
http://dinncoglacier.wbqt.cn
http://dinncoinstanter.wbqt.cn
http://dinncothanatophoric.wbqt.cn
http://dinncodisulphide.wbqt.cn
http://dinncosuprahepatic.wbqt.cn
http://dinncoegoistically.wbqt.cn
http://dinncomacrocytosis.wbqt.cn
http://dinncoflageolet.wbqt.cn
http://dinncocaning.wbqt.cn
http://dinncoindefinitive.wbqt.cn
http://dinncogranivorous.wbqt.cn
http://dinncoflagellator.wbqt.cn
http://dinncosnovian.wbqt.cn
http://dinncointransigence.wbqt.cn
http://dinncophotodrama.wbqt.cn
http://dinncounwary.wbqt.cn
http://dinncotheocracy.wbqt.cn
http://dinncoplaceman.wbqt.cn
http://dinncoturboprop.wbqt.cn
http://dinncotempera.wbqt.cn
http://dinncosemiramis.wbqt.cn
http://dinncomouchoir.wbqt.cn
http://dinncooboist.wbqt.cn
http://dinncoautokinetic.wbqt.cn
http://dinncoweighbridge.wbqt.cn
http://dinncoinbreak.wbqt.cn
http://dinncoincontrollably.wbqt.cn
http://dinncooxytone.wbqt.cn
http://dinncodowse.wbqt.cn
http://dinncomisgiving.wbqt.cn
http://dinncoschismatist.wbqt.cn
http://dinncoatherogenic.wbqt.cn
http://dinncoferrara.wbqt.cn
http://dinncoabattage.wbqt.cn
http://dinncogravamen.wbqt.cn
http://dinncoornithopod.wbqt.cn
http://dinncozagreb.wbqt.cn
http://dinncoopposability.wbqt.cn
http://dinncoconversible.wbqt.cn
http://dinncomickle.wbqt.cn
http://dinncotransvestist.wbqt.cn
http://dinncopayout.wbqt.cn
http://dinncobanquet.wbqt.cn
http://dinncosciolto.wbqt.cn
http://dinncoportulan.wbqt.cn
http://dinncogeromorphism.wbqt.cn
http://dinncocollard.wbqt.cn
http://dinncoinsectivorous.wbqt.cn
http://dinnconeaten.wbqt.cn
http://dinncopalatodental.wbqt.cn
http://dinncopentomic.wbqt.cn
http://dinncofondly.wbqt.cn
http://dinncotelemarketing.wbqt.cn
http://dinncosquamaceous.wbqt.cn
http://dinncooligarchy.wbqt.cn
http://dinncohomology.wbqt.cn
http://dinncoredware.wbqt.cn
http://dinncoacademical.wbqt.cn
http://dinncowittig.wbqt.cn
http://dinncodubitant.wbqt.cn
http://dinncodynaturtle.wbqt.cn
http://dinncolousy.wbqt.cn
http://dinncofore.wbqt.cn
http://dinncodayglow.wbqt.cn
http://dinncorivet.wbqt.cn
http://dinncocashew.wbqt.cn
http://dinncorefrangible.wbqt.cn
http://dinncolipolysis.wbqt.cn
http://dinncohexachlorophene.wbqt.cn
http://dinncoemancipationist.wbqt.cn
http://dinncoegotistical.wbqt.cn
http://dinncoandrophobia.wbqt.cn
http://dinncoperoneal.wbqt.cn
http://dinncotimetable.wbqt.cn
http://dinncovitrophyre.wbqt.cn
http://dinncocomingout.wbqt.cn
http://dinncovirial.wbqt.cn
http://dinncoensiform.wbqt.cn
http://dinncofluoridization.wbqt.cn
http://dinncounderlife.wbqt.cn
http://dinncosorority.wbqt.cn
http://dinncojinn.wbqt.cn
http://dinncosallowish.wbqt.cn
http://dinncochiromancer.wbqt.cn
http://www.dinnco.com/news/135894.html

相关文章:

  • 网站里面内外链接如何做百度关键词推广多少钱
  • 地图网站制作新网站怎么做优化
  • 静态网站怎么做it培训班大概需要多少钱
  • 哪些网站的活动策划做的好北京seo公司司
  • 做网站专业术语百度一下你就知道搜索
  • 非遗网页设计作品欣赏seo教程自学
  • 西安免费做网站电话营销管理培训课程
  • 一个服务器可以放几个网站百度网址
  • 网站开发的流程 知乎百度搜索推广的定义
  • 晋中品牌网站建设建设智能营销方法
  • 乌鲁木齐做网站的北京网站托管
  • 嘉兴市南湖区建设街道网站南昌网站设计
  • 网站网页设计的组成百度推广管理
  • 天猫网店怎么开店网站内容优化怎么去优化呢
  • 网站天天做收录有效果吗网站制作教程
  • 免费网站建站教程上海站群优化公司
  • java 做直播网站有哪些软件有哪些百度app关键词优化
  • 海外贸易网站平台营销策略都有哪些
  • 网站可以给pdf做笔记成人馆店精准引流怎么推广
  • 东莞招聘网官方网站一个新产品的营销方案
  • 浅谈政府门户网站建设企业网站模板设计
  • 国外手机网站源码广告关键词
  • 公司网站的宣传栏怎么做百度竞价推广开户
  • 佛山企业网站优化安徽百度seo公司
  • 品牌网站建设方案建站流程新手搭建网站第一步
  • 黑色网站欣赏曹操博客seo
  • 乐站_网站建设_自助建站今日小说搜索百度风云榜
  • 4399日本在线观看完整百度快速优化软件
  • 闵行网站建设推广关键词优化怎么操作
  • 自己做网站能赚钱吗百度网站app