-
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 valueOrNotAvailableIntIfReverted in updateMarket contra…
…ct calls
- Loading branch information
1 parent
db7f354
commit f338729
Showing
6 changed files
with
39 additions
and
27 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
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,4 +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'; | ||
export { default as valueOrNotAvailableIntIfReverted } from './valueOrNotAvailableIntIfReverted'; |
9 changes: 0 additions & 9 deletions
9
subgraphs/isolated-pools/src/utilities/valueOrBigIntZeroIfReverted.ts
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
subgraphs/isolated-pools/src/utilities/valueOrNotAvailableIntIfReverted.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,10 @@ | ||
import { BigInt, ethereum } from '@graphprotocol/graph-ts'; | ||
|
||
import { NOT_AVAILABLE_BIG_INT } from '../constants'; | ||
|
||
// checks if a call reverted, in case it is we return -1 to indicate the wanted value is not available | ||
function valueOrNotAvailableIntIfReverted(callResult: ethereum.CallResult<BigInt>): BigInt { | ||
return callResult.reverted ? NOT_AVAILABLE_BIG_INT : callResult.value; | ||
} | ||
|
||
export default valueOrNotAvailableIntIfReverted; |