Conversation
| totalSettledAmount | ||
| userFunds | ||
| totalUsers | ||
| totalLocked |
There was a problem hiding this comment.
NOTE: This query is broken until we actually deploy new subgraph with totalLocked field.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
silent-cipher
left a comment
There was a problem hiding this comment.
Overall looks good to me!
packages/subgraph/src/payments.ts
Outdated
| if (!isTerminated) { | ||
| const token = Token.load(rail.token); | ||
| if (token) { | ||
| const streamingDelta = newLockup.minus(oldLockup); | ||
| token.totalStreamingLockup = token.totalStreamingLockup.plus(streamingDelta); | ||
| token.save(); | ||
| } | ||
| } |
There was a problem hiding this comment.
Why are we only updating totalStreamingLockup for non-terminated rails? Shouldn’t this be updated in both cases?
There was a problem hiding this comment.
If the rail has already been terminated, the lockup period may not be altered and the fixed lockup may only be reduced.
This is from docs for modifyRailLockup method.
There was a problem hiding this comment.
But this handler is for 'RailRateModified'.
There was a problem hiding this comment.
True, this shouldn't be called for terminated rails, but there's also other parts in this handler where the check is done
const isTerminated = rail.state === "TERMINATED";
if (!isTerminated) {
updateOperatorRate(operatorApproval, oldRate, newRate);
updateOperatorTokenRate(operatorToken, oldRate, newRate);
if (payerToken) {
payerToken.lockupRate = payerToken.lockupRate.minus(oldRate).plus(newRate);
payerToken.save();
}
}Should we just clear this handler to return early if rail state is terminated?
There was a problem hiding this comment.
I think the handler can still be triggered for terminated rails. modifyRailPayment is allowed for both terminated and non-terminated rails.
The key differences for terminated rails are:
newRatemust be lower thanoldRate- the effective lockup period becomes
endEpoch - currentBlockNumber
Because of this, some updates still need to be guarded rather than returning early for terminated rails.
There was also an audit issue related to this behavior of updating terminated rail's rate- more context here
There was a problem hiding this comment.
Okay I see now.. I've mixed modifyRailLockup and modifyRailPayment 😮💨
… feat/add-total-locked-token-metrics
Adds a
totalFixedLockupandtotalStreamingLockupproperties toTokensubgraph entity and displays "Total locked USDFC" and "Total locked FIL" token metrics on homepage.Closes #100