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

Allow modifying admin of Ics20 contract #641

Merged
merged 5 commits into from
Feb 2, 2022
Merged

Conversation

ethanfrey
Copy link
Member

  • Use ADMIN rather then config
  • Support standard ADMIN query and update
  • Add migration support from current version to new version

Copy link
Contributor

@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.

contracts/cw20-ics20/src/migrations.rs Outdated Show resolved Hide resolved
contracts/cw20-ics20/src/contract.rs Outdated Show resolved Hide resolved
contracts/cw20-ics20/src/contract.rs Outdated Show resolved Hide resolved
Ok(Response::new())
}

fn from_semver(err: semver::Error) -> StdError {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice.

@@ -251,9 +298,10 @@ pub fn query_channel(deps: Deps, id: String) -> StdResult<ChannelResponse> {

fn query_config(deps: Deps) -> StdResult<ConfigResponse> {
let cfg = CONFIG.load(deps.storage)?;
let admin = ADMIN.get(deps)?.unwrap_or_else(|| Addr::unchecked(""));
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice. Wouldn't "None" be better here? I think we used that in the past.

Copy link
Member Author

Choose a reason for hiding this comment

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

In this contract, we don't allow None, so it doesn't map much to the ADMIN, I kind of force it

contracts/cw20-ics20/src/contract.rs Outdated Show resolved Hide resolved
}

Ok(Response::new())
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not for now, but I wonder how much of this logic can be turned into a helper function.

Copy link
Member Author

Choose a reason for hiding this comment

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

some of this is in poe-contracts/tg-utils

but matching on versions would be a good thing to abstract out (later, when we have some good examples/experience)

@ethanfrey ethanfrey merged commit e45f038 into main Feb 2, 2022
@ethanfrey ethanfrey deleted the ics20-modify-admin branch February 2, 2022 20:51
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