OmegaSyndicate / dex-interface

0 stars 0 forks source link

Price of DFP2 can not be calculated when no wallet is connected #25

Open timanrebel opened 2 years ago

timanrebel commented 2 years ago

When no wallet is connected, TheGraph's subgraph is used to calculate the TVL. However, to calculate the price of DFP2 the code assumes the dexBalance is available from Ethereum, while it should use the balance from the subgraph as well, resulting in an uncaught exception.

Screenshot 2022-05-24 at 17 03 35

It traced it back to line 525 in transaction.ts:

const bigPrice = tvl.mul(1000).div(16).div(this.tokenService.govToken.balanceDEX);