Giter Site home page Giter Site logo

ink-xvm-sdk's Introduction

Ink! XVM SDK

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.

Contracts SDK

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.

ERC20

This implementation is a controller of an underlying ERC20 on EVM. Interact with H160 addresses

PSP22 Controller

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.

PSP22 Wrapper

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.

ERC721

This implementation is a controller of an underlying ERC721 on EVM. Interact with H160 addresses

PSP34 Controller

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.

PSP34 Wrapper

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.

XVM Transfer

This implementation is a controller of an underlying ERC20 on EVM. Interact with both H256 native substrate and H160 addresses. This is a universal contract where one of the parameters for the transfer function is the ERC20 contract address. This contract is used on Astar Portal.

Library

XVM environment

Implementation of XVM chain extension added to a custom XvmDefaultEnvironment.

  1. Import the crate in your Cargo.toml
  2. Add it to your contract in ink! macro #[ink::contract(env = xvm_sdk::XvmDefaultEnvironment)].
  3. In your contract use it with self.env().extension().xvm_call(..args).

XVM Builder

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.

  1. Import the crate in your Cargo.toml
  2. Import struct in your contract use use xvm_helper::*;
  3. Use it with XvmErc20::transfer(..args)

Usage

Try it local!
  1. Build & run Astar in local ./target/release/astar-collator --dev --tmp
  2. Add Test account that is funded with native token to metamask .
  3. Using Remix IDE deploy an ERC20 (or ERC721 mint) using injected provider to Astar local & the test account.
  4. Transfer ERC20 or mint ERC721 token from test account to Alice H160.
  5. Deploy ink! contract with ERC20/ERC721 address from EVM.
  6. Play with it!

Use Hoon's address converter

ink-xvm-sdk's People

Contributors

pierreossun avatar akru avatar impelcrypto avatar 0x7cfe avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.