Skip to content

OpenZeppelin/compact-contracts

Repository files navigation

Generic badge Contributor Covenant

OpenZeppelin Contracts for Compact

A library for secure smart contract development written in Compact for Midnight.

⚠️ WARNING! ⚠️

This repo contains highly experimental code. Expect rapid iteration. Use at your own risk.

Installation

Make sure you have nvm, yarn, and turbo installed on your machine.

Follow Midnight's compact installation guide and confirm that compactc is in the PATH env variable.

$ compactc

Compactc version: 0.23.0
Usage: compactc.bin <flag> ... <source-pathname> <target-directory-pathname>
       --help displays detailed usage information

Set up the project

Requirements

Clone the repository:

git clone [email protected]:OpenZeppelin/compact-contracts.git

cd into it and then install dependencies and prepare the environment:

nvm install && \
yarn && \
turbo compact

Usage

Compile the contracts

$ turbo compact

(...)
✔ [COMPILE] [1/2] Compiled FungibleToken.compact
@openzeppelin-compact/fungible-token:compact:     Compactc version: 0.23.0
@openzeppelin-compact/fungible-token:compact:
✔ [COMPILE] [1/6] Compiled Initializable.compact
@openzeppelin-compact/utils:compact:     Compactc version: 0.23.0
@openzeppelin-compact/utils:compact:
✔ [COMPILE] [2/6] Compiled Pausable.compact
@openzeppelin-compact/utils:compact:     Compactc version: 0.23.0
@openzeppelin-compact/utils:compact:
✔ [COMPILE] [3/6] Compiled Utils.compact
@openzeppelin-compact/utils:compact:     Compactc version: 0.23.0
@openzeppelin-compact/utils:compact:
✔ [COMPILE] [4/6] Compiled test/mocks/MockInitializable.compact
@openzeppelin-compact/utils:compact:     Compactc version: 0.23.0
@openzeppelin-compact/utils:compact:     Compiling 3 circuits:
✔ [COMPILE] [5/6] Compiled test/mocks/MockPausable.compact
@openzeppelin-compact/utils:compact:     Compactc version: 0.23.0
@openzeppelin-compact/utils:compact:     Compiling 5 circuits:
✔ [COMPILE] [6/6] Compiled test/mocks/MockUtils.compact
@openzeppelin-compact/utils:compact:     Compactc version: 0.23.0
@openzeppelin-compact/utils:compact:

✔ [COMPILE] [2/2] Compiled test/mocks/MockFungibleToken.compact
@openzeppelin-compact/fungible-token:compact:     Compactc version: 0.23.0
@openzeppelin-compact/fungible-token:compact:     Compiling 15 circuits:


 Tasks:    2 successful, 2 total
Cached:    0 cached, 2 total
  Time:    7.178s

Note: Speed up the development process by skipping the prover and verifier key file generation:

turbo compact -- --skip-zk

Run tests

turbo test

Format and lint files

turbo fmt-and-lint:fix

All together now!

turbo compact test fmt-and-lint:fix

Security

This project is still in a very early and experimental phase. It has never been audited nor thoroughly reviewed for security vulnerabilities. DO NOT USE IT IN PRODUCTION.

Please report any security issues you find to [email protected].

About

OpenZeppelin Contracts written in Compact for Midnight

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published