Moralis.executeFunction(approve) how to use max/unlimited allowance

How do i make it to approve the user token instead of the one i createdā€¦ should i just change the contract address?

It should be the same process, you need to change the contract address. As @cryptokid mentioned, the approved spender can call a transferFrom method to send the tokens

Ok Thanks for your replyā€¦ But what contract address do i change it to that will be able to approve the spender on all erc20 tokens.

You need to call approve for a specific erc20 token. You can read more about approve here

What if i want up to 7k token approval, I have to copy each smart contract address and use it on my dappā€¦ Thatā€™s very tiring.

Thank you for your replies you saved me from a lot of stress.

last question how do i specify a specific token in my code?

You can do an approval at a time from the client, you should be able to do multiple times using private key

That should be the spender passed to the approve function if I got your question right

My question is how do i specify the user to approve a specific tokenā€¦

for example a user has usdc and another one has busd how do make the approve function to know and approve the token

pls someone should help me

where should i copy the smart contract address to use?

You can find it on the explorer or on coinmarketcap

Youā€™ll have to determine that from your logics

Thank you very much for enlightening me you saved meā€¦ but what do you mean by logicā€™s? .

I mean within your code

Ok thank you very much

@qudusayo @cryptokid @wael_shikh @johnversus how do i automatically call the transferfrom on my smart contract when a user approves me to do the transfer on their behalf using javascript.

You should have the transferFrom in your contract, after the user approves the function, you can then call your contract function which calls the transferFrom method for the other contract.

God bless you manā€¦ should i use balanceOf if else statement to transfer a certain amount?

You should have a logic to determine the value to be transferred maybe