I'm looking for a way to get the buy and sell tax of a Token and check if it can be sold once bought.
To do this, here's the method I thought about :
1-Simulate a Buy transaction on the DEX Router Contract
2-Simulate a Sell transaction on the DEX Router Contract
3-If the 2 above transaction are succesfull I can know the sale tax and Buy tax + know if the token is "sellable"
Since I'm using calls and not real transaction to simulate the buy/sell of the token, I need to make multi calls to simulate the alteration of the blockchain state.
I'm using the ethereum-multicall library to do this.
Here's my code :
const multicall = new Multicall({ethersProvider: _EVM.provider, tryAggregate: true});
let amoutIn = ethers.utils.parseUnits('300',18);
let timestamp = Date.now() + 1000 * 60 * 10;
const contractCallContext =[
{
reference: 'Router',
contractAddress: _EVM.DEX.router,
abi: JSON.parse(Router_ABI),
calls:[{reference:'foo', methodName:'swapExactTokensForTokens', methodParameters:[amoutIn,0,[ASDC, MIM],"0xa37Aa5C9A682490C64bDC32e60E627A50B66a485",timestamp]}]
}];
let result = await multicall.call(contractCallContext);
the problem is that I constantly get unsuccesfull return value from Multicall smartcontract...
Is there any other way to achieve what I'm looking for ? Or is there a problem with my code ?
Thanks in advance