Skip to content

Commit

Permalink
null check for bdv of unripe tokens prior to replant
Browse files Browse the repository at this point in the history
  • Loading branch information
soilking committed Aug 15, 2024
1 parent 0578439 commit 7923ab5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions projects/subgraph-beanstalk/src/utils/Barn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ export function updateUnripeStats(unripe: Address, protocol: Address, block: eth

// Further calculated values
unripeToken.underlyingToken = getUnripeUnderlying(unripe, block.number);
const underlyingBdvOne = getLatestBdv(loadWhitelistTokenSetting(Address.fromBytes(unripeToken.underlyingToken)))!;
unripeToken.bdvUnderlyingOne = unripeToken.amountUnderlyingOne.times(underlyingBdvOne);
unripeToken.choppableBdvOne = unripeToken.choppableAmountOne.times(underlyingBdvOne);
const underlyingBdvOne = getLatestBdv(loadWhitelistTokenSetting(Address.fromBytes(unripeToken.underlyingToken)));
if (underlyingBdvOne != null) {
unripeToken.bdvUnderlyingOne = unripeToken.amountUnderlyingOne.times(underlyingBdvOne);
unripeToken.choppableBdvOne = unripeToken.choppableAmountOne.times(underlyingBdvOne);
}

takeUnripeTokenSnapshots(unripeToken, protocol, block.timestamp);
unripeToken.save();
Expand Down

0 comments on commit 7923ab5

Please sign in to comment.