Hi guys! Quick question (Would appreciate DMs). I'm trying to do a simple contract when I can deposit X amount of my simple erc20 token, but I receive a remix error (transfer amount exceeds allowance). Can anyone give me some hint of what I'm doing wrong please?

Jul 9, 2021, 6:02 PM
Re-read the error message again transfer amount exceeds allowance
Jul 9, 2021, 6:12 PM
I already checked, I have those tokens. Checked using the contract as well
Jul 9, 2021, 6:13 PM
You can't call approve and transferFrom in the same block of codes
Did you approve tokens from the sender's account to the Contract?
Jul 9, 2021, 6:14 PM
Doing an "allow()" method to execute before would work? Still not working this way
Jul 9, 2021, 6:14 PM
There's an approve function in your token contract. Call the function passing in the
contractB address
and
amount to deposit
Then try the deposit function again
Jul 9, 2021, 6:16 PM
Thank you, I'm going to try it
It's not what I did here?
Jul 9, 2021, 6:17 PM
Lol it won't work because the actual address calling token.approve is contractB
Jul 9, 2021, 6:18 PM
I should change address(this) for msg.sender?
Jul 9, 2021, 6:18 PM
Just use the step above and your deposit should work
Jul 9, 2021, 6:19 PM
Still same thing, maybe I'm not understand any concept. Can I DM you maybe? I can pay you a beer in BUSDs 💪
Jul 9, 2021, 6:21 PM
👆🏼
Jul 9, 2021, 6:21 PM

© 2024 Draquery.com All rights reserved.