在 Solidity 中使用转移的问题

问题描述

function withdraw(uint amount) public returns (bool){
    
    uint cethAmount = amount;
    uint bosAmount = cethAmount * 11;
    
    require(bosAmount <= balances[msg.sender]);
    require(address(this).balance >= cethAmount);
    
    balances[msg.sender] -= bosAmount;
    totalSupply_ -= bosAmount;
    
    payable(msg.sender).transfer(cethAmount);
    return true;
}

这段代码旨在将一个无符号整数作为输入并将该数量发送回用户代码执行到第 7 行 (totalSupply_ -= bosAmount;),但在那之后没有传输 cTH 并且输出不正确。 这也不会引发错误

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)