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

Mint fix #199

Merged
merged 5 commits into from
Apr 11, 2022
Merged

Mint fix #199

merged 5 commits into from
Apr 11, 2022

Conversation

DrPresident
Copy link
Collaborator

Fixed some things in mint, I don't think anything was really broken but its slightly cheaper now and removed some redundant code

burn_asset.asset.contract.code_hash.clone(),
burn_asset.asset.contract.address.clone(),
)?);
if burn_amount > Uint128::zero() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicate code, can be reduced to

        // Try to burn
        if let Some(token_config) = &burn_asset.asset.token_config {
            if token_config.burn_enabled {
                messages.push(burn_msg(
                    burn_amount,
                    None,
                    None,
                    256,
                    burn_asset.asset.contract.code_hash.clone(),
                    burn_asset.asset.contract.address.clone(),
                )?);
            }
        } else if let Some(recipient) = config.secondary_burn {
            messages.push(send_msg(
                recipient,
                burn_amount,
                None,
                None,
                None,
                1,
                burn_asset.asset.contract.code_hash.clone(),
                burn_asset.asset.contract.address.clone(),
            )?);
        }
    }```

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It isn't duplicated, there are 3 cases to be accounted for.

if has_token_config() {
   if burn_enabled => do_burn()
   else => do_secondary_burn()
}
else if no_token_confg() {
    do_secondary_burn()
}

@FloppyDisck FloppyDisck merged commit 5543a24 into dev Apr 11, 2022
@FloppyDisck FloppyDisck deleted the mint-fix branch April 11, 2022 20:09
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