-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use function valueOrBigIntZeroIfReverted
- Loading branch information
1 parent
a845999
commit ff5ed22
Showing
3 changed files
with
17 additions
and
15 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { default as getExchangeRateBigDecimal } from './getExchangeRateBigDecimal'; | ||
export { default as getTokenPriceInUsd } from './getTokenPriceInUsd'; | ||
export { default as exponentToBigDecimal } from './exponentToBigDecimal'; | ||
export { default as valueOrBigIntZeroIfReverted } from './valueOrBigIntZeroIfReverted'; |
9 changes: 9 additions & 0 deletions
9
subgraphs/isolated-pools/src/utilities/valueOrBigIntZeroIfReverted.ts
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,9 @@ | ||
import { BigInt, ethereum } from '@graphprotocol/graph-ts'; | ||
|
||
import { zeroBigInt32 } from '../constants'; | ||
|
||
function valueOrBigIntZeroIfReverted(callResult: ethereum.CallResult<BigInt>): BigInt { | ||
return callResult.reverted ? zeroBigInt32 : callResult.value; | ||
} | ||
|
||
export default valueOrBigIntZeroIfReverted; |