i created a contract, bought tokens, now i have tokens stored in the contract. I read if i want to transfer it back to my address, I need to approve the token and transfer. I created two functions approve and transfer. Not sure how to correctly implement it. can someone help in this matter?

Jan 3, 2021, 12:16 PM
By bought you mean minting?
Jan 3, 2021, 12:20 PM
i just used kovan test network, i used eth to buy dai token
Jan 3, 2021, 12:26 PM
from smart contract?
Jan 3, 2021, 12:27 PM
now the dai token is stored in the smart contract
yeah i deployed a smart contract using remix
Jan 3, 2021, 12:28 PM
Do your smart contract have any function to withdraw or calls?
Jan 3, 2021, 12:30 PM
I've got a withdraw function that sends eth from contract and sends it to owner. Im struggling to withdraw tokens in the contract and send it to owner
Jan 3, 2021, 12:37 PM
Call the transfer function of token from your contract
Jan 3, 2021, 12:38 PM
I dont have another contract specified for the token, as I am using uniswap router files and function. With like IUniswapV2Router02. Which is why I am not sure how to implement the approve and transfer with the technology. I have transfer function that works to send eth from contract but NOT with tokens in contract
Jan 3, 2021, 12:45 PM
The token contract in this case is DAI, which is already deployed.
call the DAI's transfer() function from your contract
Jan 3, 2021, 12:49 PM
I'll try that
Jan 3, 2021, 12:52 PM

© 2024 Draquery.com All rights reserved.