0

I have this section of code in a contract of mine:

erc20.transferFrom(msg.sender, vault, cost);

When testing that my contract sends the erc20 tokens, I get this error:

Error: Transaction reverted: function returned an unexpected amount of data

(for the line mentioned above).

erc20 is a contract instance of USDT:

(in contract)

IERC20 internal erc20;

(constructor using '0xdAC17F958D2ee523a2206206994597C13D831ec7' for _erc20)

erc20 = IERC20(_erc20);

Ideally, I am trying to transfer a stable coin to a vault address (an EOA). To my knowledge, usdt and usdc are standard erc20 tokens that can be interfaced with OZ's IERC20 contract? If I have any misunderstandings, I'd love some explanations.

1 Answer 1

1

Make sure that your contract is approved to spend your ERC20 token, set the allowance to be high enough.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.