Skip to content

Module: Wasm

The wasm module of Nibiru Chain allows for executing CosmWasm smart contracts, enabling developers to build decentralized applications (dApps) with transaction messages for contract deployment, execution, and parameter updates. It emits events for transaction indexing, aiding contract interaction tracking and platform adoption.

Contents

Reference:

Events

A number of events are returned to allow transaction messages (TxMsgs) from smart contracts to be indexed.

The module for each event is "wasm", and code_id is only present when instantiating a contract so that users can subscribe to new contract instances. The code_id is omitted during invocation (wasm.Execute). These events are emitted any time a contract returns non-empty event attributes.

There is also an "action" field that is added automatically and has a value of either store-code, instantiate or execute depending on which message was sent:

Ex: Instantiate Event

json
{
    "Type": "message",
    "Attr": [
        {
            "key": "module",
            "value": "wasm"
        },
        {
            "key": "action",
            "value": "instantiate"
        },
        {
            "key": "signer",
            "value": "nibi1vx8knpllrj7n963p9ttd80w47kpacrhuts497x"
        },
        {
            "key": "code_id",
            "value": "1"
        },
        {
            "key": "_contract_address",
            "value": "nibi14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"
        }
    ]
}

Transaction Messages (TxMsgs)

TxMsg: WasmDescription
MsgStoreCodeMsgStoreCode to submit Wasm code to the system
MsgInstantiateContractMsgInstantiateContract creates a new smart contract instance for the given code id.
MsgInstantiateContract2MsgInstantiateContract2 creates a new smart contract instance for the given code id with a predictable address
MsgExecuteContractMsgExecute submits the given message data to a smart contract
MsgMigrateContractMsgMigrate runs a code upgrade/downgrade for a smart contract
MsgUpdateAdminMsgUpdateAdmin sets a new admin for a smart contract
MsgClearAdminMsgClearAdmin removes any admin stored for a smart contract
MsgUpdateInstantiateConfigMsgUpdateInstantiateConfig updates instantiate config for a smart contract
MsgUpdateParamsMsgUpdateParams defines a governance operation for updating the x/wasm module parameters
MsgSudoContractMsgSudoContract defines a governance operation for calling sudo on a contract
MsgPinCodesMsgPinCodes defines a governance operation for pinning a set of code ids in the wasmvm cache
MsgUnpinCodesMsgUnpinCodes defines a governance operation for unpinning a set of code ids in the wasmvm cache
MsgStoreAndInstantiateContractMsgStoreAndInstantiateContract defines a governance operation for storing and instantiating the contract
MsgRemoveCodeUploadParamsAddressesMsgRemoveCodeUploadParamsAddresses defines a governance operation for removing addresses from code upload params
MsgAddCodeUploadParamsAddressesMsgAddCodeUploadParamsAddresses defines a governance operation for adding addresses to code upload params
MsgStoreAndMigrateContractMsgStoreAndMigrateContract defines a governance operation for storing and migrating the contract
MsgUpdateContractLabelMsgUpdateContractLabel sets a new label for a smart contract

The full list of messages is described by the module's gRPC MsgClient.