Токен BEP20 - сумма перевода не является вычитанием полной суммы из адреса отправителя [закрыто]

Меня заблокировало что-то очень странное ... По какой-то причине процесс перевода не списывает полную сумму с Адреса отправителя.

Пример: Налоговая комиссия = 10% Комиссия за благотворительность = 10% Комиссия за сжигание = 0% Отправка 10.000 монет с адреса A (сумма 10.000) на адрес B (сумма 0), мы должны получить -> Отправитель = 0 / Получатель = 8.000 / Налоговый адрес = 1.000 / Благотворительный адрес = 1.000 ВЫДАЧА -> Адрес отправителя = 2.000, и общий объем предложения не меняется !!!

Посмотреть полный код ->https://github.com/OurSocialCoin/SocialCoin/blob/main/7_SocialCoin.sol

Спасибо!

Кроме того, когда я пытаюсь проверить контракт, я получаю эту ошибку:https://user-images.githubusercontent.com/84087791/118147648-17667880-b410-11eb-9a62-6e1ed2fd8b64.png

      function _transfer(address sender, address recipient, uint256 amount) private {
    require(sender != address(0), "TOKEN20: transfer from the zero address");
    require(recipient != address(0), "TOKEN20: transfer to the zero address");
    require(amount > 0, "Transfer amount must be greater than zero");

    // Remove fees for transfers to and from charity account or to excluded account
    bool takeFee = true;
    if (_isCharity[sender] || _isCharity[recipient] || _isExcluded[recipient]) {
        takeFee = false;
    }

    if (!takeFee) removeAllFee();
    
    
    if (_isExcluded[sender] && !_isExcluded[recipient]) {
        _transferFromExcluded(sender, recipient, amount);
    } else if (!_isExcluded[sender] && _isExcluded[recipient]) {
        _transferToExcluded(sender, recipient, amount);
    } else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
        _transferStandard(sender, recipient, amount);
    } else if (_isExcluded[sender] && _isExcluded[recipient]) {
        _transferBothExcluded(sender, recipient, amount);
    } else {
        _transferStandard(sender, recipient, amount);
    }

    if (!takeFee) restoreAllFee();
}

function _transferStandard(address sender, address recipient, uint256 tAmount) private {
    uint256 currentRate =  _getRate();
    (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tBurn, uint256 tCharity) = _getValues(tAmount);
    uint256 rBurn =  tBurn.mul(currentRate);
    uint256 rCharity = tCharity.mul(currentRate);     
    _standardTransferContent(sender, recipient, rAmount, rTransferAmount);
    _sendToCharity(tCharity, sender);
    _sendToTax(tFee, sender);
    _reflectFee(rFee, rBurn, rCharity, tFee, tBurn, tCharity);
    emit Transfer(sender, recipient, tTransferAmount);
}

function _standardTransferContent(address sender, address recipient, uint256 rAmount, uint256 rTransferAmount) private {
    _rOwned[sender] = _rOwned[sender].sub(rAmount);
    _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
}

function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
    uint256 currentRate =  _getRate();
    (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tBurn, uint256 tCharity) = _getValues(tAmount);
    uint256 rBurn =  tBurn.mul(currentRate);
    uint256 rCharity = tCharity.mul(currentRate);
    _excludedFromTransferContent(sender, recipient, tTransferAmount, rAmount, rTransferAmount);        
    _sendToCharity(tCharity, sender);
    _sendToTax(tFee, sender);
    _reflectFee(rFee, rBurn, rCharity, tFee, tBurn, tCharity);
    emit Transfer(sender, recipient, tTransferAmount);
}

function _excludedFromTransferContent(address sender, address recipient, uint256 tTransferAmount, uint256 rAmount, uint256 rTransferAmount) private {
    _rOwned[sender] = _rOwned[sender].sub(rAmount);
    _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
    _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);    
}


function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
    uint256 currentRate =  _getRate();
    (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tBurn, uint256 tCharity) = _getValues(tAmount);
    uint256 rBurn =  tBurn.mul(currentRate);
    uint256 rCharity = tCharity.mul(currentRate);
    _excludedToTransferContent(sender, recipient, tAmount, rAmount, rTransferAmount);
    _sendToCharity(tCharity, sender);
    _sendToTax(tFee, sender);
    _reflectFee(rFee, rBurn, rCharity, tFee, tBurn, tCharity);
    emit Transfer(sender, recipient, tTransferAmount);
}

0 ответов

Другие вопросы по тегам