dappuniversity / defi_tutorial

326 stars 407 forks source link

MetaMask - RPC Error #15

Open BlackH3art opened 2 years ago

BlackH3art commented 2 years ago

Hey Gregory,

I'm running to an issue in 2:23:30 of this tutorial, when it comes to test staking. After I approve spending token, metamask shows me an error:

image

And after I confirm that in MetaMask console displays me this error:

image

I was writing all the contract code on my own (TokenFarm.sol), but then I just copied this from repository, compiled it, and still running to the same issue.

Any idea about how to fix this error?

Jbry123 commented 2 years ago

going through this issue as well, one of the transactions worked, but now it's just doing this. I read that you can delete the json from the contracts and recompile them

Jbry123 commented 2 years ago

i solved it by clearing the json, truffle compiling, and connecting ganache by adding the truffle config file to ganache's desktop app

Juleshaydn commented 2 years ago

i solved it by clearing the json, truffle compiling, and connecting ganache by adding the truffle config file to ganache's desktop app

Which json are you clearing?

jmpf2018 commented 2 years ago

I have a similar issue, but the message is different: image Can anyone help me?

jatinmehrotra commented 2 years ago

@jmpf2018 did you solved the issue? i am also facing the same error

jeffmega commented 2 years ago

I have a similar issue, but the message is different: image Can anyone help me?

Hi, I had the same problem, it was to do with a time out. Try changing the stake method to async like this:-

stakeTokens = async (amount) => { this.setState({ loading: true }) await this.state.daiToken.methods.approve(this.state.tokenFarm._address, amount).send({ from: this.state.account }) await this.state.tokenFarm.methods.stakeTokens(amount).send({ from: this.state.account }) this.setState({ loading: false }) }