EVM Precompiles
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);
  • execute_batch: Sends a messages 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.

struct ExecuteMsg {
    string contractAddress;
    bytes msg;
    bytes coins;
}
/// Executes collection of messages on a CosmWasm contract.
/// @param executeMsgs The Sei address of the contract to execute.
/// @return The execution responses collection from the CosmWasm contract.
function execute_batch(
    ExecuteMsg[] memory executeMsgs
) payable external returns (bytes[] memory responses);

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).