Skip to main content

ape-cairo: A compiler plugin for the cairo programming language

Project description

Quick Start

Ape compiler plugin around the Cairo language.

Dependencies

  • python3 version 3.8 or greater, python3-dev

Installation

via pip

You can install the latest release via pip:

pip install ape-cairo

via setuptools

You can clone the repository and use setuptools for the most up-to-date version:

git clone https://github.com/ApeWorX/ape-cairo.git
cd ape-cairo
python3 setup.py install

Quick Usage

In a project directory where there are .cairo files in your contracts/ directory, run the compile command:

ape compile

Configure Dependencies

You can configure dependencies, such as from GitHub, using your ape-config.yaml file.

There are two things you need to add:

  1. Add your dependency to Ape's root dependencies: key to trigger downloading and compiling it.
  2. Configure the ape-cairo plugin to load that dependency in your project.

For more information on dependencies, see this guide.

Your ape-config.yaml will look something like:

dependencies:
  - name: OpenZeppelinCairo
    github: OpenZeppelin/cairo-contracts
    version: 0.1.0
    contracts_folder: src

cairo:
  dependencies:
    - OpenZeppelinCairo@0.1.0

NOTE: We are changing the contracts/ folder to be src for this dependency.

Now, in my contracts/ folder, I can import from openzeppelin:

from openzeppelin.token.erc20.library import (
    ERC20_name,
    ERC20_symbol,
    ERC20_totalSupply,
    ERC20_decimals,
    ERC20_balanceOf,
    ERC20_allowance,
    ERC20_mint,
    ERC20_burn,
    ERC20_initializer,
    ERC20_approve,
    ERC20_increaseAllowance,
    ERC20_decreaseAllowance,
    ERC20_transfer,
    ERC20_transferFrom
)

Development

This project is in development and should be considered a beta. Things might not be in their final state and breaking changes may occur. Comments, questions, criticisms and pull requests are welcomed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ape-cairo-0.5.0a4.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

ape_cairo-0.5.0a4-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file ape-cairo-0.5.0a4.tar.gz.

File metadata

  • Download URL: ape-cairo-0.5.0a4.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for ape-cairo-0.5.0a4.tar.gz
Algorithm Hash digest
SHA256 c007134abe84211f103e9a3c69a38b97f6fd08fb5e573752a7dc92b5319d7f1c
MD5 e12a52e082a0e3b52e3be1643d5c347c
BLAKE2b-256 92d2b89fcf9abb24d94deded612bf87ecf705532fc23c8a50706819be0f22954

See more details on using hashes here.

File details

Details for the file ape_cairo-0.5.0a4-py3-none-any.whl.

File metadata

  • Download URL: ape_cairo-0.5.0a4-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for ape_cairo-0.5.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 6521c8f98b49bd575917fd45db33d7d9b9479e6c330c865b4938207fb85334fc
MD5 2203b149d6cb88b3867a26b1a5061f22
BLAKE2b-256 eb8e2695155c8d13699f6f477253fc4b9d865eb5df634cd553a607f09eede989

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page