EatTheBlocks Forum

Dex frontend error for Web3

I am on Dex session 7 ( Loading component) of 6-figures blockchain, and I could see the below error on frontend.

Any direction to solve this error would be much appreciated.

Hey did you find any solution?

No… Nothing yet on this. It seems to me a Web3 issue, but I am not getting anything to solve this problem.

seems like you havent deployed the contract to local ganache before.

@jklepatch, thanks for your inputs :slight_smile:
I think I did a slight mistake, in the session migration file was name as " 2_deploy_contracts.js" whereas I renamed it to “deploy_contracts.js”. This rectification did solve the issue.

Then I got a timeout error ( Invalid JSON RPC) on migrate --reset for Dex.json, turned out that the gap that we are trying to introduce while creating trades i.e. example -
await dex.createLimitOrder(BAT, 1000, 10, SIDE.BUY, {from: trader1});
await dex.createMarketOrder(BAT, 1000, SIDE.SELL, {from: trader2});
await time.increase(1);
leads to a timeout error.

I have moved some of the code from util.js to LoadContainer.js.

When i commented out that line, now I have an error on the webpage
" cannot read reduce property of null on LoadContainer.js on below line
const tokenContracts = tokens.reduce((acc, token) => ({
If you are following the session, you can find the above syntax in util.js
Is there a way to resolve this issue ?

happy to help :slight_smile:

a bit hard for me to debug if you do some customization to the code :frowning:
Try to run the exact code as it is on Github, it works :slight_smile:

Hey Julien,
I set the code as it is in github, it then gives below error on migrate command.

Could you tell me what is triggering this issue ?

seems like a random error from Ganache or Infura.
Did this happen when you were trying to deploy a contract?
On which network?

It’s on my local ganache network.

If I comment out the time increase statements while creating trades, migration works… but then I get a ABI decoder error ( earlier UI screenshot ). What could be causing this ABI error.

I suggest to try again, with the exact code that is on github. You probably have a typo somewhere in your code.

Its working…
Thanks @jklepatch Saved a lot of time

1 Like

Hello @jklepatch, I’m getting the same error. The frontend is showing “Loading…”.

I comment the statement bellow in the LoadingContainer.js file and it works but I don’t know if will give some problem in the future.

Before, another problem occur whit Dex.json file that is not on “src” folder. I copy the “contracts” folder from “build” folder to the “src” folder as you can see above. It works, but again, I don’t know if will cause some problem in the future.

For DEX.json not an src, this is explained in one of the video :slight_smile: You need to customize build path in truffle config. For the undefined error, you probabl have a typo somewhere. Checkout the JS console for any error.