From 90b9183ae18cb727c364eef28d067f571748a0a8 Mon Sep 17 00:00:00 2001 From: bonedaddy Date: Thu, 25 Mar 2021 19:35:06 -0700 Subject: [PATCH] adjust decimal handling --- bclient/pool.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bclient/pool.go b/bclient/pool.go index 430bfb8..28c1e34 100644 --- a/bclient/pool.go +++ b/bclient/pool.go @@ -110,7 +110,12 @@ func (c *Client) GetTotalValueLocked(ip IndexPool, mc *multicall.Multicall, logg if err != nil { return 0, errors.Wrap(err, "failed to get exchange amount") } - tokenEthPriceDec := utils.ToDecimal(tokenEthPrice, int(decimals[addr])) + // we should be able to just handle decimals of 18 here and not worry + // about the commented out code, i think this is the case because we are calculating + // price of the uniswal pair which is 18 + tokenEthPriceDec := utils.ToDecimal(tokenEthPrice, 18) + // todo(bonedaddy): may need to reconsider handling this + // tokenEthPriceDec := utils.ToDecimal(tokenEthPrice, int(decimals[addr])) ethDaiPrice, err := c.EthDaiPrice() if err != nil {