Phala's ink! - Writing Enhanced Smart Contracts

Pink! is a smart contract language extending Parity's ink!. It extends the basic functionality with additional features, tailored to interact efficiently with Phala's Phat Contract runtime.

Getting Started

Unaltered ink! contracts are fully compatible and executable on the Phala's Phat Contract platform. To learn how to start writing contracts with ink!, follow the Parity's ink! documentation.

To get started with Pink!, add the following dependency to your Cargo.toml:

```toml [dependencies] ink = { version = "4", default-features = false } pink = { package = "pink-extension", version = "0.4", default-features = false }

[features] std = [ "ink/std", "pink/std", ] ```

Then, you can use the http_get! macro to make a GET request to a remote server:

```ignore

[ink::message]

fn httpgetexample(&self) { let response = pink::httpget!("https://httpbin.org/get"); asserteq!(response.status_code, 200); } ```

Phat Contract-Specific Features

The Pink! crate is designed to empower you, enabling you to leverage the unique features of the Phat Contract, such as making HTTP requests as demonstrated in our examples. This crate supplies the crucial types and functions needed to seamlessly interact with the Phat Contract runtime.

There are three kind of APIs to communication with the runtime:

For practical implementation examples, explore our Phat Contract examples repository.

Using JavaScript with Phat Contract

Phat Contract supports JavaScript through the phat-quickjs contract.

There are two ways to use JavaScript in your contract: