Hey guys, how to implement a fee only on sell transaction ? I mean how to differentiate between buy and sell ?

Jun 26, 2021, 10:34 PM
You don’t
A token contract doesn’t buy or sell… it just transfers
You could check if the to address is an AMM, but there’s more than one
But does it go via the router or the pool contract?
Jun 26, 2021, 10:41 PM
Thanks guys, indeed that is the solution 😊.
that was my next question
I found this guys implementing a SC with 10% fees on sells only : https://bscscan.com/address/0x72b4404a20b6342ce3d8a9707316a07cbff9063d#code
But I don't understand the logic .....
the magic happens here :
if (_fromFees[sender] == true || _toFees[recipient] == true)
taxTransfer = true;
_fromFees and toFees are defined as mapping in the contract
Jun 26, 2021, 10:54 PM
function addFromFees(address feeAddress) public onlyOwner{
_fromFees[feeAddress] = true;
}

function addToFees(address feeAddress) public onlyOwner{
_toFees[feeAddress] = true;
}

One / both of the functions above has been called and
Router address
was passed an argument when the function was invoked
Jun 26, 2021, 11:12 PM
Yeah, thanks a lot buddy. According to @Plicostan we can say it is a buy when the source is Pancakeswap, I assume that _fromFees was defined with Pancakeswap router address.
thanks a lot
I will make tests and share with you
Jun 26, 2021, 11:36 PM
👍
If you invest in this project do watch out for this lines of codes in the _transfer
if (sender != owner() && _isFrozen)
{
revert("token is frozen");
}
Jun 26, 2021, 11:40 PM
u know its a buy if from is a pair
u know its a sell if to is a pair

but u dont know if its a pair 👀

usually u only know the BNB pair in constructor

but i can make a BUSD or USDT pair and it does not count as sell ;)
freezeToken() public onlyOwner

yes. that is scam
Jun 26, 2021, 11:44 PM
I did not, it is a very nice trick. I assume it was for deploying SC and creating LP and not be targeted by the bots. They controlled when trading was enabled. That is what I understand from the code
they renounced to ownership 😊
I don't get you bro 😊
I did not invested in the project, I am interested in they SC because they implemented a fee only on the sell, and it is very interesting
Jun 26, 2021, 11:49 PM
https://www.tikitoken.finance
Separated contract i think they have different taxes when buy and when sell but don't remember. I will work next week on change some stuff in this code
Jun 27, 2021, 12:12 AM
need audit that doesnt look like an automated report from the 1970s, if anyone can suggest
seriously though, need audit for complex token, any suggestion of competent auditors?
Jun 27, 2021, 1:54 AM
Hi guys, I made tests and you should deploy the contract and specicfy Pancakeswap router in addToFees function and it is working perfectly 😊
Jun 27, 2021, 10:29 PM

© 2024 Draquery.com All rights reserved.