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

Idea: item query helper storage helper #376

Closed
orkunkl opened this issue Aug 4, 2021 · 0 comments · Fixed by #412
Closed

Idea: item query helper storage helper #376

orkunkl opened this issue Aug 4, 2021 · 0 comments · Fixed by #412
Assignees
Milestone

Comments

@orkunkl
Copy link
Contributor

orkunkl commented Aug 4, 2021

Background

Cross contract configuration Item queries is a common execution. This is usually done using SmartQuery which costs quite gas for retrieving simple object from storage. Instead RawQuery can be used for lower costs.

Proposal

Develop new generic storage helper that generates raw query wrapper for given data struct.

Usage example

On source contract

pub const CONTRACT_CONFIG: CONFIG<State> = CONFIG::new("config");

On external contract

let EXT_CONFIG = CONTRACT_CONFIG::query(&deps.querier, external_contract_addr)?;

CONTRACT_CONFIG::query(&deps.querier, external_contract_addr)
raw query with config key internally, and parses State struct.

Please look at cw4 helpers.rs for member query to see an example of reading remote state with raw query https://github.com/CosmWasm/cw-plus/blob/main/packages/cw4/src/helpers.rs#L87-L112

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants