Skip to content

Allow CosmWasm contracts to mint new custom sdk.Coin denoms #671

@sunnya97

Description

@sunnya97

Currently CosmWasm-enabled chains have two token standards existing in tandem, CW20 and sdk.Coins. While CosmWasm contracts currently have an easy mechanism for interacting with sdk.Coins denoms that already exist on the chain, there's not an easy plug and play solution for contracts to mint new sdk.Coins denoms (instead, they tend to use CW20s).

Such a mechanism would be useful for many chains and applications that want to use the CosmWasm framework for writing logic in, but would prefer to only support a single token standard (sdk.Coins) for their asset layer, due to increased integration costs of multiple standards.

For example, in Osmosis, we would like to add a permissioned CosmWasm module to allow developers to build DeFi contracts on top, but if these protocols need to mint a new token, would like them to mint native sdk.Coins rather than CW20. This is because our AMM mechanism, which is written as a native Cosmos SDK module, is built to only support sdk.Coins, and would prefer to avoid the complexity of supporting both standards right now.

In order to make this minting process "permissionless", we would need to namespace minted denoms so that any contract can mint new denoms. Because CosmWasm contracts have unique address, we could just have the generated denoms be cw/{minting_contract_address}. However, because a single contract may want to mint multiple tokens, we should also have an additional namespace per contract. So minted denoms should be cw/{minting_contract_address}/nonce. This nonce can be chosen by the contract when minting new denoms (or just use increasing sequence numbers if that is preferred).

One solution that was proposed was to consider using the cw-ics20 contract with a loopback ibc channel. However, according to the ibc-go README, it seems that loopback ibc channels are not yet fully implemented.

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