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

Check for / reject zero amount tokens #76

Closed
maurolacy opened this issue Sep 7, 2020 · 4 comments
Closed

Check for / reject zero amount tokens #76

maurolacy opened this issue Sep 7, 2020 · 4 comments
Assignees

Comments

@maurolacy
Copy link
Contributor

Add a check for considering zero amounts as missing.

For native coins, filter out zeros, and then ensure then remaining balance has length > 0. Only save the filtered list.

For cw20 coins, reject zero amounts directly. Add a check to also reject such sends in cw20-base.

@ethanfrey
Copy link
Member

As part of this, let's pull out the Balance helper from cw1-subkeys into cw0 (as it only relies on cosmwasm-std and used by many different protocols).

This already has a normalize function which you could use (or add a more efficient is_empty one).

This would be a great help to build the higher-level checks for native coins in all contracts.

I would also suggest 2 PRs here: one for the cw20 additions, one for the native coin changes (that I mentioned here)

@maurolacy
Copy link
Contributor Author

Yes, I was taking a look at the subkeys code, and was going to suggest exactly that.

This was referenced Sep 12, 2020
@ethanfrey
Copy link
Member

This is done with #86 and #87, correct?

@maurolacy
Copy link
Contributor Author

Correct.

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

No branches or pull requests

2 participants