Hot answers tagged

2

Disclaimer: I don't think this is the correct method to calculate the price impact but it's almost 100% accurate for price impacts of less than 1%. This calculation method assumes that multi-hop is disabled i.e. swapping is restricted to direct pairs. I've only tested this calculation method on PancakeSwap and it is less accurate for larger trade sizes ...


1

Yes, it's possible. You can directly interact with UniswapV3 or Sushiswap router contracts to swap ETH to DAI and send that to a particular receiver address. Here's the example with Sushiswap (UniswapV2) router: payableAmount: ETH amount you want to swap path: [WETH, DAI] to: walletB


1

This is because IUniswapV2Router02.sol inherits IUniswapV2Router01.sol. Therefore you may think of Router02 interface as an extension of Router01 interface with all of its functions.


1

If you're swapping tokens with hard coded tax inside on their smart contract (in your case 10%). The "minimum token" appearing on the website is wrong, because it is based on normal token contract with no tax/fees.


1

Iv run into similar issues. In your truffle configuration file, make sure you enable optimization i. The compiler settings. Setting to 200 is fine. Essentially the fact that the contract code isn't optimized, you end up running out of gas Hope this helps, Alex


Only top voted, non community-wiki answers of a minimum length are eligible