Skip to content

Commit

Permalink
Merge pull request #705 from liquity/various-changes
Browse files Browse the repository at this point in the history
App: various changes
  • Loading branch information
bpierre authored Jan 17, 2025
2 parents 54c644c + 3947e55 commit 0b3d73e
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 34 deletions.
23 changes: 11 additions & 12 deletions frontend/app/src/comps/Positions/PositionCardLeverage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,9 @@ export function PositionCardLeverage({
}

const collateralPriceUsd = usePrice(token.symbol);
if (!collateralPriceUsd.data) {
return null;
}

const maxLtv = dn.from(1 / token.collateralRatio, 18);
const ltv = getLtv(deposit, borrowed, collateralPriceUsd.data);
const ltv = collateralPriceUsd.data && getLtv(deposit, borrowed, collateralPriceUsd.data);
const liquidationRisk = ltv && getLiquidationRisk(ltv, maxLtv);
const redemptionRisk = getRedemptionRisk(interestRate);

Expand Down Expand Up @@ -134,14 +131,16 @@ export function PositionCardLeverage({
fontSize: 14,
})}
>
<div
className={css({
color: "positionContent",
})}
>
{liquidationRisk === "low" ? "Low" : liquidationRisk === "medium" ? "Medium" : "High"}{" "}
liquidation risk
</div>
{liquidationRisk && (
<div
className={css({
color: "positionContent",
})}
>
{liquidationRisk === "low" ? "Low" : liquidationRisk === "medium" ? "Medium" : "High"}{" "}
liquidation risk
</div>
)}
<StatusDot
mode={riskLevelToStatusMode(liquidationRisk)}
size={8}
Expand Down
8 changes: 4 additions & 4 deletions frontend/app/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ export const MAX_LTV_ALLOWED_RATIO = 0.916; // ratio of the max LTV allowed by t
export const MAX_LTV_RESERVE_RATIO = 0.04; // ratio of the max LTV in non-limited mode (e.g. when updating a position), to prevent reaching the max LTV

export const ETH_MAX_RESERVE = dn.from(0.1, 18); // leave 0.1 ETH when users click on "max" to deposit from their account
export const ETH_GAS_COMPENSATION = dn.from(0.0375, 18); // see contracts/src/Dependencies/Constants.sol

export const MIN_ANNUAL_INTEREST_RATE = dn.from(0.005, 18); // 0.5%
export const MAX_ANNUAL_INTEREST_RATE = dn.from(2.5, 18); // 250%
export const ETH_GAS_COMPENSATION = dn.from(0.0375, 18); // see contracts/src/Dependencies/Constants.sol
export const MIN_ANNUAL_INTEREST_RATE = dn.from(0.005, 18); // 0.5% see contracts/src/Dependencies/Constants.sol
export const MAX_ANNUAL_INTEREST_RATE = dn.from(2.5, 18); // 250% see contracts/src/Dependencies/Constants.sol

export const INTEREST_RATE_MIN = 0.5; // 0.5% annualized
export const INTEREST_RATE_MAX = 250; // 250% annualized
export const INTEREST_RATE_MAX = 25; // 25% annualized
export const INTEREST_RATE_DEFAULT = 4;
export const INTEREST_RATE_INCREMENT = 0.1;

Expand Down
12 changes: 6 additions & 6 deletions frontend/app/src/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,20 +191,20 @@ export default {
myPositionsTitle: "My positions",
actions: {
borrow: {
title: "Borrow BOLD",
description: "Set your own interest rate and borrow BOLD against ETH and staked ETH.",
title: "Borrow",
description: "Mint BOLD against your collateral at whatever interest rate you want",
},
multiply: {
title: "Multiply ETH",
description: "Set your own interest rate and increase your exposure to ETH and staked ETH.",
title: "Multiply",
description: "Increase your exposure to ETH and its staking yield with a single click",
},
earn: {
title: "Earn with BOLD",
description: "Cover liquidations to earn BOLD and collateral assets.",
description: "Deposit BOLD to earn protocol revenues and liquidation proceeds",
},
stake: {
title: "Stake LQTY",
description: "Accrue voting power by staking your LQTY without a minimum lockup period.",
description: "Direct protocol incentives with LQTY while earning from Liquity V1",
},
},
statsBar: {
Expand Down
48 changes: 36 additions & 12 deletions frontend/app/src/tx-flows/updateLoanInterestRate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { TransactionDetailsRow } from "@/src/screens/TransactionsScreen/Transact
import { TransactionStatus } from "@/src/screens/TransactionsScreen/TransactionStatus";
import { vPositionLoanCommited } from "@/src/valibot-utils";
import { css } from "@/styled-system/css";
import { ADDRESS_ZERO } from "@liquity2/uikit";
import { ADDRESS_ZERO, InfoTooltip } from "@liquity2/uikit";
import * as dn from "dnum";
import { match, P } from "ts-pattern";
import * as v from "valibot";
Expand Down Expand Up @@ -133,17 +133,41 @@ export const updateLoanInterestRate: FlowDeclaration<UpdateLoanInterestRateReque
]}
/>
)}
<TransactionDetailsRow
label="Interest rate adjustment fee"
value={[
<Amount
key="start"
fallback="…"
value={upfrontFee.data}
suffix=" BOLD"
/>,
]}
/>
{upfrontFee.data && dn.gt(upfrontFee.data, 0) && (
<TransactionDetailsRow
label={
<div
className={css({
display: "flex",
gap: 4,
})}
>
<div>Interest rate adjustment fee</div>
<InfoTooltip
content={{
heading: null,
body: `
A fee equal to 7 days of average interest applies when modifying rates less than 7 days after the
last adjustment. This prevents rate manipulation and ensures fair redemption distribution.
`,
footerLink: {
href: "https://docs.liquity.org/v2-faq/borrowing-and-liquidations#can-i-adjust-the-rate",
label: "Learn more",
},
}}
/>
</div>
}
value={[
<Amount
key="start"
fallback="…"
value={upfrontFee.data}
suffix=" BOLD"
/>,
]}
/>
)}
</>
);
},
Expand Down

0 comments on commit 0b3d73e

Please sign in to comment.