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 Answer
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