Hello
in my contract I have this function 👇🏼
function approveTransfer() external
{
IERC20 token = IERC20(tokenContract);
token.approve(address(this), amount);
}
when I try to call it using metamask for account1 , I have no error
when I go to the contract of the token in question to check the allowance , I find Zero
what could be possible cause ?
thanks
Jan 9, 2023, 1:26 PM
what address' allowance do you check?
metamask wallet or the contract one?
Jan 9, 2023, 1:42 PM
The contract address
Jan 9, 2023, 2:00 PM
can you share the tx?
Jan 9, 2023, 2:00 PM
https://goerli.etherscan.io/tx/0x724fe5369bf9df56c0804eac7d8022c99f13009f2283885a1490ebcd3c8b72da#eventlog
the strange thing I see the address of the contract in both param
Jan 9, 2023, 2:04 PM
wait a second
why you are approving itself?
why you are approving itself?
of course
you are telling the contract to approve itself
Jan 9, 2023, 2:04 PM
humm should it be msg.sender ?
Jan 9, 2023, 2:05 PM
what are you trying to do
Jan 9, 2023, 2:05 PM
Im trying POC , of transfer from , ignore the funny name 😊 I want the end user when calling approveTransfer() , the allow my contract to spend his DAI
Jan 9, 2023, 2:08 PM
then you can't do in that way
you must call approve manually
Jan 9, 2023, 2:08 PM
ah
what do you mean manually ?
Jan 9, 2023, 2:09 PM
the user
has to call approve on DAI contract directly
Jan 9, 2023, 2:09 PM
ahhh
thanks
bouff the time I lost trying it this morning 😤 , thanks guys
ah
ok Im not there yet 🙏🏼
Jan 9, 2023, 3:25 PM