diff --git a/src/external-api.ts b/src/external-api.ts index cbaaf0c..862f8a8 100644 --- a/src/external-api.ts +++ b/src/external-api.ts @@ -16,10 +16,10 @@ export const _getPoolsFromApi = memoize( ) export const _getUserCollateral = memoize( - async (network: INetworkName, controller: string, user: string, collateralDecimals = 18): Promise => { + async (network: INetworkName, controller: string, user: string): Promise => { const url = `https://prices.curve.fi/v1/crvusd/collateral_events/${network}/${controller}/${user}`; const response = await axios.get(url, { validateStatus: () => true }); - return crvusd.formatUnits(crvusd.parseUnits(response.data.total_collateral ?? "0.0", 0), collateralDecimals); + return response.data.total_deposit; }, { promise: true, diff --git a/src/llammas/LlammaTemplate.ts b/src/llammas/LlammaTemplate.ts index 58e20cb..be97038 100644 --- a/src/llammas/LlammaTemplate.ts +++ b/src/llammas/LlammaTemplate.ts @@ -466,7 +466,7 @@ export class LlammaTemplate { public async userLoss(userAddress = ""): Promise<{ deposited_collateral: string, current_collateral_estimation: string, loss: string, loss_pct: string }> { userAddress = _getAddress(userAddress); const [deposited_collateral, _current_collateral_estimation] = await Promise.all([ - _getUserCollateral(crvusd.constants.NETWORK_NAME, this.controller, userAddress, this.collateralDecimals), + _getUserCollateral(crvusd.constants.NETWORK_NAME, this.controller, userAddress), crvusd.contracts[this.address].contract.get_y_up(userAddress), ]); const current_collateral_estimation = crvusd.formatUnits(_current_collateral_estimation, this.collateralDecimals);