Skip to content

Cw20 state key compatibity with previous versions  #346

@MSNTCS

Description

@MSNTCS

Hello there,

In this CW20 version version = "0.2" we used byte string as a key for rhis state.

const TOKEN_INFO_KEY: &[u8] = b"token_info";

In the new version of CW20 version = "0.7.0", however, as we use storage_key.as_bytes() for Item, the key that we use here is not the identical as the previous key.

pub const TOKEN_INFO: Item<TokenInfo> = Item::new("token_info");

For migrating the contract to this new version, we have the problem of not having the same key.

 error: 'rpc error: code = Unknown desc = cw20_base::state::TokenInfo not found: contract query failed'

We must put the length bytes at the first for compatibility with the legacy singleton store.

Is this new key would be the new format for the TOKEN_INFO key or can we have it compatible with previous versions?

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