Overview
The WASM precompile enables seamless interaction with CosmWasm smart contracts from EVM applications. This bridge allows EVM developers to execute, query, and instantiate CosmWasm contracts using familiar Ethereum tooling and patterns. Contract Address:0x0000000000000000000000000000000000001002
Key Features
- Contract Execution: Execute CosmWasm contract functions from EVM
- Batch Operations: Execute multiple contract calls in a single transaction
- Contract Instantiation: Deploy new CosmWasm contracts from EVM
- Query Support: Read contract state without gas costs
- Cross-Ecosystem Bridge: Connect EVM and CosmWasm ecosystems
Available Functions
Contract Interaction
execute(string, bytes, bytes) → bytes
execute(string, bytes, bytes) → bytes
Execute a function on a CosmWasm smart contract.Parameters:
contractAddress
(string): CosmWasm contract addressmsg
(bytes): Encoded execution messagecoins
(bytes): Encoded coins to send with execution
response
(bytes): Contract execution response
execute_batch(ExecuteMsg[]) → bytes[]
execute_batch(ExecuteMsg[]) → bytes[]
Execute multiple CosmWasm contract functions in a single transaction.Parameters:
executeMsgs
(ExecuteMsg[]): Array of execution messages
responses
(bytes[]): Array of contract responses
query(string, bytes) → bytes
query(string, bytes) → bytes
Query a CosmWasm contract’s state (read-only).Parameters:
contractAddress
(string): CosmWasm contract addressreq
(bytes): Encoded query request
response
(bytes): Query response data
instantiate(...) → (string, bytes)
instantiate(...) → (string, bytes)
Deploy a new CosmWasm contract instance.Parameters:
codeID
(uint64): Code ID of the contract to instantiateadmin
(string): Admin address for the contractmsg
(bytes): Instantiation messagelabel
(string): Human-readable labelcoins
(bytes): Coins to send during instantiation
contractAddr
(string): Address of the new contractdata
(bytes): Instantiation response data
Usage Examples
Message Encoding
JSON Message Format
CosmWasm contracts expect JSON messages. Encode them as bytes:Coins Encoding
Send native tokens with contract calls:Common Use Cases
DeFi Integration
- Token Contracts: Interact with CW20 tokens from EVM
- DEX Integration: Execute swaps on CosmWasm DEXs
- Lending Protocols: Deposit/borrow through WASM contracts
NFT Operations
- CW721 Interaction: Mint, transfer, and query NFTs
- Marketplace Integration: Buy/sell NFTs through contracts
- Metadata Management: Update NFT metadata
Cross-Chain Applications
- IBC Integration: Trigger IBC transfers through contracts
- Bridge Operations: Interact with bridge contracts
- Multi-Chain Coordination: Coordinate actions across chains