Search code examples
reactjsethereumsoliditysmartcontracts

Unable to Stake tokens to farm contract despite approving?


I have deployed a farm contract (BobaFarm) and I'm trying to stake tokens to the farm using a staking function (stakeTokens). I understand that in order to stake tokens to the farm, it requires an approval event so that the farm contract can transfer my tokens on my behalf. However, I'm not sure why whenever I try to stake tokens, the transaction faces "execution reverted".

Any help is appreciated, thanks!

[Removed code and link to contract as problem ahs been solved]


Solution

  • enter image description here

    Hey, I debuged your failed transaction https://ropsten.etherscan.io/tx/0x9561b25c1d95d436839d3246d3bbb590d2974bb4fa4a4117a51a75e28553416e

    The above shows that it should be a permission problem (Ownable: caller is not the owner)