andrew-fleming / protostar

Protostar is a toolchain for developing and testing StarkNet contracts

Home Page:https://docs.swmansion.com/protostar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

protostar-logo protostar-logo

Starknet smart contract development toolchain


Table of contents

About

Protostar manages your dependencies, compiles your project, and runs tests.

Documentation

https://docs.swmansion.com/protostar/

Additional resources

Installation

To install the tool, run:

curl -L https://raw.githubusercontent.com/software-mansion/protostar/master/install.sh | bash

If you want to specify a version, run the following command with the requested version:

curl -L https://raw.githubusercontent.com/software-mansion/protostar/master/install.sh | bash -s -- -v 0.3.2

Development

Requirements

Setting up environment

  1. Install Python version management tool: pyenv or asdf
  2. Install Python 3.9.14 using the Python version management tool and activate that version
    • To be able to build Protostar, set the following environmental variable before installing Python: PYTHON_CONFIGURE_OPTS="--enable-shared"
  3. Clone this repository
  4. Verify the active Python version: python -V
  5. Install Poetry — a dependency manager
  6. Create Python virtual environment in the project directory: poetry env use 3.9
  7. Activate environment: poetry shell
  8. Upgrade pip: pip install --upgrade pip
  9. Install project dependencies: poetry install
    • MacBook M1/M2: CFLAGS=-I/opt/homebrew/opt/gmp/include LDFLAGS=-L/opt/homebrew/opt/gmp/lib poetry install
  10. Install bindings for the rust tools used by protostar:
  11. Patch the git's config by always allowing file transport: git config --global protocol.file.allow always (needed for some tests to pass)
  12. Verify the setup by running tests: poe test
  13. Build Protostar: poe build
    • You can find the newly created binary at dist/protostar/protostar

Bumping cairo bindings version

To bump cairo bindings version to the latest commit on fork (master branch), run:

poetry run poe bump_cairo_bindings

After this, you can pull & rebuild your local version of bindings by running:

poetry run poe install_cairo_bindings
Caveats:

Remember to have your working tree clean, since it creates a commit on the current branch.

The command will check if the tracking branch is master, so you don't commit/push to master by accident (would be rejected by branch protection).

Submodules development

You can use submodules from a different branch than main. Run commands

git submodule set-branch --branch <your-branch>
poetry run poe install_cairo_bindings

Remember to not push those changes to the repository.

Git hooks

Run the following script to enable lint checks and automatic formatting before commit/push.

./scripts/apply_hooks.sh

Updating website/docs

Please read website/README.md.

Deployment

$ poe deploy
Current Protostar version: 0.1.0
Provide the new Protostar version:

About

Protostar is a toolchain for developing and testing StarkNet contracts

https://docs.swmansion.com/protostar/

License:MIT License


Languages

Language:Python 84.2%Language:Cairo 12.5%Language:TypeScript 2.1%Language:JavaScript 0.5%Language:Shell 0.5%Language:CSS 0.2%