Skip to content

Commit

Permalink
update useIsSiloVestingPeriod hook
Browse files Browse the repository at this point in the history
  • Loading branch information
BeanSama authored and BeanSama committed Jun 13, 2023
1 parent 4d29866 commit 297df3e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
18 changes: 0 additions & 18 deletions projects/ui/src/hooks/beanstalk/useIsSiloVestingPeriod.ts

This file was deleted.

27 changes: 27 additions & 0 deletions projects/ui/src/hooks/farmer/useFarmerSiloVesting.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import BigNumber from 'bignumber.js';
import { useMemo } from 'react';
import { ZERO_BN } from '~/constants';
import { useAppSelector } from '~/state';

export const MAX_SILO_VESTING_BLOCKS = new BigNumber(10);

export default function useFarmerSiloVesting() {
const morning = useAppSelector((s) => s._beanstalk.sun.morning);

/// TODO: Fix me with the new earned beans amount
const earnedBeans = useAppSelector((s) => s._farmer.silo.beans.earned);

return useMemo(() => {
const isVesting = morning.isMorning && morning.index.lte(10);

const remainingBlocks = isVesting
? MAX_SILO_VESTING_BLOCKS.minus(morning.index).plus(1)
: ZERO_BN;

return {
amount: earnedBeans,
isVesting,
remainingBlocks,
};
}, [earnedBeans, morning.index, morning.isMorning]);
}

0 comments on commit 297df3e

Please sign in to comment.