I already have a contract in tron, but it only accepts tron and what I want is for it to accept the SUN token
Nov 22, 2020, 7:20 AM
The problem is that even if user transfers tokens to the contract the contract doesn't know about it and can't react to it.
So you should use approve & transferFrom scheme - first the user approves for your contract to withdraw tokens and then your contracts withdraws them.
So you should use approve & transferFrom scheme - first the user approves for your contract to withdraw tokens and then your contracts withdraws them.
Nov 22, 2020, 9:42 AM
First the user must approve the contract to use the usd using the "Approve" function after the contract verifies that the user approved the tokens using the "Allowance" function and then use TransferFrom to send the user tokens to the contract.
Nov 22, 2020, 6:48 PM