This repository contains everything needed to use XVM from WASM contracts.
It contains an implementation of XVM chain-extension to use in your contracts.
As well as ink! contracts SDK that implements XVM chain-extension to be used as is.
XVMv2 can only process transactions that returns ()
hence query values is not supported yet. These contracts only implement functions that modify state.
Transactions pass multiple layers of XVM abstractions in one line. All cross-VM communication looks like it all going inside the smart contract.
This implementation is a controller of an underlying ERC20
on EVM. Interact with H160
addresses
This implementation is a controller of an underlying ERC20
on EVM. Interact with H256
native substrate addresses.
It implements PSP22
standard, and thus can be used in any DEX/wallet supporting it.
This implementation is a wrapper of an underlying ERC20
on EVM. Interact with H256
native substrate addresses.
As it implements wrapper pattern it has deposit
& withdraw
function and can be used as a bridgeless solution between WASM VM & EVM.
It implements PSP22
standard, thus can be used in any DEX/wallet supporting it.
This implementation is a controller of an underlying ERC721
on EVM. Interact with H160
addresses
This implementation is a controller of an underlying ERC721
on EVM. Interact with H256
native substrate addresses.
It implements PSP34
standard, and thus can be used in any DEX/wallet supporting it.
This implementation is a wrapper of an underlying ERC721
on EVM. Interact with H256
native substrate addresses.
As it implements wrapper pattern it has deposit
& withdraw
function and can be used as a bridgeless solution between WASM VM & EVM.
It implements PSP34
standard, and thus can be used in any DEX/wallet supporting it.
Implementation of XVM chain extension added to a custom XvmDefaultEnvironment
.
- Import the crate in your Cargo.toml
- Add it to your contract in ink! macro
#[ink::contract(env = xvm_sdk::XvmDefaultEnvironment)]
. - In your contract use it with
self.env().extension().xvm_call(..args)
.
This crate exposes Xvm
struct that implements xvm_call with chain-extension builder from ink_env.
It makes it compatible with other custom environment like openbrush.
Have a look at PSP22 Wrapper for an example.
- Import the crate in your Cargo.toml
- Import struct in your contract use
use xvm_helper::*;
- Use it with
XvmErc20::transfer(..args)
- Build & run Astar in local
./target/release/astar-collator --dev --tmp
- Add Test account that is funded with native token to metamask .
- Using Remix IDE deploy an ERC20 (or ERC721 mint) using injected provider to Astar local & the test account.
- Transfer ERC20 or mint ERC721 token from test account to Alice H160.
- Deploy ink! contract with ERC20/ERC721 address from EVM.
- Play with it!