Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add simulation and token holder endpoints #88

Conversation

yvesfracari
Copy link
Contributor

@yvesfracari yvesfracari commented Oct 7, 2024

Context: cowprotocol/cowswap#4943

This PR:

  • Adds two new endpoints:
    • /{chainId}/tokens/{tokenAddress}/topHolders (GET)
    • /{chainId}/simulation/simulate-bundle (POST)

To test:

  • Add the new env variables.
  • Run all tests using yarn test
  • Test the new endpoints locally. If you need some example data for the simulate-bundle body parameters you can look at: libs/repositories/src/SimulationRepository/SimulationrepositoryTenderly.test.ts

Copy link
Contributor

@alfetopito alfetopito left a comment

Choose a reason for hiding this comment

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

Very nice 👍

@alfetopito
Copy link
Contributor

@yvesfracari can you improve the PR description and add test steps, how to check whether the former and new APIs still work and so on.

@yvesfracari yvesfracari force-pushed the pedro/cow-404-add-fallback-option-on-mainnet-get-token-holder-functions branch from 4d7f95a to e7d5711 Compare October 11, 2024 12:50
@yvesfracari yvesfracari changed the title Add fallback option on mainnet get token holder functions Add simulation and token holder endpoints Oct 11, 2024
@yvesfracari yvesfracari force-pushed the pedro/cow-404-add-fallback-option-on-mainnet-get-token-holder-functions branch from 6a95691 to 32c3ff2 Compare October 11, 2024 19:11
@yvesfracari
Copy link
Contributor Author

I added more information on the readme, let me know if you need more information 😄

Copy link
Contributor

@alfetopito alfetopito left a comment

Choose a reason for hiding this comment

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

Looks great, local tests succeeded too.

Some minor nitpick comments

}

// types were found in Uniswap repository
// https://github.com/Uniswap/governance-seatbelt/blob/e2c6a0b11d1660f3bd934dab0d9df3ca6f90a1a0/types.d.ts#L123
Copy link
Contributor

Choose a reason for hiding this comment

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

I forgot to comment on this before.

Can we reach out to Tenderly as ask whether they expose those types or a way to generate ourselves rather than copying over from Uniswap's repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we could but I would add it as a TODO to avoid blocking the PR merge. Btw, I tried to generate these types but I couldn't succeed, the gen was falling (https://docs.tenderly.co/api/openapi.json)

}));
}

checkBundleSimulationError(
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: make explicit private method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about this but prefer to make it public to test easier 😅

@shoom3301 shoom3301 merged commit 4a913cb into cowprotocol:main Oct 17, 2024
2 of 6 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants