Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Gross apy warning #2361

Merged
merged 1 commit into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/components-v2/InfluenceVault/InfluenceVaultSpecs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ const useStyles = makeStyles((theme) => ({
paddingBottom: theme.spacing(0.15),
fontSize: '1.25rem',
},
specName: {
fontSize: 12,
marginTop: 4,
lineHeight: '1.66',
},
}));

const InfluenceVaultSpecs = ({ vault, config }: Props): JSX.Element => {
Expand Down Expand Up @@ -88,6 +93,9 @@ const InfluenceVaultSpecs = ({ vault, config }: Props): JSX.Element => {
<StyledDivider />
<Grid container direction="column">
<InfluenceVaultFees vault={vault} feeConfig={config.feeConfig} />
<Typography className={classes.specName} color="textSecondary">
Fees are not included in APY estimates
</Typography>
</Grid>
</Grid>
</Grid>
Expand Down
13 changes: 11 additions & 2 deletions src/components-v2/VaultApyInformation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const useStyles = makeStyles((theme) => ({
padding: '0px 36px 27px 36px',
},
button: {
marginTop: 34,
marginTop: 17,
},
historicAPY: {
paddingBottom: 10,
Expand Down Expand Up @@ -105,6 +105,10 @@ const useStyles = makeStyles((theme) => ({
flexWrap: 'wrap',
},
},
feeDisclaimer: {
fontSize: 12,
color: 'rgba(255,255,255,0.6)',
},
}));

interface Props {
Expand Down Expand Up @@ -169,6 +173,7 @@ const VaultApyInformation = ({ open, onClose, boost, vault, projectedBoost }: Pr
event.stopPropagation();
onClose();
};

const useHistoricAPY = projectedBoost === null || isInfluenceVault(vault.address);
const vaultApySources = useHistoricAPY ? sources.map(yieldToValueSource) : totalCurrentSources;
const yieldBearingRewardsList = vaultApySources.reduce((list: YieldBearingVaultSource[], source) => {
Expand Down Expand Up @@ -388,7 +393,11 @@ const VaultApyInformation = ({ open, onClose, boost, vault, projectedBoost }: Pr
))}
</Box>
)}

<Grid item className={classes.button}>
<Typography component="span" className={classes.feeDisclaimer}>
Fees are not included in APY estimates. See the vault details page for fee information.
</Typography>
</Grid>
<Grid item className={classes.button}>
<Button color="primary" variant="contained" fullWidth onClick={handleGoToVault}>
GO TO VAULT
Expand Down
48 changes: 28 additions & 20 deletions src/components-v2/common/VaultFees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,32 +41,40 @@ function getVaultStrategyFee(vault: VaultDTOV3, fee: StrategyFee): number {
interface Props extends React.HTMLAttributes<HTMLDivElement> {
vault: VaultDTOV3;
onHelpClick?: () => void;
includeDisclaimer: boolean;
}

export const VaultFees = observer(({ vault, onHelpClick, ...rootProps }: Props): JSX.Element | null => {
const classes = useStyles();
export const VaultFees = observer(
({ vault, onHelpClick, includeDisclaimer, ...rootProps }: Props): JSX.Element | null => {
const classes = useStyles();

let totalFees = 0;
for (const fee of Object.values(StrategyFee)) {
const feesAmount = getVaultStrategyFee(vault, fee);
if (feesAmount && feesAmount > 0) {
totalFees++;
let totalFees = 0;
for (const fee of Object.values(StrategyFee)) {
const feesAmount = getVaultStrategyFee(vault, fee);
if (feesAmount && feesAmount > 0) {
totalFees++;
}
}

if (totalFees === 0) {
return (
<div {...rootProps}>
<Typography className={classes.specName} color="textSecondary" display="inline">
There are no fees for this vault
</Typography>
</div>
);
}
}

if (totalFees === 0) {
return (
<div {...rootProps}>
<Typography className={classes.specName} color="textSecondary" display="inline">
There are no fees for this vault
</Typography>
<StrategyFees vault={vault} onHelpClick={onHelpClick} />
{includeDisclaimer && (
<Typography className={classes.specName} color="textSecondary">
Fees are not included in APY estimates
</Typography>
)}
</div>
);
}

return (
<div {...rootProps}>
<StrategyFees vault={vault} onHelpClick={onHelpClick} />
</div>
);
});
},
);
7 changes: 6 additions & 1 deletion src/components-v2/common/dialogs/VaultDeposit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,12 @@ export const VaultDeposit = observer(({ open = false, vault, depositAdvisory, on
{isInfluence && influenceVaultConfig !== undefined ? (
<InfluenceVaultFees vault={vault} className={classes.fees} feeConfig={influenceVaultConfig.feeConfig} />
) : (
<VaultFees vault={vault} className={classes.fees} onHelpClick={() => setShowFees(true)} />
<VaultFees
vault={vault}
className={classes.fees}
onHelpClick={() => setShowFees(true)}
includeDisclaimer={false}
/>
)}
<Grid container className={classes.totalAmountContainer}>
<Grid item xs={6}>
Expand Down
2 changes: 1 addition & 1 deletion src/components-v2/vault-detail/specs/Fees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const Fees = ({ vault }: Props): JSX.Element => {
}
/>
</Dialog>
<VaultFees vault={vault} onHelpClick={toggleDialog} />
<VaultFees vault={vault} onHelpClick={toggleDialog} includeDisclaimer={true} />
</>
);
};
Loading