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

refactor instantiation logic #94

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

SebastianElvis
Copy link
Member

No description provided.

Copy link
Collaborator

@maurolacy maurolacy left a comment

Choose a reason for hiding this comment

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

LGTM. Just some comments about the overall design.

Will review the SDK PR next.

Comment on lines +49 to +53
pub fn get_babylon_sdk_params(querier: &QuerierWrapper) -> Result<Params, StdError> {
let params = querier.query_grpc(QUERY_PARAMS_PATH.to_owned(), Binary::new("".into()))?;
let params = QueryParamsResponse::from(params).params;
Ok(params)
}
Copy link
Collaborator

@maurolacy maurolacy Dec 6, 2024

Choose a reason for hiding this comment

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

I think this approach is not without merit, but it would be much simpler IMO to just pass the needed params during instantiation. The contracts have a clear dependencies, so it's just a matter of instantiating them in the right order and pass required parameters (other contracts' addresses) between them at instantiation.

Comment on lines -20 to -21
pub babylon: Addr,
pub staking: Addr,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would just keep these, and pass / set them during instantiation.

Comment on lines +263 to +264
pub fn get_activated_height(querier: &QuerierWrapper) -> StdResult<u64> {
let params = get_babylon_sdk_params(querier)?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: This is good for encapsulation, but bad for performance. In any case, since you already have it why not pass the entire Config by reference instead?

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