Open Schiocco opened 1 year ago
I can give some help if you need.
Hi,
Great thanks for letting me know. I will contact you in the future if I need help.
Thank you!
[image: SCHIOCCO] https://schiocco.com/
On Mon, 12 Dec 2022 at 10:08, PatDoe @.***> wrote:
I can give some help if you need.
— Reply to this email directly, view it on GitHub https://github.com/web3p/web3.php/issues/307#issuecomment-1346209728, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPCLVA2NRG4ASAXPOQXV7TWM32SZANCNFSM6AAAAAASOLVX2M . You are receiving this because you authored the thread.Message ID: @.***>
Hi
I want to thank you very much who made this PHP version of Web3. Unfortunately, there is no documentation and it is almost impossible to do anything, including very simple things like getting an encoded ABI string. While this is obvious for most libraries, in the case of Web3 the problem is much bigger because the libraries in other languages (e.g. JS) have completely different methods and structures, making it very hard to convert the code to another language, impossible in most cases.
I have now lost 20 hours and about $100 USD(yes, I must use mainnet because other testnets are not working the same as mainnet and this is confirmed by the fact that the exact same code works for mainnet but not on testnets) to make working the Uniswap function swapExactTokensForETH or swapExactTokensForTokens.
Online there is no PHP version help and JS version is totally different. E.g. it uses a method TransferFrom that does not exist in the PHP version. I know the error is the below:
You need to firstly approve DAI from your wallet to your contract address and then you can add this line after your approval call in the trade function:
With JS version is easy:
IERC20(address(token)).approve(address(router), amountToApprove);
Unfortunately, it is impossible to understand how to do it via PHP version. I tried a lot of variants like below but none is working:I call this code with this function:
Mind that I'm able to use swapExactETHForTokens, it works, so all shared code parts are working.
It is very frustrating to have a PHP library and know that it can do what you need, but not be able to do anything due to a lack of documentation or any tutorial online. Does anyone know how to make it work? I can hire and pay as well.
Thank you! Regards