Awesome
A crosschain execution engine build in Phat Contract
Terminology
-
Task
A Task contains bunch of steps, each of step represents an operation on a blockchain. It can be one of
Bridge
,Swap
, andTransfer
-
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
- start the local stack.
$ yarn devphase stack
- Init the testnet (currently by this script)
# edit .env file
$ node src/setup-drivers.js
- 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