Contract: 0xdEdf20172b6dC39817026c125f52d4fad8E0f29b
Sample code: (https://github.com/Trading-Tiger/Pancakeswap_BSC_Sniper_Bot/blob/main/txns.py)
tokenInfos = self.swapper.functions.getTokenInformations(self.token_address).call()
buy_tax = round((tokenInfos[0] - tokenInfos[1]) / tokenInfos[0] * 100 ,2)
sell_tax = round((tokenInfos[2] - tokenInfos[3]) / tokenInfos[2] * 100 ,2)
The structure of tokenInfos
from the ABI:
output[0] = BuyEstimateOutput (probably using getAmountsOut from pancakeswap router)
output[1] = BuyRealOutput
output[2] = SellEstimateOutput
output[3] = SellRealOutput
I ran getTokenInformations()
to check if it actually works:
contract = '0xdEdf20172b6dC39817026c125f52d4fad8E0f29b'
token = '0x2A9718defF471f3Bb91FA0ECEAB14154F150a385' # random token taken from bscscan
contract = w.eth.contract(address=contract, abi=abi)
data = contract.functions.getTokenInformations(token).call()
print (data)
OUTPUT:
[132208265708940319, 118987440043519338, 8879124915279981, 7991215663722533, True, True, True]
There wasn't any state changing transactions on bscscan after running the code: https://bscscan.com/address/0xdEdf20172b6dC39817026c125f52d4fad8E0f29b.
getTokenInformations()
must be simulating the buy and sell functions.
So, this unverified contract is simulating pancakeswap (or uniswap) contract's state changing write functions and get the new state values.
How is that possible?