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

Feat: Factory discoveries within a range of blocks #99

Open
quangkeu95 opened this issue Sep 23, 2023 · 4 comments
Open

Feat: Factory discoveries within a range of blocks #99

quangkeu95 opened this issue Sep 23, 2023 · 4 comments

Comments

@quangkeu95
Copy link

Is it possible that we can call discover_factories with block params so i could run the discoveries within a range of blocks? Fetching from block 0 could be time consuming and inefficient.

@0xOsiris
Copy link
Member

Yeahh it's possible, but in the current architecture you'd have to change the code. Right now its defaulting with the from_block 0 and the current_block as the current chain head. If you want to discover within a specific range I think you should be able to just change out these block numbers to the range you want.

let mut from_block = 0;
let current_block = middleware
        .get_block_number()
        .await
        .map_err(AMMError::MiddlewareError)?
        .as_u64();

let mut from_block = 0;

@quangkeu95
Copy link
Author

Yeah i've updated this feature in my branch. Should i create a PR?

@0xKitsune
Copy link
Collaborator

Yes, thanks for opening an issue, this would be a good feature to add since there aren't any factories to discover for ~6 mm blocks. In your PR can you also update the default from_block to be a reasonable value as well?

@quangkeu95
Copy link
Author

I've created a PR #102. I choose the UniswapV2Factory creation block as the default from_block, since I didn't know that any AMM has the same factory interface as UniswapV2Factory was created before. Please correct me if i'm wrong. Let me know your feedbacks as well. Thanks!

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

No branches or pull requests

3 participants