【问题标题】:What if we don't emit event in smartcontract如果我们不在智能合约中发出事件怎么办
【发布时间】:2021-08-23 00:42:24
【问题描述】:

在 ERC20 接口中,有 2 个事件要实现。 ​

event Transfer(address indexed from, address indexed to, uint256 value);

event Approval(address indexed owner, address indexed spender, uint256 value);

如果我们实际实现了转移和批准功能但从不发出事件怎么办。交易是否仍会出现在 bscscan 或 etherscan 上,还是只有交易者知道的安静交易?

【问题讨论】:

    标签: solidity erc20 bep20


    【解决方案1】:

    BscScan 和 EtherScan 使用Transfer() 事件来更新其代币持有者的统计数据,并在交易详情页面中显示转移的代币数量。

    如果你不发出事件,它

    • 不会在transaction detail 页面中显示“已转移令牌”字段
    • 不会在 Etherscan 上更新发送方和接收方的代币余额(例如在他们的 address detail 页面上)

    但合约仍会转移代币,而 Etherscan 仍会显示 transaction detail 页面(只是没有代币数据)。

    【讨论】:

    猜你喜欢
    • 2021-10-31
    • 2023-03-09
    • 2021-12-01
    • 1970-01-01
    • 2011-06-22
    • 2022-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多