10 unstable releases (4 breaking)

0.6.0 Feb 27, 2024
0.5.0 Nov 6, 2023
0.4.2 Mar 16, 2023
0.1.0 Dec 16, 2022

#369 in Magic Beans

Download history 6/week @ 2024-02-15 239/week @ 2024-02-22 60/week @ 2024-02-29 15/week @ 2024-03-07 4/week @ 2024-03-14 36/week @ 2024-03-28

55 downloads per month

Apache-2.0

67KB
1.5K SLoC

A crosschain execution engine build in Phat Contract

inDex Execution Engine Diagram

Terminology

  • Task

    A Task contains bunch of steps, each of step represents an operation on a blockchain. It can be one of Bridge, Swap, and Transfer

  • Request

    A request contains task information and worker account that will be used to execute the task

  • Handler

    Proxy contract deployed on every source chain that we supported. Handler contract contains a task queue that only whitelisted workers can claim(consume) task from it. Solidity version implementation can be found here

  • Worker

    An account used to temporary hold user assets and send transaction to blockchain. Worker accounts are pre-derived inside Phat contract, those key will never reveal for the outside

Prepare environment

If your are new for Ink! smart contract language, please head to Parity Ink document or you can checkout our PhatContract document for the details.

  • Install dependencies
 $ yarn

Compile contract

This repo contains several contracts, each of them can be compiled and deployed individually, for example build <target-contract>:

 $ cd contracts/<target-contract>
 $ cargo contract build

or use Devphase

 $ yarn devphase compile

You can also specify which the contract to build by adding the contract name. The name should be in snake case, consistent with the directory names under contracts/.

Test with Devphase

 $ yarn devphase test

Launch a standalone local test stack for custom testing

  1. start the local stack.
 $ yarn devphase stack
  1. Init the testnet (currently by this script)
# edit .env file
 $ node src/setup-drivers.js
  1. You can also dump the contract log from the log server driver with the same scripts:
 $ node src/dump-logs.js

The tests are written in TypeScript at ./tests/*.test.ts. The logs are output to ./logs/{date} directory.

Deploy contract on live network

You can either use phala/sdk or the Webpage App deploy the contract, we highly recommend use the Webpage App to save your time.

Play with inDEX

Follow play-with-index and have a try

Dependencies

~11–14MB
~248K SLoC