{"id":2732,"date":"2024-08-25T23:42:00","date_gmt":"2024-08-25T15:42:00","guid":{"rendered":"https:\/\/systw.net\/note\/?p=2732"},"modified":"2025-11-28T09:20:46","modified_gmt":"2025-11-28T01:20:46","slug":"solidity-token-issuance","status":"publish","type":"post","link":"https:\/\/systw.net\/note\/archives\/2732","title":{"rendered":"Solidity Token Issuance"},"content":{"rendered":"\n<p>\u5728 Solidity \u4e2d\uff0c\u4ee3\u5e63\u767c\u884c (Token Issuance) \u6307\u7684\u662f\u5275\u5efa\u65b0\u4ee3\u5e63\u4e26\u589e\u52a0\u7e3d\u4f9b\u61c9\u91cf\u7684\u904e\u7a0b\u3002\u9019\u662f\u4e00\u500b\u975e\u5e38\u57fa\u790e\u4e14\u91cd\u8981\u7684\u6982\u5ff5\uff0c\u56e0\u70ba\u5b83\u76f4\u63a5\u6c7a\u5b9a\u4e86\u4ee3\u5e63\u7684\u7d93\u6fdf\u6a21\u578b\u3002<\/p>\n\n\n\n<p>\u8981\u7528 Solidity \u767c\u884c\u4ee3\u5e63\uff0c\u4f60\u901a\u5e38\u9700\u8981\u5169\u500b\u6b65\u9a5f\uff1a<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li><strong>\u5b9a\u7fa9\u4ee3\u5e63\u6a19\u6e96<\/strong>\uff1a\u4f7f\u7528\u516c\u8a8d\u7684\u4ee3\u5e63\u6a19\u6e96\uff0c\u5176\u4e2d ERC-20 \u662f\u6700\u5e38\u7528\u7684\u53ef\u66ff\u63db\u4ee3\u5e63\u6a19\u6e96\u3002OpenZeppelin \u7684\u51fd\u5f0f\u5eab\u662f\u696d\u754c\u6a19\u6e96\uff0c\u56e0\u70ba\u5b83\u63d0\u4f9b\u4e86\u7d93\u904e\u56b4\u683c\u6e2c\u8a66\u7684\u3001\u5b89\u5168\u7684\u5408\u7d04\u3002<\/li>\n\n\n\n<li><strong>\u5be6\u65bd\u767c\u884c\u6a5f\u5236<\/strong>\uff1a\u4f60\u9700\u8981\u7de8\u5beb\u4e00\u500b\u51fd\u6578\u4f86\u547c\u53eb\u5e95\u5c64\u7684\u9444\u5e63\u51fd\u6578 (<code>_mint<\/code>)\u3002\u4f60\u6dfb\u52a0\u7684\u908f\u8f2f\u5c07\u6c7a\u5b9a\u8ab0\u53ef\u4ee5\u767c\u884c\u65b0\u4ee3\u5e63\u4ee5\u53ca\u5728\u4ec0\u9ebc\u689d\u4ef6\u4e0b\u767c\u884c\u3002<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-dots\"\/>\n\n\n\n<p>\u4ee5\u4e0b\u7528Sepolia \u6e2c\u8a66\u7db2\u4e0a\u6a21\u64ec USDT\u505a\u7bc4\u4f8b\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u6b65\u9a5f\u4e00\uff1a\u7de8\u5beb\u4ee3\u5e63\u5408\u7d04<\/h3>\n\n\n\n<p>\u53ef\u4ee5\u4f7f\u7528\u4e00\u500b\u57fa\u790e\u7684 ERC-20 \u5408\u7d04\u7bc4\u672c\u3002\u9019\u662f\u6700\u7c21\u55ae\u3001\u6700\u5b89\u5168\u7684\u505a\u6cd5\u3002Solidity\u4ee3\u78bc\u5982\u4e0b <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport \"@openzeppelin\/contracts\/token\/ERC20\/ERC20.sol\";\nimport \"@openzeppelin\/contracts\/access\/Ownable.sol\";\n\n\ncontract USDTR is ERC20, Ownable {\n    constructor() ERC20(\"Tether USD\", \"rUSDT\") Ownable(msg.sender) {\n        _mint(msg.sender, 1000000 * 10 ** 18); \n    }\n\n    function mint(address to, uint256 amount) public onlyOwner {\n        _mint(to, amount);\n    }\n}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u7a0b\u5f0f\u78bc\u8aaa\u660e<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li>\u9019\u6bb5\u7a0b\u5f0f\u78bc\u7e7c\u627f\u4e86 OpenZeppelin \u63d0\u4f9b\u7684\u5b89\u5168 ERC-20 \u6a19\u6e96\u3002<\/li>\n\n\n\n<li><code>constructor<\/code>\uff1a\u5408\u7d04\u90e8\u7f72\u6642\uff0c\u6703\u81ea\u52d5\u9444\u9020 1,000,000 \u500b\u4ee3\u5e63\u5230\u90e8\u7f72\u8005\u7684\u9322\u5305\u3002\u4ee3\u5e63\u7b26\u865f\u662f <code>rUSDT<\/code>\uff08\u4ee3\u8868 Raymond USDT\uff09\uff0c\u5c0f\u6578\u9ede\u4f4d\u6578\u8a2d\u5b9a\u70ba 18\uff0c\u9019\u8207\u771f\u5be6\u7684 USDT \u4e00\u81f4\u3002<\/li>\n\n\n\n<li><code>mint<\/code>\uff1a\u9019\u500b\u51fd\u6578\u53ea\u5141\u8a31\u5408\u7d04\u7684\u90e8\u7f72\u8005\u547c\u53eb\uff0c\u53ef\u4ee5\u81ea\u7531\u5730\u70ba\u4efb\u4f55\u5730\u5740\u9444\u9020\u4ee3\u5e63\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-dots\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u6b65\u9a5f\u4e8c\uff1a\u90e8\u7f72\u5408\u7d04\u5230 Sepolia \u6e2c\u8a66\u7db2<\/h3>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u4f7f\u7528 <strong>Remix IDE<\/strong> \u4f86\u90e8\u7f72\u9019\u500b\u5408\u7d04\u3002<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>\u6253\u958b <a href=\"https:\/\/remix.ethereum.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Remix<\/a>\u3002<\/li>\n\n\n\n<li>\u5728\u5de6\u5074\u7684\u6587\u4ef6\u700f\u89bd\u5668\u4e2d\uff0c\u5275\u5efa\u4e00\u500b\u65b0\u6a94\u6848\uff0c\u4f8b\u5982 <code>rUSDT.sol<\/code>\u3002\u5c07\u4e0a\u9762\u7684\u7a0b\u5f0f\u78bc\u8907\u88fd\u8cbc\u4e0a\u5230\u9019\u500b\u6a94\u6848\u4e2d\u3002<\/li>\n\n\n\n<li>\u5728\u5de6\u5074\u5c0e\u822a\u6b04\uff0c\u9ede\u64ca\u7de8\u8b6f\uff0c\u9078\u64c7 Solidity \u7248\u672c\u70ba <code>0.8.20<\/code> \u6216\u66f4\u9ad8\uff0c\u7136\u5f8c\u9ede\u64ca\u300cCompile <code>rUSDT.sol<\/code>\u300d\u3002<\/li>\n\n\n\n<li>\u5728\u5de6\u5074\u5c0e\u822a\u6b04\uff0c\u9ede\u64ca<strong>\u90e8\u7f72\u548c\u904b\u884c\u4ea4\u6613\u5716\u6a19<\/strong>\u3002\n<ul class=\"wp-block-list\">\n<li>\u5728\u300cEnvironment\u300d\u4e0b\u62c9\u9078\u55ae\u4e2d\uff0c\u9078\u64c7\u300c<strong>Injected Provider &#8211; MetaMask<\/strong>\u300d\u3002\u9019\u6703\u8b93\u4f60\u9023\u63a5\u5230 MetaMask \u9322\u5305\u3002<\/li>\n\n\n\n<li>\u78ba\u4fdd\u4f60\u7684 MetaMask \u5df2\u7d93\u5207\u63db\u5230 <strong>Sepolia \u6e2c\u8a66\u7db2<\/strong>\u3002<\/li>\n\n\n\n<li>\u5728\u300cContract\u300d\u4e0b\u62c9\u9078\u55ae\u4e2d\uff0c\u9078\u64c7\u300c<code>rUSDT<\/code>\u300d\u3002<\/li>\n\n\n\n<li>\u9ede\u64ca\u300cDeploy\u300d\u3002\u4f60\u7684 MetaMask \u6703\u5f48\u51fa\u4e00\u500b\u8996\u7a97\uff0c\u8b93\u4f60\u78ba\u8a8d\u4ea4\u6613\u3002\u78ba\u8a8d\u5f8c\uff0c\u5408\u7d04\u5c31\u6703\u88ab\u90e8\u7f72\u5230 Sepolia\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>\u90e8\u7f72\u5b8c\u6210\u5f8c\uff0c\u4f60\u53ef\u4ee5\u5728 Remix \u7684\u300cDeployed Contracts\u300d\u5340\u57df\u6216 Sepolia Etherscan \u4e0a\u770b\u5230\u4f60\u90e8\u7f72\u7684 <code>rUSDT<\/code> \u5408\u7d04\u5730\u5740\u3002\u9019\u500b\u5730\u5740\u5c31\u662f\u4f60\u81ea\u5df1\u7684\u6e2c\u8a66\u7528 USDT\u3002<\/p>\n\n\n\n<p>\u5047\u8a2d\u5730\u5740\u70ba 0xbd7ba6764f2b0a5cf4e3e1f74a0e925e4dd05e4b\uff0c\u53ef\u4ee5\u5728sepolia\u700f\u89bd\u5668\u5728token\u5340\u584a\u770b\u5230\u76f8\u95dc\u8a18\u9304 <a href=\"https:\/\/sepolia.etherscan.io\/token\/0xbd7ba6764f2b0a5cf4e3e1f74a0e925e4dd05e4b\" target=\"_blank\" rel=\"noopener\">https:\/\/sepolia.etherscan.io\/token\/0xbd7ba6764f2b0a5cf4e3e1f74a0e925e4dd05e4b<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-dots\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u6b65\u9a5f\u4e09\uff1a\u5728 MetaMask \u4e2d\u6dfb\u52a0\u4ee3\u5e63<\/h3>\n\n\n\n<p>\u5c31\u50cf\u4e4b\u524d\u6240\u8aaa\uff0c\u4f60\u9700\u8981\u624b\u52d5\u5c07\u9019\u500b\u65b0\u4ee3\u5e63\u6dfb\u52a0\u5230 MetaMask \u4e2d\u3002<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>\u8907\u88fd\u4f60\u525b\u525b\u90e8\u7f72\u7684 <code>rUSDT<\/code> \u5408\u7d04\u5730\u5740\u3002\u4f8b\u5982\u4e0a\u4e00\u6b65\u7684 0xbd7ba6764f2b0a5cf4e3e1f74a0e925e4dd05e4b<\/li>\n\n\n\n<li>\u6253\u958b MetaMask\uff0c\u5207\u63db\u5230 Sepolia \u7db2\u8def\u3002<\/li>\n\n\n\n<li>\u5728\u8cc7\u7522\u5217\u8868\u5e95\u90e8\uff0c\u9ede\u64ca\u300cImport tokens\u300d\u3002<\/li>\n\n\n\n<li>\u5c07\u5408\u7d04\u5730\u5740\u8cbc\u5230\u300cToken Contract Address\u300d\u6b04\u4f4d\u3002MetaMask \u6703\u81ea\u52d5\u8b58\u5225 <code>rUSDT<\/code> \u548c 18 \u4f4d\u5c0f\u6578\u9ede\u3002<\/li>\n\n\n\n<li>\u9ede\u64ca\u300cImport\u300d\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u5b8c\u6210\u9019\u4e9b\u6b65\u9a5f\u5f8c\uff0c\u4f60\u5c07\u5728\u9322\u5305\u4e2d\u770b\u5230 1,000,000 \u500b <code>rUSDT<\/code> \u4ee3\u5e63\u3002\u9019\u5c31\u662f\u4f60\u81ea\u5df1\u7684\u6e2c\u8a66 USDT <\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-dots\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u6b65\u9a5f\u56db\uff1a\u8a2d\u5b9a\u6e2c\u8a66\u7528\u7684\u6536\u6b3e\u5e33\u865f<\/h3>\n\n\n\n<p>\u6536\u6b3e\u5e33\u865f\u552f\u4e00\u9700\u8981\u505a\u7684\uff0c\u662f\u5728\u4ed6\u5011\u7684 MetaMask \u88e1\u624b\u52d5\u6dfb\u52a0 rUSDT \u9019\u500b\u4ee3\u5e63\u3002\u5c31\u50cf\u4f60\u7576\u521d\u5728\u9322\u5305\u88e1\u6dfb\u52a0\u9019\u500b\u4ee3\u5e63\u4e00\u6a23\uff0c\u4ed6\u5011\u9700\u8981\u8f38\u5165\u4f60\u90e8\u7f72\u7684 rUSDT \u5408\u7d04\u5730\u5740\u3002\u9019\u6a23\uff0c\u4ed6\u5011\u624d\u80fd\u5728\u9322\u5305\u4ecb\u9762\u88e1\u770b\u5230\u4f60\u8f49\u7d66\u4ed6\u5011\u7684\u4ee3\u5e63\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u4ed6\u5011\u6c92\u6709\u6dfb\u52a0\uff0c\u4f60\u8f49\u7d66\u4ed6\u5011\u7684 rUSDT \u4ecd\u7136\u6703\u5b89\u5168\u5730\u5b58\u5728\u4ed6\u5011\u7684\u9322\u5305\u88e1\uff0c\u53ea\u662f\u4ed6\u5011\u770b\u4e0d\u5230\u9918\u984d\uff0c\u5c31\u50cf\u9280\u884c\u5e33\u6236\u88e1\u6709\u4e00\u7b46\u9322\uff0c\u4f46\u4f60\u6c92\u6709\u958b\u555f\u986f\u793a\u9019\u7b46\u9322\u7684\u9801\u9762\u4e00\u6a23\u3002<\/p>\n\n\n\n<p>\u63a5\u8457\u5c31\u53ef\u4ee5\u958b\u59cb\u6e2c\u8a66\u8f49\u5e33\uff0c\u4f8b\u5982\u5728Metamask\u8f49\u5e331000\u5230\u6536\u6b3e\u5e33\u865f<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e3b\u5e33\u865f\uff1a\u5c11\u4e861000 rUSDT<\/li>\n\n\n\n<li>\u6536\u6b3e\u5e33\u865f\uff1a\u591a\u4e861000 rUSDT<\/li>\n\n\n\n<li>\u53ef\u67e5\u770b\u4ea4\u6613\u8a18\u9304\u5982\u4e0b<a href=\"https:\/\/sepolia.etherscan.io\/tx\/0xd07d472921b25e1416662351291c40a9f8dead7dd0ab735edf3206be32d0d905\" target=\"_blank\" rel=\"noopener\">https:\/\/sepolia.etherscan.io\/tx\/0xd07d472921b25e1416662351291c40a9f8dead7dd0ab735edf3206be32d0d905<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Solidity \u4e2d\uff0c\u4ee3\u5e63\u767c\u884c (Token Issuance) \u6307\u7684\u662f\u5275\u5efa\u65b0\u4ee3\u5e63\u4e26\u589e\u52a0\u7e3d\u4f9b\u61c9\u91cf\u7684\u904e\u7a0b\u3002\u9019\u662f\u4e00\u500b\u975e\u5e38\u57fa\u790e\u4e14\u91cd\u8981\u7684\u6982\u5ff5\uff0c\u56e0\u70ba\u5b83\u76f4\u63a5\u6c7a\u5b9a\u4e86\u4ee3\u5e63\u7684\u7d93\u6fdf\u6a21\u578b\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[373],"tags":[],"class_list":["post-2732","post","type-post","status-publish","format-standard","hentry","category-smart-contract-develop"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/2732","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/comments?post=2732"}],"version-history":[{"count":2,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/2732\/revisions"}],"predecessor-version":[{"id":2866,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/2732\/revisions\/2866"}],"wp:attachment":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/media?parent=2732"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/categories?post=2732"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/tags?post=2732"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}