Anyone knows how to use the balance of the wallet I'm calling a function with instead of the CA balance?
For example, if you call a swapback function (swapExactTokensForETH), it swaps the tokens of the CA balance to ETH.
How can I modify the functions so it will use the tokens in my dev wallet instead, without the need of adding the balance from my dev wallet to the CA balance beforehand?

Mar 6, 2023, 9:32 PM
Hi! What's CA?
Mar 6, 2023, 10:39 PM
Contract Address, address(this)
Mar 6, 2023, 10:40 PM
ah. You may use transferFrom the function. But you'll have to still allow() to the contract some amount of your tokens
Mar 6, 2023, 10:43 PM
Yeah, what I need basically an equivalent of the transferFrom function, but for swaps.
So far, the only way to make it work is to call the swapback function, that first transfers coins from the dev wallet to address(this) and then swaps the tokens from address(this) to ETH. But the transfer costs extra gas, which is unnecessary if I know a way to swap directly from the dev wallet instead of transferring the tokens to address(this) first.
Sadly I couldn't find something like a "from" version for swaps. All functions I found always use the msg.sender as "from" which in this case will be address(this)
Alright, thanks a lot. Will have a look into it. Appreciate it 👍
Mar 6, 2023, 11:06 PM

© 2024 Draquery.com All rights reserved.