Skip to content

CW2: adding supported interfaces value #842

@eledra89

Description

@eledra89

Following some of the discussion on Twitter: https://twitter.com/EledraNguyen/status/1587640345701281792

Motivation

There should be an easy way to detect what interfaces a cosmwasm contract implements (similar to EIP-165). There are several situations both on-chain and off-chain for such feature:

  • An indexer wants to categorize different types of contract.
  • A multichain application (wallet, marketplace, etc.) that already support ERC-165 from EVM chain wants to render different UX for different type of contracts.
  • A contract wants different ways to interact with other contracts depending on their types.

Implementation

We propose to add an optional map containing supported interfaces in the ContractVersion struct for these values.
The supported interface value should be a string of pre-defined format: :

For example: ["crates.io:cw721","crates.io:cw2"]

Notes

There is no way to enforce the string format or forcing the contract to have actual implementation of the declared interfaces. Thus, this variable is entirely optional for both the implementor as well as the caller.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions