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

Fix ics20 denom #244

Merged
merged 2 commits into from
Mar 12, 2021
Merged

Fix ics20 denom #244

merged 2 commits into from
Mar 12, 2021

Conversation

ethanfrey
Copy link
Member

Properly handle parsing the voucher's denom when it is returned to us.

Thanks @alpe for finding this port/channel/orig_denom

Also add a migrate entry point that accepts any older cw20-ics20 contract as a migration target.

Copy link
Contributor

@alpe alpe 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. Please see the comment about protocol/app level errors

@@ -130,6 +131,17 @@ pub fn execute_transfer(
Ok(res)
}

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result<Response, ContractError> {
Copy link
Contributor

Choose a reason for hiding this comment

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

🤗 Makes debugging for me so much easier

if split_denom.len() != 3 {
return Err(ContractError::NoForeignTokens {});
}
// a few more sanity checks
Copy link
Contributor

Choose a reason for hiding this comment

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

It makes sense to check all part. 👍

Ok(msg) => {
// build attributes first so we don't have to clone msg below
// similar event messages like ibctransfer module

// This cannot fail as we parse it in do_ibc_packet_receive. Best to pass the data somehow?
let denom = parse_voucher_denom(&msg.denom, &packet.src).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

Parsing errors should be app level and stored with the event attribute. I may have run into this with an old state and could not read the event.

@ethanfrey ethanfrey merged commit 1be56bf into master Mar 12, 2021
@ethanfrey ethanfrey deleted the fix-ics20-denom branch March 12, 2021 20:27
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