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

cw20-base: validate addresses are unique in initial balances #659

Merged
merged 2 commits into from
Mar 24, 2022

Conversation

harryscholes
Copy link
Contributor

Fixes #626

@CLAassistant
Copy link

CLAassistant commented Feb 15, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

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

Nice one

pub fn validate_accounts(accounts: &[Cw20Coin]) -> Result<(), ContractError> {
let mut addresses = accounts.iter().map(|c| &c.address).collect::<Vec<_>>();
addresses.sort();
addresses.dedup();
Copy link
Member

Choose a reason for hiding this comment

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

Seems like a nice way to calculate this.

@ethanfrey ethanfrey merged commit a45d3a1 into CosmWasm:main Mar 24, 2022
@harryscholes harryscholes deleted the fix-#626 branch March 25, 2022 05:44
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.

Duplicate accounts in cw20 initial balances causes unrecoverable inconsistent state
3 participants