fix: reserve overview and typos

This commit is contained in:
Justin Starry 2020-11-26 18:32:17 +08:00
parent 38af484525
commit f7677aaf80
3 changed files with 9 additions and 9 deletions

View File

@ -40,7 +40,7 @@ export const borrow = async (
depositReserve: ParsedAccount<LendingReserve>,
exsistingObligation?: ParsedAccount<LendingObligation>,
existingObligation?: ParsedAccount<LendingObligation>,
obligationAccount?: PublicKey
) => {
@ -58,8 +58,8 @@ export const borrow = async (
AccountLayout.span
);
const obligation = exsistingObligation
? exsistingObligation.pubkey
const obligation = existingObligation
? existingObligation.pubkey
: createUninitializedObligation(
instructions,
wallet.publicKey,
@ -69,8 +69,8 @@ export const borrow = async (
signers
);
const obligationMint = exsistingObligation
? exsistingObligation.info.tokenMint
const obligationMint = existingObligation
? existingObligation.info.tokenMint
: createUninitializedMint(
instructions,
wallet.publicKey,
@ -182,7 +182,7 @@ export const borrow = async (
const dexMarket = cache.get(dexMarketAddress);
if (!dexMarket) {
throw new Error(`Dex market doesn't exsists.`);
throw new Error(`Dex market doesn't exist.`);
}
const dexOrderBookSide = market.info.quoteMint.equals(

View File

@ -34,9 +34,9 @@ export const SideReserveOverview = (props: {
const borrowApr = calculateBorrowAPY(reserve);
const utilizationRate = calculateUtilizationRatio(reserve);
const liquidationThreshold = reserve.config.optimalUtilizationRate / 100;
const liquidationThreshold = reserve.config.liquidationThreshold / 100;
const liquidationPenalty = reserve.config.liquidationBonus / 100;
const maxLTV = liquidationThreshold - liquidationPenalty;
const maxLTV = reserve.config.loanToValueRatio / 100;
let extraInfo: JSX.Element | null = null;
if (mode === SideReserveOverviewMode.Deposit) {

View File

@ -118,7 +118,7 @@ export const calculateBorrowAPY = (reserve: LendingReserve) => {
const optimalUtilization = reserve.config.optimalUtilizationRate / 100;
let borrowAPY;
if (optimalUtilization == 1.0 || currentUtilization < optimalUtilization) {
if (optimalUtilization === 1.0 || currentUtilization < optimalUtilization) {
const normalizedFactor = currentUtilization / optimalUtilization;
const optimalBorrowRate = reserve.config.optimalBorrowRate / 100;
const minBorrowRate = reserve.config.minBorrowRate / 100;