Skip to content
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

Paul/lifi reporter #194

Merged
merged 1 commit into from
Dec 2, 2024
Merged

Paul/lifi reporter #194

merged 1 commit into from
Dec 2, 2024

Conversation

paullinator
Copy link
Member

@paullinator paullinator commented Nov 9, 2024

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

Copy link
Collaborator

@samholmes samholmes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can pass, but I'd rather have stricter IO by use of cleaners

const response = await fetch(`${url}/v1/integrators/edgeapp`)
if (!response.ok) {
const text = await response.text()
throw new Error(text)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error should include text for lookup

throw new Error(text)
}

const minAmount = Number(process.argv[2] ?? 100)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a cleaner to avoid NaN numbers

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asStringNumber?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asStringNumber not available in this repo. Note this is just a cmdline helper tool. It doesn't run in the engine and is run on as needed basis.

Comment on lines +40 to +41
const result = await response.json()
const integrators = asIntegrators(result)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why we don't use asJSON more often?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand

const integrators = asIntegrators(result)
let balUsd = 0
const tokenAddresses: { [chainId: string]: string[] } = {}
console.log(JSON.stringify(integrators, null, 2))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this console log for debugging?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but this whole script is just a helper tool

console.log(JSON.stringify(integrators, null, 2))
integrators.feeBalances.forEach(fb => {
fb.tokenBalances.forEach(tb => {
const amount = Number(tb.amountUsd)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, why not use an asStringNumber?

@paullinator paullinator merged commit 7e84987 into master Dec 2, 2024
1 check passed
@paullinator paullinator deleted the paul/lifiReporter branch December 2, 2024 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants