I'm trying to swap a pair not having wbnb on pancakeswap. For ex. BUSD -> LUNA. As far as the pair doesn't have wbnb I use swapExactTokensForTokens (meanwhile WBNB -> BUSD with swapExactETHForTokens works well)
Preparing transaction call and trying to estimate gas beforehand, but it fails with
web3.exceptions.ContractLogicError: execution reverted
build function..
func = self._router_contract.functions.swapExactTokensForTokens( <= self._router_contract - pancake router2
20000000000000000, <= amount_min
79925366079999995746, <= amount_out_min
['0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', '0x55d398326f99059fF775485246999027B3197955', '0x156ab3346823B651294766e23e6Cf87254d68962'], <= path BUSD->USDT->LUNA
self._settings.self_address, <= my wallet
1652635609, <= deadline
)
Вот сама оценка газа
func.estimateGas(
{
"from": self._settings.self_address,
"value": amount_min,
"gas_price": gas_price,
}
)
Digging for many hours, but no success(
Best Answer
This may have to do with the state of the LUNA liquidity pool. You may be trying to buy more LUNA than exists, given your inputs and the low price of LUNA. Try using the periphery contract quote() function and/or the pair's getReserves() to verify the amounts in question.
It's not clear to me why your question includes the fact that WBNB->BUSD works well, when based on the question, it seems you're actually trying to go BUSD->WBNB->LUNA.