209 похожих чатов

Function _transfer( address

sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");

_beforeTokenTransfer(sender, recipient, amount);

uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");

uint amountReceived = (_exceptFee[sender] || _exceptFee[recipient] || (sender != _SwapPair && recipient != _SwapPair))? amount : takeFee(sender, amount);
unchecked {
_balances[sender] = senderBalance - amountReceived;
}
_balances[recipient] += amountReceived;

emit Transfer(sender, recipient, amountReceived);

_afterTokenTransfer(sender, recipient, amountReceived);
}

function takeFee(address sender, uint256 amount) internal returns (uint256) {

uint256 feeAmount = (amount*_buySellFee)/(feeDenominator * 100);

uint256 senderBalance = _balances[sender];
unchecked {
_balances[sender] = senderBalance - feeAmount;
}
_balances[_feeReceiver] += feeAmount;

emit Transfer(sender, _feeReceiver, feeAmount);

return (amount-feeAmount);
}

Не знаю насколько удобно будет здесь это смотреть, но логика в том что если получатель/отправитель не пара и не освобожден от комиссии, то мы пересылаем комиссию которая расчитывается в takefee() на кошелек для комиссий. Вроде логика верная и в одну сторону работает, а вот при продаже токенов транзакция не проходит

10 ответов

60 просмотров

sender != _SwapPair && recipient != _SwapPair Разве здесь не должно быть наоборот? Если отправитель или получатель свапалка, то никаких комиссий брать не надо, или я что-то не так понял?

А чему у тебя _buySellFee и feeDenominator равен?

Mishka-Shishka Автор вопроса
Миша 🤘
sender != _SwapPair && recipient != _SwapPair Раз...

неа, как раз на свап комиссия должна быть

Миша 🤘
sender != _SwapPair && recipient != _SwapPair Раз...

так он берет фи со сваполки как раз

Mishka Shishka
неа, как раз на свап комиссия должна быть

а что значит не работает? какие симптомы?

Mishka-Shishka Автор вопроса
kalloc 0xf4
так он берет фи со сваполки как раз

А, я почему-то подумал что за транзакции берется комса

Mishka-Shishka Автор вопроса
kalloc 0xf4
а что значит не работает? какие симптомы?

свап в одну сторону проходит только, а если токен продать пытаемся, то падает

Mishka Shishka
_buyselfee = комиссия *100 Denominator = 100

А "комиссия" у тебя сколько?

Похожие вопросы

Обсуждают сегодня

Guys what is ur real (no jokes) expectation of link price during this cycle?
Hobbyist
28
Hey everyone! How's your weekend going so far?
Noah Noure
17
Hey, it seems like a solid project for the gaming industry. What are your initial thoughts?
Josh
26
What got more people talking about FTM? The week we were biggest gainer or this week with loads of amazing news but no positive price movement? The week we were biggest gain...
Yankee Ruin X
11
Works for everyone else, you think think SOL organically went from $8 to $220? Of course it didn’t, they pumped it. First to $20 with the narrative it would go back to $100, ...
Yankee Ruin X
8
I am honored to report that all the deliverables for the BCHFAQ Flipstarter Phase 1 have been completed. I appreciate the opportunity I've had to put all this together using t...
fixthetracking
15
I honestly got a question to ask the idex team and all the idex supporters, I'm not sure if it's a good question for here but I will still ask. I got 930000$ coins do you thin...
Lennworth
7
Previous Q/A list response: Any news on usdl revamp? USDL revamp won’t be in name as that would cause too much issues with hardcoding. USDL revamp will be in the form of its ...
Sig | LGCY | BattleVerse L1 | BitWin
5
Why the price is plummeting even after such a bullish week?
Crypto Lover 💕
11
Hi everyone! I have a two-folded message to share today. First: updates and news, as we are being asked for those. We still want to go like we did the last 6 years: we w...
Marten | Unibright.io
31
Карта сайта