I am new to dev in python with Web3.
I want to calculate the buy and sell tax for a token in uniswap.( like honeypot.is website, but directly onchain)
I search here and in google but i can't find any topics about this.
Thanks for your help.
The only reliable method how to get the taxes is to execute the transaction and measure its slippage. To do that:
Decide on the input amount of tokens to buy or sell.
Fork the blockchain at a recent block, using hardhat or a similar tool.
Calculate the expected output amount given your input amount, for example using a
Create and send a buy/sell transaction with the input amount, send it to the local hardhat instance, and measure the received output amount
Compare the expected output amount with the measured output amount. The difference is due to the sales tax.
Be aware that the owner of the contract typically is allowed to change the sales tax at a later point.