Skip to content

Commit

Permalink
Bean UI - Fix vAPY display (#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
hellofromguy authored Aug 30, 2023
2 parents 2e1a5ac + 71ff43f commit 75fa0e8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
12 changes: 8 additions & 4 deletions projects/ui/src/components/Silo/SiloAssetApyChip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ const SiloAssetApyChip: FC<SiloAssetApyChipProps> = ({

const seeds = token.getSeeds();
const apys = latestYield
? seeds.eq(2)
? latestYield.bySeeds['2']
: seeds.eq(4)
? latestYield.bySeeds['4']
? seeds.eq(0)
? latestYield.bySeeds['0']
: seeds.eq(3)
? latestYield.bySeeds['3']
: seeds.eq(3.25)
? latestYield.bySeeds['3.25']
: seeds.eq(4.5)
? latestYield.bySeeds['4.5']
: null
: null;

Expand Down
7 changes: 7 additions & 0 deletions projects/ui/src/graph/queries/LatestAPY.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@ query LatestAPY {
siloYields(first: 1, orderBy: season, orderDirection:desc) {
id
season
zeroSeedBeanAPY
twoSeedBeanAPY
twoSeedStalkAPY
fourSeedBeanAPY
fourSeedStalkAPY
threeSeedBeanAPY
threeSeedStalkAPY
threePointTwoFiveSeedBeanAPY
threePointTwoFiveSeedStalkAPY
fourPointFiveSeedBeanAPY
fourPointFiveSeedStalkAPY
beansPerSeasonEMA
}
}
26 changes: 18 additions & 8 deletions projects/ui/src/hooks/beanstalk/useAPY.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ type APY = {
type APYs = {
beansPerSeasonEMA: BigNumber;
bySeeds: {
'2': APY;
'4': APY;
'0': APY;
'3': APY;
'3.25': APY;
'4.5': APY;
};
};

Expand All @@ -29,13 +31,21 @@ export default function useAPY() {
data: {
beansPerSeasonEMA: new BigNumber(siloYield.beansPerSeasonEMA),
bySeeds: {
2: {
bean: new BigNumber(siloYield.twoSeedBeanAPY),
stalk: new BigNumber(siloYield.twoSeedStalkAPY),
0: {
bean: new BigNumber(siloYield.zeroSeedBeanAPY),
stalk: new BigNumber(0),
},
4: {
bean: new BigNumber(siloYield.fourSeedBeanAPY),
stalk: new BigNumber(siloYield.fourSeedStalkAPY),
3: {
bean: new BigNumber(siloYield.threeSeedBeanAPY),
stalk: new BigNumber(siloYield.threeSeedStalkAPY),
},
3.25: {
bean: new BigNumber(siloYield.threePointTwoFiveSeedBeanAPY),
stalk: new BigNumber(siloYield.threePointTwoFiveSeedStalkAPY),
},
4.5: {
bean: new BigNumber(siloYield.fourPointFiveSeedBeanAPY),
stalk: new BigNumber(siloYield.fourPointFiveSeedStalkAPY),
},
},
} as APYs,
Expand Down

0 comments on commit 75fa0e8

Please sign in to comment.