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 interface compliant contracts #83

Closed
bryanchriswhite opened this issue Sep 8, 2022 · 0 comments · Fixed by #129
Closed

CW20 interface compliant contracts #83

bryanchriswhite opened this issue Sep 8, 2022 · 0 comments · Fixed by #129
Labels
C-enhancement Category: New feature or request
Milestone

Comments

@bryanchriswhite
Copy link

bryanchriswhite commented Sep 8, 2022

Acceptance Criteria

  1. An entity exists which tracks contracts and relates to primitive entities (e.g. msgs / events).
  2. An entity exists which represents contracts that support the CW20 interface.

Proposal

Example schema

As far as I'm aware, the only sources of information the indexer will have to deduce a contract's API are the store, initialize, or execution messages for that contract.

Options:

  1. We could consider looking at the structure of the initialization message a given contract to classify it.
    For example, the base CW20 instantiate message looks like this:
pub struct InstantiateMsg {
    pub name: String,
    pub symbol: String,
    pub decimals: u8,
    pub initial_balances: Vec<Cw20Coin>,
    pub mint: Option<MinterResponse>,
    pub marketing: Option<InstantiateMarketingInfo>,
}

(NB: cw20::Cw20Coin defined here)

  1. We could also watch for execution messages (success and error) over time to build a picture of known supported methods. Technically, this is already happening as we process everything in primitives. What would still be needed for this approach would be to check the methods seen and classifying a contract to interface(s) when some confidence threshold has been reached. Perhaps it makes sense to do this off of the ExecuteContractMessage handler as that's where we're getting our reference to what methods have been called.
  2. Combine 1 & 2: We could use the approach 1 to take an educated guess as to what interface(s) we think a contract might support as soon as it's initialized. As we see actual messages over time, we can update our guess based on both success and error responses to messages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants