I actually tried approve, but it didnt work. I have an UI, from UI, i called the token.approve() in token contract Then I am calling the getTokens() in another contract(code pasted above). Is there anything wrong I am doing?
– ggggJul 10 '18 at 19:11

I imagine that onlyUnlocked does a require. That means you have two require statements, and one of them is causing the revert. Remove one and see what happens to figure out which it is. Then continue debugging. (If it's onlyUnlocked, look at that code. If it's token.transferFrom, double check what token is and how tokenFrom is implemented. Check that the allowance for msg.sender is at least reward.stakedAmount.)
– user19510Jul 10 '18 at 19:19

And generally the sender needs to approve on the ERC20 Token and then the receiver can call transferFrom on the same Token afterwards. The sender approves the transfer to the receiver before the receiver “withdraws” from the sender.
– schemarJul 10 '18 at 20:12