0

For example, if wallet A calls a method of contract B, and this method authorizes Token X from wallet A to contract C, can the contract B do this?

1

1 Answer 1

1

No, as approve method sets the approvance for caller balance, that's why if the B contract calls the method, the approvance will be set for the B balance, not the A account. This is the standard and secure behaviour, that's why you send the approve transaction before swap.

Openzeppelin source - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/9e3f4d60c581010c4a3979480e07cc7752f124cc/contracts/token/ERC20/ERC20.sol#L142

Your Answer

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

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