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-escrow refactoring: Unify handling of native and cw20 #92

Merged
merged 7 commits into from
Sep 23, 2020

Conversation

maurolacy
Copy link
Contributor

@maurolacy maurolacy commented Sep 18, 2020

A first iteration on #88.

This can be unified / simplified further, by example by introducing a Cw20Balance type. Or by introducing a generic Coin, that is a wrapper around NativeCoin and Cw20Coin. But, better leave those for another task / PR.

I'm not so happy with some of the trade-offs here. Like using a tuple type for the escrow balance. I also couldn't avoid code repetition in some parts, due to the structural differences between a Coin and a Cw20Coin. Maybe wrapping everything into a generic Coin is a good idea?

@maurolacy maurolacy requested a review from ethanfrey September 18, 2020 20:45
@maurolacy maurolacy self-assigned this Sep 18, 2020
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 integration and ideas.

Added some comments to clean it up a bit more.

contracts/cw20-escrow/src/state.rs Outdated Show resolved Hide resolved
contracts/cw20-escrow/src/contract.rs Outdated Show resolved Hide resolved
contracts/cw20-escrow/src/contract.rs Outdated Show resolved Hide resolved
contracts/cw20-escrow/src/contract.rs Outdated Show resolved Hide resolved
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.

Looks good, merging.

Left some comment on a few style nitpicks, things for the future

contracts/cw20-atomic-swap/src/contract.rs Show resolved Hide resolved
contracts/cw20-atomic-swap/src/contract.rs Show resolved Hide resolved
contracts/cw20-escrow/src/contract.rs Show resolved Hide resolved
@ethanfrey ethanfrey merged commit b86cb8e into master Sep 23, 2020
@ethanfrey ethanfrey deleted the unify-cw20-native branch September 23, 2020 21:15
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