-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
BeanSama
authored and
BeanSama
committed
Jun 13, 2023
1 parent
4d29866
commit 297df3e
Showing
2 changed files
with
27 additions
and
18 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); | ||
} |