Skip to content

Commit

Permalink
Handle contract call revert
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Leonard committed Jul 11, 2023
1 parent dbeee25 commit f086b11
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions subgraph/src/datasources/FortaStaking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,20 @@ function updateStake(
sharesId.subject = _subjectId;
sharesId.save();
}
subject.activeStake = fortaStaking.activeStakeFor(

const activeStake = fortaStaking.try_activeStakeFor(
_subjectType,
_subject
);
subject.inactiveStake = fortaStaking.inactiveStakeFor(

const inActiveStake = fortaStaking.try_inactiveStakeFor(
_subjectType,
_subject
);

subject.activeStake = activeStake.reverted ? BigInt.fromI32(0) : activeStake.value;
subject.inactiveStake = inActiveStake.reverted ? BigInt.fromI32(0) : inActiveStake.value;

subject.activeShares = fortaStaking.totalShares(
_subjectType,
_subject
Expand Down

0 comments on commit f086b11

Please sign in to comment.