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

Add ContractAddr generic helper #153

Closed
ethanfrey opened this issue Dec 4, 2020 · 3 comments
Closed

Add ContractAddr generic helper #153

ethanfrey opened this issue Dec 4, 2020 · 3 comments
Assignees

Comments

@ethanfrey
Copy link
Member

Based on discussion from #150 (comment)

Add pub type ContractAddr(pub HumanAddr) to cw0, with some common functions to create messages and make queries, as well as

Rename Cw4Contract to Cw4ContractAddr, and extend ContractAddr functionality. See if the refactoring simplifies the implementation. If not, we can just do the rename without adding some ContractAddr type (I am not sure if it would make anything easier).

If this simplifies things, do the same for the other helpers (cw3, cw20, cw721?).

@ethanfrey
Copy link
Member Author

Note, looking more at the helpers, I am unsure if this extra type will help much. It may allow us to de-dup encode_msg, encode_smart_query and encode_raw_query helper methods, but the creation may be more work. eg we have to implement From<HumanAddr> to avoid ugly init: let addr = Cw4ContractAddr(ContractAddr(msg.contract)); and rather use: let addr = Cw4ContractAddr::from(msg.contract)

@ethanfrey ethanfrey added this to To do in Contract development Dec 4, 2020
@ethanfrey
Copy link
Member Author

I would close this unless you still think this is valuable.

@maurolacy
Copy link
Contributor

I agree this is OK as such.

Contract development automation moved this from To do to Done Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

No branches or pull requests

2 participants