4

请问怎样才能把课程中的“发送以太币“的功能改成用“以太币购买代币”,以及取消“直接给...

 3 years ago
source link: https://learnblockchain.cn/question/2309
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

20 请问怎样才能把课程中的“发送以太币“的功能改成用“以太币购买代币”,以及取消“直接给创建的地址发送免费代币”的功能?

在”以太坊网页钱包开发的课程“中,现有的功能是:
1)提供了ETH和代币的转发
2)直接给创建的地址发送免费10000代币

请问怎样才能能直接在“TutorialToken.sol"中,把以上功能改成:
1)用ETH购买自己的代币
2)取消直接给创建的地址发送免费的代币

最好能有具体的代码,谢谢
image.png

最佳答案 2021-07-13 10:37

  1. 用ETH购买代币, 在这个视频里有介绍, 写一个函数接收用户的 ETH,根据数量和设定的价格换算为代币数量发送给用户。
  2. 删除掉对应的函数即可。
Tiny熊 - 布道者
擅长:智能合约,以太坊 | 采纳率 39% | 回答于 2021-07-13 10:29

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK