# Nibiru-Specific Precompiled Contracts
Precompiled contracts extend the Nibiru EVM to include behavior outside of what's present on the Ethereum Virtual Machine by default. For example, Nibiru's Execution Engine allows Nibiru EVM contracts to interoperate with the Wasm VM using the Wasm precompile. And other Nibiru-specific precompiled contracts can interact with and modify state outside the EVM.
# Reference List: All Custom Precompiles
Precompile | Description | Address |
---|---|---|
Wasm.sol | Enables the invocation of Wasm VM contracts | 0x00...802 |
FunToken.sol | Makes it possible to send ERC20 tokens as bank coins to a Nibiru bech32 address using the "FunToken" mapping between the ERC20 and bank coin. | 0x00...800 |
Oracle.sol | Implements the exchange rate query from Nibiru's Oracle Module. This makes low-latency price data accessible from smart contracts. | 0x00...801 |
# Wasm Precompile
The Wasm Precompile (Wasm.sol) of Nibiru allows EVM contracts to interact directly with Wasm-based smart contracts. This enables seamless communication between the EVM and Wasm portions of the execution engine.
The Wasm precompile offers several key methods:
Wasm.sol Method | Description |
---|---|
execute | Invokes Wasm contract functions from within the EVM environment. |
query | Enables smart queries of Wasm contracts. |
instantiate | Allows for the creation of new Wasm contract instances. |
executeMulti | Facilitates batch execution of multiple Wasm contract calls. |
queryRaw | Provides low-level querying of Wasm contract state using a key for the contract's key-value store. |
These methods enable unprecedented interoperability between EVM and Wasm environments, allowing developers to leverage the strengths of both ecosystems within a single blockchain platform.
# FunToken Precompile
The FunToken precompile enables transfers between ERC20 tokens in the EVM environment and Bank Coins outside the EVM. This is enabled by the creation of a FunToken
(fungible token) mapping, as this provides a canonical tie between different token standards.
The key functionality of the FunToken precompile is encapsulated in its bankSend
method:
This method allows users to send ERC20 tokens from the Nibiru EVM environment as Bank Coins to any other Nibiru account using its Bech32 address. This opens up a world of possibilities for multi-VM applications.