EVM <> Wasm Interoperability
Precompiled Contracts
CosmWasm

CosmWasm Precompile

Address: 0x0000000000000000000000000000000000001002

This precompile serves as an interface to the CosmWasm module, enabling EVM based clients and smart contracts to interact with CosmWasm contracts directly.

Functions

Transactions

  • instantiate: Instantiates a new CosmWasm contract

Payable: Any Sei amounts used to instantiate must be sent to the contract directly. Use the coins field for other params.

/// Instantiates a new CosmWasm contract.
/// @param codeID The codeID of the contract.
/// @param admin The Sei address of the account to be set as contract admin.
/// @param msg The msg to send for instantiation. The format is specified by the contract code.
/// @param label Any labels to include for the new contract.
/// @param coins Any non-sei denominations that the contract requires for instantiation.
/// @return The contract address and associated data.
function instantiate(
    uint64 codeID,
    string memory admin,
    bytes memory msg,
    string memory label,
    bytes memory coins
) payable external returns (string memory contractAddr, bytes memory data);
  • execute: Sends a message to a CosmWasm contract for execution

Payable: Any Sei amounts required for contract execution must be sent to the contract directly. Use the coins field for other params.

/// Executes some message on a CosmWasm contract.
/// @param contractAddress The Sei address of the contract to execute.
/// @param msg The msg to send for execution. The format is specified by the contract code.
/// @param coins Any non-sei denominations that the contract requires for execution.
/// @return The execution response from the CosmWasm contract.
function execute(
    string memory contractAddress,
    bytes memory msg,
    bytes memory coins
) payable external returns (bytes memory response);

Queries

  • query: Queries a CosmWasm contract state
    /// Queries a CosmWasm contract.
    /// @param contractAddress The Sei address of the contract to query.
    /// @param req The query requeest object. The format is specified by the contract code.
    /// @return The response from the CosmWasm contract.
    function query(
        string memory contractAddress,
        bytes memory req
    ) external view returns (bytes memory response)

View the CosmWasm precompile source code and the contract ABI here (opens in a new tab).