Want to get tokens amount sent to my contract address on chain, but don't know address of token.
Can I get through any function ?
Any possible way to so ?
If you know which address sent the token you can simple look at past transactions on etherscan, if you don't know that, I'm afraid these is no luck? I think if you are recieving an transaction it will show up.
Just go to etherscan using your contract address and look in the tab "ERC20 Token Txns". If some ERC20 were sent to you, these will be shown there.
Hope this helps