-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactoring gauges data fetch calls #851
Conversation
🦋 Changeset detectedLatest commit: d5ad7b2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
const result = results[index]; | ||
const cap = result.status === 'success' ? result.result : undefined; | ||
if (!cap) { | ||
// Too many know errors to log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does that mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant to explain what was already mentioned in the the function doc. getRelativeWeightCap
isn't widely supported, so most of the calls with fail and we don't need to log that, because it's expected. I'll just remove the comment.
const types = gaugeAddresses.map((address, index) => { | ||
const result = results[index]; | ||
const type = result.status === 'success' ? result.result : undefined; | ||
if (!address) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should check for type
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, corrected
const weigths = gaugeAddresses.map((address, index) => { | ||
const result = results[index]; | ||
const weight = result.status === 'success' ? result.result : undefined; | ||
if (!address) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should check for weight
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed the logic to allowFailure: false
if (!address) { | ||
console.error(`Failed to fetch gauge address at index ${index}`); | ||
} | ||
return [address, Number(formatEther(weight as bigint))] as [string, number]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guess this throws when weight
is undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed the logic to allowFailure: false
if (!address) { | ||
console.error(`Failed to fetch gauge type for ${address}`); | ||
} | ||
return [address, typeNames[Number(type)]] as [string, string]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this throws when type is undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed the logic to allowFailure: false
if (result === undefined) { | ||
console.error(`Failed to fetch isKilled for ${address}`); | ||
} | ||
return [address, result as boolean]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this set to if result
is undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed the logic to allowFailure: false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much nicer!
closes #835