GithubHelp home page GithubHelp logo

hdahme / econia Goto Github PK

View Code? Open in Web Editor NEW

This project forked from econia-labs/econia

0.0 0.0 0.0 7.86 MB

Hyper-parallelized on-chain order book for the Aptos blockchain

License: Apache License 2.0

Shell 1.37% Python 7.21% Jupyter Notebook 11.41% Move 80.01%

econia's Introduction

Discord chat Econia move documentation (move) Discord chat License

Econia

e·co·ni·a | /ə'känēə/

Hyper-parallelized on-chain order book for the Aptos blockchain

Developer setup

Shell scripts

The easiest way to develop Econia is with the provided shell scripts, and the fastest way to run these scripts is by adding the following function to your runtime configuration file (~/.zshrc, ~/.bash_profile, etc):

# Shell script wrapper: pass all arguments to ./ss.sh
s() {source ss.sh "$@"}

Now you will be able to run the provided ss.sh shell script file in whatever directory you are in by simply typing s:

% git clone https://github.com/econia-exchange/econia.git
% cd econia
% s hello
Hello, Econia developer

See ss.sh within a given directory for its available options

Command line setup

  1. First follow the official Aptos developer setup guide

  2. Then install the aptos CLI

    cargo install --git https://github.com/aptos-labs/aptos-core.git aptos --branch devnet
    aptos config set-global-config --config-type global
    aptos init
    • Note that this will go faster if adding a precompiled binary to ~/.cargo/bin rather than installing via cargo
    • If the precompiled binary has not been released yet, additionally consider installing from Git, a method that does not always require rebuilding intermediate artifacts
  3. Now you should be able to run all Move tests:

    # From inside Econia repository root directory
    s mp # Navigate to Move package
    s ta # Run all tests
    INCLUDING DEPENDENCY AptosFramework
    INCLUDING DEPENDENCY MoveNursery
    INCLUDING DEPENDENCY MoveStdlib
    BUILDING Econia
    Running Move unit tests
    ...
  4. Then install the move CLI:

    cargo install --git https://github.com/move-language/move move-cli
  5. Now you should be able to build the Move documentation:

    # Still within Move package
    s d
    INCLUDING DEPENDENCY AptosFramework
    INCLUDING DEPENDENCY MoveNursery
    INCLUDING DEPENDENCY MoveStdlib
    BUILDING Econia
  6. Should aptos-core #2142 be accepted, installing the move CLI will no longer be necessary for this step, and the relevant script should be updated to run on the aptos CLI alone

Using the Python package

Econia comes with a Python package for assorted build scripting functionality. The Python package is not as actively maintained as the Move code, and is mostly used for managing account addresses in Move.toml during package compilation (see src/move/econia/ss.sh). While the Python package is no longer used for direct interactions with devnet via the v1 REST API, rest.py is preserved such that it can be integrated with the new Aptos Python SDK when applicable. It is not necessary to use the Python package to develop Econia, but not all of the shell scripts will work without it. To install the econia Python package:

  1. First install Homebrew:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Then brew install Miniconda:

    brew install miniconda # Python package management
  3. Create the econia conda environment with the Econia Python package inside:

    conda env create -f env/conda.yml
    conda activate econia
    pip install -e src/python
  4. Create the secrets directories as needed:

    if ! test -d .secrets; then mkdir .secrets; fi
    if ! test -d .secrets/old; then mkdir .secrets/old; fi
    if ! test -d .secrets/vanity; then mkdir .secrets/devnet; fi

Econia uses conda (a command line tool for managing Python environments), the econia conda environment, and the Econia Python package within the econia conda environment. If using VS Code, select econia as the default Python interpreter, and the integrated terminal should automatically activate it as needed, otherwise use the command line:

# To activate
(base) % conda activate econia
# To deactivate
(econia) econia % conda deactivate

With the econia conda environment active, you can then build the Python package documentation, explore the provided interactive Jupyter notebook archive, and run package management shell scripts:

# Autobuild Sphinx documentation with realtime updates
(econia) % s ab
# Open Jupyter notebook gallery
# Earliest notebooks subject to breaking changes
(econia) % s nb
# Change directory to the Econia Move package
(econia) % s mp
# Move package has its own utility shell scripts
(econia) % s pt # Publish bytecode to temporary devnet address

Using the TypeScript SDK

Econia v1.1.0 contained an auto-generated TypeScript SDK, contributed and maintained by Manahip. Econia's current branch does not yet have one, but it is on the way.

Freeing up disk space

Installing all of the dependencies necessary to develop Econia can quickly take up disk space. To clean up cache files and intermediate artifacts, consider the following tools:

In particular, if using a Mac local Time Machine snapshots of intermediate artifacts may lead to excessive "purgable" disk space should substantial time pass between backups. It is possible to disable snapshots as mentioned in the support thread, but backing up to Time Machine should also help purge snapshots of intermediate artifacts, once the above tools are invoked.

Major filetypes

Jupyter

Interactive Jupyter notebook examples are at src/jupyter, listed in increasing order of creation number. The earliest notebooks are subject to breaking changes at the most recent commit, but they have been archived so as to be functional at the commit when they where finalized. Hence, older commits can be checked out and experimented with, but mostly they are useful for harvesting old code patterns.

Markdown

Markdown files have a line break for each new sentence to make diff tracking easier. GitBook markdown source files are at doc/doc-site/.

Move

Move source code is at src/move/econia. In the absence of a formal style guide, Move code is formatted similarly to PEP8-style Python code. Auto-generated module documentation files are at src/move/econia/build/Econia/docs.

Python

The Econia Python package source code is at src/python/econia. Python source is formatted according to the PEP8 style guide, and uses NumPy-style docstrings and PEP484-style type annotations, which are automatically parsed into a documentation website via Sphinx. Sphinx documentation source files are at doc/sphinx.

econia's People

Contributors

alnoki avatar xorkiki avatar manahip avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.