这可能是因为在编译时没有启用调试模式或代码中未添加调试语句所致。如果您使用的是 Solidity,可以在代码中添加以下语句来打印 Token 信息:
function transfer(address to, uint amount) public {
// your transfer logic here
emit Transfer(msg.sender, to, amount);
// debug statement
printTokenInfo();
}
function printTokenInfo() public {
uint totalSupply = totalSupply();
string memory name = name();
uint decimals = decimals();
string memory symbol = symbol();
bool isPaused = paused();
address owner = owner();
emit TokenInfo(totalSupply, name, decimals, symbol, isPaused, owner);
}
在上面的示例中,printTokenInfo()
函数将调用 Token 的各种函数,并通过TokenInfo()
事件返回 Token 的信息。 如果您使用的是其他编程语言,则应查阅其文档并添加相应的调试代码。