Skip to main content

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

Project description

Ape Cairo

Ape compiler plugin around the Cairo language.

Dependencies

  • python3 version 3.7.2 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 resulting 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.

License

This project is licensed under the Apache 2.0.

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.4.0a0.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

ape_cairo-0.4.0a0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file ape-cairo-0.4.0a0.tar.gz.

File metadata

  • Download URL: ape-cairo-0.4.0a0.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.11 tqdm/4.64.0 importlib-metadata/4.12.0 keyring/23.7.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.8.13

File hashes

Hashes for ape-cairo-0.4.0a0.tar.gz
Algorithm Hash digest
SHA256 fd71fd16b773026787b8e959f6646a061f06f1bf2b106b10e414cedad6db888b
MD5 8d6f4c0402aecd7103b37be053f1bf5d
BLAKE2b-256 ff38cd116600440d108bef70c974204038eb747dac98ad5995a6527c5771d555

See more details on using hashes here.

File details

Details for the file ape_cairo-0.4.0a0-py3-none-any.whl.

File metadata

  • Download URL: ape_cairo-0.4.0a0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.11 tqdm/4.64.0 importlib-metadata/4.12.0 keyring/23.7.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.8.13

File hashes

Hashes for ape_cairo-0.4.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 e624e99c79f263ad793f52bfd43563f5592ecc7fe09b3c3218a5ccd23f640509
MD5 17ddccf4b4fcd8ec0e95e57d84d5239c
BLAKE2b-256 d8e47728289ac2cc1bcc8acae446eb3db735323c99c3b2dad04694c807e7d1e8

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