Skip to content

Commit

Permalink
feat: handle boosted property from yDaemon
Browse files Browse the repository at this point in the history
  • Loading branch information
Majorfi committed Jan 4, 2024
1 parent 4ab6bb4 commit d395331
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 0.3.7

- Feat: Adding boosted property handling. (04/01/2024)
- Fix: Adjust max-loss default parameters. (04/01/2024)
- Style: Hide divider when it's the last item in the setting popover. (04/01/2024)
- Chores: add a message about v3 vaults being boosted. (04/01/2024)
Expand Down
1 change: 1 addition & 0 deletions apps/common/schemas/yDaemonVaultsSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export const yDaemonVaultSchema = z.object({
}),
featuringScore: z.number().default(0).catch(0),
retired: z.boolean().default(false).catch(false),
boosted: z.boolean().default(false).catch(false),
strategies: z.array(yDaemonVaultStrategySchema).nullable().default([]),
staking: z
.object({
Expand Down
6 changes: 6 additions & 0 deletions apps/vaults-v3/components/details/VaultDetailsHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ export function VaultDetailsHeader({currentVault}: {currentVault: TYDaemonVault}
<div className={'w-full rounded-lg bg-neutral-900/30 px-4 py-2 text-center md:w-fit'}>
<strong className={'text-sm font-black text-neutral-900 md:text-xl'}>{chainInfo.name}</strong>
</div>
{currentVault.boosted ? (
<div className={'w-full rounded-lg bg-neutral-900/30 px-4 py-2 text-center md:w-fit'}>
<strong
className={'text-sm font-black text-neutral-900 md:text-xl'}>{`⚡️ Boosted`}</strong>
</div>
) : null}
</div>
</div>

Expand Down
7 changes: 6 additions & 1 deletion apps/vaults-v3/components/list/VaultsV3ListRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type {ReactElement} from 'react';
import type {TYDaemonVault} from '@common/schemas/yDaemonVaultsSchemas';

function VaultForwardAPR({currentVault}: {currentVault: TYDaemonVault}): ReactElement {
console.log(currentVault);
const isEthMainnet = currentVault.chainID === 1;
if (currentVault.apr.forwardAPR.type === '') {
const hasZeroAPR = isZero(currentVault.apr?.netAPR) || Number((currentVault.apr?.netAPR || 0).toFixed(2)) === 0;
Expand Down Expand Up @@ -239,6 +240,7 @@ function VaultForwardAPR({currentVault}: {currentVault: TYDaemonVault}): ReactEl
<Renderable
shouldRender={!currentVault.apr.forwardAPR?.type.includes('new')}
fallback={'NEW'}>
{currentVault.boosted ? '⚡️ ' : ''}
<RenderAmount
shouldHideTooltip
value={currentVault?.apr?.forwardAPR.composite.v3OracleCurrentAPR}
Expand All @@ -250,9 +252,11 @@ function VaultForwardAPR({currentVault}: {currentVault: TYDaemonVault}): ReactEl
</div>
);
}

const hasV3Composite =
!isZero(currentVault?.apr?.forwardAPR.composite.v3OracleCurrentAPR) &&
!isZero(currentVault?.apr?.forwardAPR.composite.v3OracleStratRatioAPR);
!isZero(currentVault?.apr?.forwardAPR.composite.v3OracleStratRatioAPR) &&
false;
if (hasV3Composite) {
return (
<div className={'-mb-0 flex flex-col md:-mb-4 md:text-right'}>
Expand Down Expand Up @@ -288,6 +292,7 @@ function VaultForwardAPR({currentVault}: {currentVault: TYDaemonVault}): ReactEl
<Renderable
shouldRender={!currentVault.apr.forwardAPR?.type.includes('new')}
fallback={'NEW'}>
{currentVault.boosted ? '⚡️ ' : ''}
<RenderAmount
shouldHideTooltip={hasZeroAPR}
value={currentVault.apr.netAPR}
Expand Down

1 comment on commit d395331

@vercel
Copy link

@vercel vercel bot commented on d395331 Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.