Skip to content

Latest commit

 

History

History
72 lines (48 loc) · 1.72 KB

Development.md

File metadata and controls

72 lines (48 loc) · 1.72 KB

Phat Contract Implementation

Prepare the environment

  1. Initialize git submodules, and install yarn v1, node v18, and the dependencies:

    git submodule update --init
    yarn
    (cd setup; yarn)
  2. Update rust and cargo-contract (>= 3.2.0):

    rustup update
    cargo install --force --locked cargo-contract
  3. Try to start the local stack. devphase will download the selected prebuilt binaries from Github at the first time.

    yarn devphase stack

If you haven't installed node.js, it's suggested to install it via nvm. It's also suggested to install yarn (classical) by npm install --global yarn (docs).

Launch a standalone local test stack for custom testing

  1. start the local stack.

    yarn devphase stack
  2. Init the testnet (currently by this script)

    # edit .env file
    yarn
    node src/setup-drivers.js
  3. You can also dump the contract log from the log server driver with the same scripts:

    node src/dump-logs.js

To configure the local test stack, please check devphase.config.ts.

Compile contracts

yarn devphase contract 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/.

Run E2E test

Simply run:

yarn devphase contract test

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