在煎饼交换上购买/出售时,ERC20代币如何设定税收支架?

发布于 2025-02-07 05:36:26 字数 252 浏览 3 评论 0原文

我创建了ERC20(与OpenZepplin的基本),可以在煎饼中添加液体。购买,我需要的是:

  • 当用户在煎饼上购买令牌时,我需要将3%的BNB转移到所有者地址。
  • 当用户在煎饼上出售令牌时,我需要将3%的代币转移到所有者地址。

我已经研究并发现:在功能_传输中,我们可以从/到pancake Pair Pair地址,然后我们知道客户正在买卖。购买我不知道如何将税收转移到另一个地址(前所有者地址)。

谢谢。

I created ERC20 (just basic with Openzepplin), I can add liquid to Pancake. Buy, what I need is:

  • When users buy token on Pancake, I need to transfer 3% amount BNB to Owner Address.
  • When users sell token on Pancake, I need to transfer 3% amount Token to Owner Address.

I've research and found that: in function _transfer, we can detect from/to is pancake pair address, then we know client is buying or selling. Buy I dont know how to transfer tax to another address (ex Owner address).

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜光 2025-02-14 05:36:26

您可以使转移功能应付款并写入逻辑以转移百分比。

You can make the transfer function to payable and write your logic in to transfer the percentage.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文