Skip to content

Commit

Permalink
calculateMaybeCriticalAtTimestamp is calculating for "insolvency time…
Browse files Browse the repository at this point in the history
…" instead of "critical time" (#885)

* removed deposit from critical timestamp calculation

* edited variable name as per request

* as per review comments

* handled 1st  case returing old maybe_critical_timestamp

* use toBN()

* as per comment

* maybeCriticalAt should be initialized at null

* updated test method

* updated sdk core entity

* added comment and throwing error

* added comment and throwing error

Co-authored-by: davinchee <0xdavinchee@gmail.com>
  • Loading branch information
msoni89 and 0xdavinchee authored Jun 7, 2022
1 parent ace5c31 commit 7dc62cd
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 190 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface AccountTokenSnapshot {
totalNetFlowRate: BigNumber;
totalNumberOfActiveStreams: number;
totalOutflowRate: BigNumber;
maybeCriticalAtTimestamp: Timestamp;
maybeCriticalAtTimestamp: Timestamp | null;
isLiquidationEstimateOptimistic: boolean;
totalNumberOfClosedStreams: number;
totalSubscriptionsWithUnits: number;
Expand Down Expand Up @@ -76,7 +76,10 @@ export class AccountTokenSnapshotQueryHandler extends SubgraphQueryHandler<
account: x.account.id,
token: x.token.id,
tokenSymbol: x.token.symbol,
maybeCriticalAtTimestamp: Number(x.maybeCriticalAtTimestamp),
maybeCriticalAtTimestamp:
x.maybeCriticalAtTimestamp != null
? Number(x.maybeCriticalAtTimestamp)
: null,
updatedAtBlockNumber: Number(x.updatedAtBlockNumber),
updatedAtTimestamp: Number(x.updatedAtTimestamp),
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface AccountTokenSnapshotLog {
timestamp: Timestamp;
blockNumber: BlockNumber;
balance: BigNumber;
maybeCriticalAtTimestamp: Timestamp;
maybeCriticalAtTimestamp: Timestamp | null;
totalAmountStreamed: BigNumber;
totalAmountTransferred: BigNumber;
totalApprovedSubscriptions: number;
Expand Down Expand Up @@ -80,7 +80,10 @@ export class AccountTokenSnapshotLogQueryHandler extends SubgraphQueryHandler<
account: x.account.id,
token: x.token.id,
tokenSymbol: x.token.symbol,
maybeCriticalAtTimestamp: Number(x.maybeCriticalAtTimestamp),
maybeCriticalAtTimestamp:
x.maybeCriticalAtTimestamp != null
? Number(x.maybeCriticalAtTimestamp)
: null,
blockNumber: Number(x.blockNumber),
timestamp: Number(x.timestamp),
order: Number(x.order),
Expand Down
Loading

0 comments on commit 7dc62cd

Please sign in to comment.