{"id":1086,"date":"2024-06-14T15:04:56","date_gmt":"2024-06-14T07:04:56","guid":{"rendered":"https:\/\/a88o.com\/?p=1086"},"modified":"2024-06-14T15:04:56","modified_gmt":"2024-06-14T07:04:56","slug":"erc20%e5%b8%81%e6%98%af%e4%bb%80%e4%b9%88%e5%b8%81%ef%bc%9ferc20%e5%b8%81%e6%98%af%e4%bb%80%e4%b9%88%e5%b8%81%e7%9a%84%e8%af%a6%e7%bb%86%e8%a7%a3%e6%9e%90","status":"publish","type":"post","link":"https:\/\/www.a88o.com\/1086.html","title":{"rendered":"erc20\u5e01\u662f\u4ec0\u4e48\u5e01\uff1ferc20\u5e01\u662f\u4ec0\u4e48\u5e01\u7684\u8be6\u7ec6\u89e3\u6790"},"content":{"rendered":"\n

ERC20\u5e76\u975e\u7279\u6307\u67d0\u4e00\u79cd\u5177\u4f53\u7684\u4ee3\u5e01\uff0c\u800c\u662f\u4e00\u4e2a\u5728\u4ee5\u592a\u574a\u533a\u5757\u94fe\u4e0a\u5e7f\u6cdb\u4f7f\u7528\u7684\u4ee3\u5e01\u6807\u51c6\u3002\u4e3a\u4e86\u66f4\u5168\u9762\u5730\u89e3\u91caERC20\uff0c\u4eceERC20\u7684\u8d77\u6e90\u3001\u529f\u80fd\u4e0e\u7279\u70b9\u3001ERC-20\u4ee3\u5e01\u7684\u521b\u5efa\u7b49\u5185\u5bb9\u8fdb\u884c\u4ecb\u7ecd\uff0c\u5e2e\u52a9\u7528\u6237\u5145\u5206\u4e86\u89e3ERC20\u3002<\/p>\n\n\n\n

\u4e00\u3001ERC20\u7684\u8d77\u6e90\u4e0e\u5b9a\u4e49<\/strong>
ERC20\uff0c\u5168\u79f0Ethereum Request for Comments 20\uff0c\u662f\u4ee5\u592a\u574a\u793e\u533a\u57282015\u5e74\u63d0\u51fa\u7684\u4e00\u4e2a\u6280\u672f\u63d0\u6848\uff0c\u63d0\u4f9b\u4e00\u5957\u7edf\u4e00\u7684\u89c4\u5219\u548c\u63a5\u53e3\uff0c\u4f7f\u5f97\u4e0d\u540c\u7684\u4ee3\u5e01\u53ef\u4ee5\u5728\u4ee5\u592a\u574a\u5e73\u53f0\u4e0a\u4e92\u76f8\u4ea4\u6362\u548c\u4f7f\u7528\u3002\u8fd9\u4e2a\u6807\u51c6\u7531\u4ee5\u592a\u574a\u5f00\u53d1\u8005Fabian Vogelsteller\u548cVitalik Buterin\u7b49\u4eba\u5171\u540c\u63a8\u52a8\uff0c\u5e76\u57282016\u5e749\u6708\u6b63\u5f0f\u53d1\u5e03\u3002<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

\u4e8c\u3001ERC20\u7684\u529f\u80fd\u4e0e\u7279\u70b9<\/strong>
ERC20\u6807\u51c6\u5b9a\u4e49\u4e86\u4ee3\u5e01\u5fc5\u987b\u5b9e\u73b0\u7684\u516d\u4e2a\u6838\u5fc3\u51fd\u6570\u548c\u4e24\u4e2a\u4e8b\u4ef6\u3002
1.\u57fa\u672c\u529f\u80fd\uff1a
\u4ee3\u5e01\u4fe1\u606f\u67e5\u8be2\uff1a\u901a\u8fc7totalSupply()\u51fd\u6570\u67e5\u8be2\u4ee3\u5e01\u7684\u603b\u91cf\uff0c\u901a\u8fc7balanceOf(address tokenOwner)\u51fd\u6570\u67e5\u8be2\u6307\u5b9a\u5730\u5740\u7684\u4ee3\u5e01\u4f59\u989d\u3002
\u4ee3\u5e01\u8f6c\u79fb\uff1a\u901a\u8fc7transfer(address to, uint tokens)\u51fd\u6570\u5b9e\u73b0\u4ee3\u5e01\u4ece\u4e00\u4e2a\u5730\u5740\u5230\u53e6\u4e00\u4e2a\u5730\u5740\u7684\u8f6c\u79fb\u3002
\u4ee3\u5e01\u6388\u6743\uff1a\u901a\u8fc7approve(address spender, uint tokens)\u51fd\u6570\u6388\u6743\u67d0\u4e2a\u5730\u5740\u53ef\u4ee5\u82b1\u8d39\u4e00\u5b9a\u6570\u91cf\u7684\u4ee3\u5e01\uff0c\u901a\u8fc7allowance(address tokenOwner, address spender)\u51fd\u6570\u67e5\u8be2\u6388\u6743\u60c5\u51b5\u3002
\u6388\u6743\u8f6c\u79fb\uff1a\u901a\u8fc7transferFrom(address from, address to, uint tokens)\u51fd\u6570\u5b9e\u73b0\u57fa\u4e8e\u6388\u6743\u7684\u4ee3\u5e01\u8f6c\u79fb\u3002
ERC20\u4ee3\u5e01\u7684\u7279\u70b9\uff1a
\u6807\u51c6\u5316\uff1a\u9075\u5faa\u7edf\u4e00\u7684\u89c4\u5219\u548c\u6807\u51c6\uff0c\u4f7f\u5f97\u4ee3\u5e01\u4e4b\u95f4\u7684\u4ea4\u4e92\u66f4\u52a0\u4fbf\u6377\u3002
\u53ef\u6269\u5c55\u6027\uff1a\u57fa\u4e8e\u667a\u80fd\u5408\u7ea6\u5b9e\u73b0\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8fdb\u884c\u5b9a\u5236\u548c\u6269\u5c55\u3002
\u4e92\u64cd\u4f5c\u6027\uff1a\u4e0d\u540c\u7684ERC20\u4ee3\u5e01\u53ef\u4ee5\u5728\u4ee5\u592a\u574a\u751f\u6001\u7cfb\u7edf\u4e2d\u65e0\u7f1d\u96c6\u6210\u548c\u4ea4\u4e92\u3002<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

\u4e09\u3001ERC-20\u4ee3\u5e01\u7684\u521b\u5efa<\/strong>
\u7f16\u5199\u667a\u80fd\u5408\u7ea6\uff1a\u5f00\u53d1\u8005\u4f7f\u7528Solidity\u7b49\u7f16\u7a0b\u8bed\u8a00\u7f16\u5199\u4e00\u4e2a\u9075\u5faaERC-20\u6807\u51c6\u7684\u667a\u80fd\u5408\u7ea6\u3002\u8fd9\u4e2a\u5408\u7ea6\u5b9a\u4e49\u4e86\u4ee3\u5e01\u7684\u57fa\u672c\u5c5e\u6027\u548c\u529f\u80fd\uff0c\u5982\u4ee3\u5e01\u540d\u79f0\u3001\u7b26\u53f7\u3001\u603b\u91cf\u3001\u8f6c\u8d26\u903b\u8f91\u7b49\u3002
\u90e8\u7f72\u667a\u80fd\u5408\u7ea6\uff1a\u5f00\u53d1\u8005\u5c06\u7f16\u5199\u597d\u7684\u667a\u80fd\u5408\u7ea6\u90e8\u7f72\u5230\u4ee5\u592a\u574a\u533a\u5757\u94fe\u4e0a\u3002\u90e8\u7f72\u8fc7\u7a0b\u5305\u62ec\u5c06\u5408\u7ea6\u4ee3\u7801\u7f16\u8bd1\u6210\u5b57\u8282\u7801\uff0c\u7136\u540e\u4f7f\u7528\u4ee5\u592a\u574a\u94b1\u5305\u7b49\u5de5\u5177\u5c06\u5b57\u8282\u7801\u53d1\u9001\u5230\u533a\u5757\u94fe\u4e0a\uff0c\u5e76\u652f\u4ed8\u4e00\u5b9a\u7684Gas\u8d39\u7528\u3002
\u521d\u59cb\u5316\u4ee3\u5e01\uff1a\u667a\u80fd\u5408\u7ea6\u90e8\u7f72\u6210\u529f\u540e\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528\u5408\u7ea6\u4e2d\u7684\u521d\u59cb\u5316\u51fd\u6570\u6765\u8bbe\u7f6e\u4ee3\u5e01\u7684\u521d\u59cb\u53c2\u6570\uff0c\u5982\u4ee3\u5e01\u603b\u91cf\u3001\u53d1\u884c\u4ef7\u683c\u7b49\u3002<\/p>\n\n\n\n

ERC20\u6807\u51c6\u89c4\u5b9a\u4e86\u667a\u80fd\u5408\u7ea6\u516d\u4e2a\u51fd\u6570\u7684\u8be6\u7ec6\u89e3\u91ca<\/strong>
totalSupply()\uff1a
\u529f\u80fd\uff1a\u8fd4\u56de\u4ee3\u5e01\u7684\u603b\u53d1\u884c\u91cf\u3002
\u8fd4\u56de\u7c7b\u578b\uff1auint256\uff0c\u8868\u793a\u4e00\u4e2a\u65e0\u7b26\u53f7\u7684256\u4f4d\u6574\u6570\uff0c\u7528\u4e8e\u5b58\u50a8\u4ee3\u5e01\u7684\u603b\u91cf\u3002
\u793a\u4f8b\u4ee3\u7801\uff1afunction totalSupply() public view returns (uint256)
balanceOf(address tokenOwner)\uff1a
\u529f\u80fd\uff1a\u8fd4\u56de\u6307\u5b9a\u5730\u5740\u7684\u4ee3\u5e01\u6301\u6709\u91cf\u3002
\u53c2\u6570\uff1aaddress tokenOwner\uff0c\u5373\u8981\u67e5\u8be2\u7684\u4ee3\u5e01\u6301\u6709\u8005\u7684\u5730\u5740\u3002
\u8fd4\u56de\u7c7b\u578b\uff1auint256\uff0c\u8868\u793a\u8be5\u5730\u5740\u6301\u6709\u7684\u4ee3\u5e01\u6570\u91cf\u3002
\u793a\u4f8b\u4ee3\u7801\uff1afunction balanceOf(address tokenOwner) public view returns (uint256 balance)
transfer(address to, uint256 tokens)\uff1a
\u529f\u80fd\uff1a\u5c06\u6307\u5b9a\u6570\u91cf\u7684\u4ee3\u5e01\u4ece\u4e00\u4e2a\u5730\u5740\u8f6c\u79fb\u5230\u53e6\u4e00\u4e2a\u5730\u5740\u3002
\u53c2\u6570\uff1a
address to\uff1a\u63a5\u6536\u4ee3\u5e01\u7684\u5730\u5740\u3002
uint256 tokens\uff1a\u8981\u8f6c\u79fb\u7684\u4ee3\u5e01\u6570\u91cf\u3002
\u8fd4\u56de\u7c7b\u578b\uff1abool\uff0c\u8868\u793a\u64cd\u4f5c\u662f\u5426\u6210\u529f\u3002
\u793a\u4f8b\u4ee3\u7801\uff1afunction transfer(address to, uint256 tokens) public returns (bool success)
approve(address spender, uint256 tokens)\uff1a
\u529f\u80fd\uff1a\u6388\u6743\u4e00\u4e2a\u5730\u5740\u53ef\u4ee5\u82b1\u8d39\u6307\u5b9a\u6570\u91cf\u7684\u4ee3\u5e01\u3002
\u53c2\u6570\uff1a
address spender\uff1a\u88ab\u6388\u6743\u7684\u5730\u5740\u3002
uint256 tokens\uff1a\u88ab\u6388\u6743\u82b1\u8d39\u7684\u4ee3\u5e01\u6570\u91cf\u3002
\u8fd4\u56de\u7c7b\u578b\uff1abool\uff0c\u8868\u793a\u64cd\u4f5c\u662f\u5426\u6210\u529f\u3002
\u793a\u4f8b\u4ee3\u7801\uff1afunction approve(address spender, uint256 tokens) public returns (bool success)
allowance(address tokenOwner, address spender)\uff1a
\u529f\u80fd\uff1a\u8fd4\u56de\u88ab\u6388\u6743\u5730\u5740\u53ef\u4ee5\u82b1\u8d39\u7684\u4ee3\u5e01\u6570\u91cf\u3002
\u53c2\u6570\uff1a
address tokenOwner\uff1a\u4ee3\u5e01\u6301\u6709\u8005\u7684\u5730\u5740\u3002
address spender\uff1a\u88ab\u6388\u6743\u7684\u5730\u5740\u3002
\u8fd4\u56de\u7c7b\u578b\uff1auint256\uff0c\u8868\u793a\u88ab\u6388\u6743\u5730\u5740\u53ef\u4ee5\u82b1\u8d39\u7684\u4ee3\u5e01\u6570\u91cf\u3002
\u793a\u4f8b\u4ee3\u7801\uff1afunction allowance(address tokenOwner, address spender) public view returns (uint256 remaining)
transferFrom(address from, address to, uint256 tokens)\uff1a
\u529f\u80fd\uff1a\u5141\u8bb8\u88ab\u6388\u6743\u7684\u5730\u5740\u5c06\u4ee3\u5e01\u4ece\u4e00\u4e2a\u5730\u5740\u8f6c\u79fb\u5230\u53e6\u4e00\u4e2a\u5730\u5740\u3002
\u53c2\u6570\uff1a
address from\uff1a\u53d1\u9001\u4ee3\u5e01\u7684\u5730\u5740\u3002
address to\uff1a\u63a5\u6536\u4ee3\u5e01\u7684\u5730\u5740\u3002
uint256 tokens\uff1a\u8981\u8f6c\u79fb\u7684\u4ee3\u5e01\u6570\u91cf\u3002
\u8fd4\u56de\u7c7b\u578b\uff1abool\uff0c\u8868\u793a\u64cd\u4f5c\u662f\u5426\u6210\u529f\u3002
\u793a\u4f8b\u4ee3\u7801\uff1afunction transferFrom(address from, address to, uint256 tokens) public returns (bool success)<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

\u56db\u3001ERC20\u7684\u5e02\u573a\u5e94\u7528<\/strong>
1.\u53bb\u4e2d\u5fc3\u5316\u91d1\u878d\uff08DeFi\uff09
ERC20\u4ee3\u5e01\u5728DeFi\u751f\u6001\u7cfb\u7edf\u4e2d\u626e\u6f14\u7740\u91cd\u8981\u89d2\u8272\uff0c\u652f\u6301\u501f\u8d37\u3001\u4ea4\u6613\u3001\u6536\u76ca\u519c\u4e1a\u7b49\u5e94\u7528\u3002
2.\u521d\u59cb\u4ee3\u5e01\u53d1\u884c\uff08ICO\uff09
\u8bb8\u591a\u533a\u5757\u94fe\u9879\u76ee\u901a\u8fc7\u53d1\u884cERC20\u4ee3\u5e01\u8fdb\u884c\u521d\u59cb\u4ee3\u5e01\u53d1\u884c\uff08ICO\uff09\uff0c\u7528\u4e8e\u7b79\u96c6\u8d44\u91d1\u652f\u6301\u9879\u76ee\u5f00\u53d1\u3002
3.\u53bb\u4e2d\u5fc3\u5316\u5e94\u7528\uff08DApps\uff09
ERC20\u4ee3\u5e01\u5e7f\u6cdb\u5e94\u7528\u4e8e\u5404\u79cd\u53bb\u4e2d\u5fc3\u5316\u5e94\u7528\uff0c\u4f5c\u4e3a\u5e73\u53f0\u4e0a\u7684\u539f\u751f\u8d27\u5e01\u6216\u5956\u52b1\u673a\u5236\u3002
4.\u4ea4\u6613\u548c\u652f\u4ed8
\u8bb8\u591a\u52a0\u5bc6\u8d27\u5e01\u4ea4\u6613\u6240\u652f\u6301ERC20\u4ee3\u5e01\u7684\u4ea4\u6613\uff0c\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e9b\u4ee3\u5e01\u8fdb\u884c\u652f\u4ed8\u548c\u4ef7\u503c\u8f6c\u79fb\u3002<\/p>\n\n\n\n

\u4e94\u3001\u5e38\u89c1\u7684ERC20\u4ee3\u5e01<\/strong>
\u5df2\u7ecf\u6709\u8bb8\u591a\u57fa\u4e8eERC20\u6807\u51c6\u7684\u4ee3\u5e01\u5728\u4ee5\u592a\u574a\u4e0a\u53d1\u884c\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e9b\u77e5\u540d\u7684\u4f8b\u5b50\uff1a
USDT\uff08Tether\uff09\uff1a\u4e00\u79cd\u4e0e\u7f8e\u51431:1\u951a\u5b9a\u7684\u7a33\u5b9a\u5e01\uff0c\u7528\u4e8e\u964d\u4f4e\u52a0\u5bc6\u8d27\u5e01\u4ea4\u6613\u4e2d\u7684\u6ce2\u52a8\u98ce\u9669\u3002
LINK\uff08Chainlink\uff09\uff1aChainlink\u662f\u4e00\u4e2a\u53bb\u4e2d\u5fc3\u5316\u7684\u9884\u8a00\u673a\u7f51\u7edc\uff0c\u5176\u4ee3\u5e01LINK\u7528\u4e8e\u652f\u4ed8\u6570\u636e\u63d0\u4f9b\u8005\u7684\u8d39\u7528\u3002
UNI\uff08Uniswap\uff09\uff1aUniswap\u662f\u4e00\u4e2a\u53bb\u4e2d\u5fc3\u5316\u4ea4\u6613\u6240\uff08DEX\uff09\uff0c\u5176\u4ee3\u5e01UNI\u7528\u4e8e\u5e73\u53f0\u6cbb\u7406\u548c\u7528\u6237\u5956\u52b1\u3002
ERC20\u662f\u4ee5\u592a\u574a\u4e0a\u7684\u4e00\u79cd\u4ee3\u5e01\u6807\u51c6\uff0c\u5b83\u5b9a\u4e49\u4e86\u4e00\u5957\u7edf\u4e00\u7684\u89c4\u5219\u548c\u63a5\u53e3\uff0c\u4f7f\u5f97\u4e0d\u540c\u7684\u4ee3\u5e01\u53ef\u4ee5\u5728\u4ee5\u592a\u574a\u5e73\u53f0\u4e0a\u4e92\u76f8\u4ea4\u6362\u548c\u4f7f\u7528\u3002\u901a\u8fc7\u9075\u5faaERC20\u6807\u51c6\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u521b\u5efa\u548c\u53d1\u884c\u81ea\u5df1\u7684\u4ee3\u5e01\uff0c\u5e76\u5c06\u5176\u96c6\u6210\u5230\u4ee5\u592a\u574a\u751f\u6001\u7cfb\u7edf\u4e2d\uff0c\u4ece\u800c\u4e30\u5bcc\u4ee5\u592a\u574a\u7684\u5e94\u7528\u573a\u666f\u548c\u751f\u6001\u53d1\u5c55\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

ERC20\u5e76\u975e\u7279\u6307\u67d0\u4e00\u79cd\u5177\u4f53\u7684\u4ee3\u5e01\uff0c\u800c\u662f\u4e00\u4e2a\u5728\u4ee5\u592a\u574a\u533a\u5757\u94fe\u4e0a\u5e7f\u6cdb\u4f7f\u7528\u7684\u4ee3\u5e01\u6807\u51c6\u3002\u4e3a\u4e86\u66f4\u5168\u9762\u5730\u89e3\u91caERC20\uff0c\u4ece…<\/p>\n","protected":false},"author":3,"featured_media":1087,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[204],"_links":{"self":[{"href":"https:\/\/www.a88o.com\/wp-json\/wp\/v2\/posts\/1086"}],"collection":[{"href":"https:\/\/www.a88o.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.a88o.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.a88o.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.a88o.com\/wp-json\/wp\/v2\/comments?post=1086"}],"version-history":[{"count":1,"href":"https:\/\/www.a88o.com\/wp-json\/wp\/v2\/posts\/1086\/revisions"}],"predecessor-version":[{"id":1090,"href":"https:\/\/www.a88o.com\/wp-json\/wp\/v2\/posts\/1086\/revisions\/1090"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.a88o.com\/wp-json\/wp\/v2\/media\/1087"}],"wp:attachment":[{"href":"https:\/\/www.a88o.com\/wp-json\/wp\/v2\/media?parent=1086"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.a88o.com\/wp-json\/wp\/v2\/categories?post=1086"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.a88o.com\/wp-json\/wp\/v2\/tags?post=1086"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}