Skip to content

Commit

Permalink
updated types getMainParamsViem
Browse files Browse the repository at this point in the history
  • Loading branch information
Onipchenko-Andrey committed Oct 20, 2023
1 parent 6b5befd commit 8007c39
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/helpers/cauldron/getMainParamsViem.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { formatUnits } from "viem";
import type { PublicClient } from "viem";
import type { MainParams } from "@/types/cauldron";
import type { CauldronConfig } from "@/utils/cauldronsConfig/configTypes";
Expand All @@ -20,7 +19,7 @@ export const getMainParamsViem = async (

return await Promise.all(
cauldronMarketInfo.map(async (marketInfo: any, index: number) => {
const { contract, interest: localInterest } = configs[index];
const { contract, interest } = configs[index];

const contractExchangeRate = await publicClient.readContract({
...contract,
Expand All @@ -32,22 +31,18 @@ export const getMainParamsViem = async (
? contractExchangeRate !== marketInfo.oracleExchangeRate
: false;

const interest = localInterest
? localInterest
: +formatUnits(marketInfo.interestPerYear, 0) / 100;

return {
borrowFee: +formatUnits(marketInfo.borrowFee, 0) / 100,
interest,
liquidationFee: +formatUnits(marketInfo.liquidationFee, 2),
updatePrice,
borrowFee: Number(marketInfo.borrowFee) / 100,
liquidationFee: Number(marketInfo.liquidationFee) / 100,
interest: interest || Number(marketInfo.interestPerYear) / 100,
collateralPrice: marketInfo.collateralPrice,
mimLeftToBorrow: marketInfo.marketMaxBorrow,
maximumCollateralRatio: marketInfo.maximumCollateralRatio,
oracleExchangeRate: marketInfo.oracleExchangeRate,
totalBorrowed: marketInfo.totalBorrowed,
tvl: marketInfo.totalCollateral.value,
userMaxBorrow: marketInfo.userMaxBorrow,
updatePrice,
};
})
);
Expand Down

0 comments on commit 8007c39

Please sign in to comment.