Contract approvals explanation

Can someone really explain to me what happens when I approve a smart contract in my wallet for example…

I created a smart contract (trc20) token A which I deployed in a tron network. I can send token a to a user and vice versa, I also have the swap function in my contract. Now before a user can swap token A (trc20) they must first call approve(_spender, amount ) which the spender is the contract right…?

Now my question is when the approve function is been called does it means that the contract has access to withdraw not just the token A(trc20) but also other trc20 tokens in a user’s wallet like usdt(trc20)?

Can something like this happen…?

Please someone should hell answer

@admin.hackathon
@DappProgrammer
@support.hackathon

17 Likes

It depends on the App you’re approving, but for most Decentralized exchanges, it is usually to approve the smart contract to transfer a particular token from your token.

They usually approve a large amount so that, you would not need to do the approval everytime you want to swap that token

6 Likes