On-chain order book that atomically settles trades

Overview

phoenix

Phoenix is an on-chain orderbook that operates without a crank.

Documentation

Documentation and instructions on how to interact with the program are available on GitBook.

Licensing

The primary license for Phoenix is the Business Source License 1.1 (BUSL-1.1), which can be found at LICENSE.

Audits

Phoenix has been audited by OtterSec. The audit report can be found at audits/OtterSec.pdf.

Bug Bounty

Information on the bug bounty program for Phoenix can be found at SECURITY.md.

Build Verification

You can use Solana Verify CLI to verify that the program deployed at PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY matches the code in this repository. After installing the CLI, run:

solana-verify verify-from-repo -um --program-id PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY https://github.com/Ellipsis-Labs/phoenix-v1

This may take awhile as it builds the program inside Docker, then verifies that the build hash matches the deployed program hash. The verification process is much faster on a non-ARM machine.

Building and Testing Locally

To build the contract, run:

./build.sh

To run the tests, run:

./test.sh
Comments
  • Exact dependencies here make the SDK less useful

    Exact dependencies here make the SDK less useful

    phoenix-v1 is a program so it's good that it has exact dependencies, however phoenix-v1 is also used as a library in phoenix-sdk-core so anyone using phoenix-sdk-core gets locked into a specific version of stuff like spl-token.

    This probably requires a separate library crate for stuff that's common between the SDK and the program?

    opened by kevinheavey 9
  • Time In Force (#23)

    Time In Force (#23)

    Time-in-force (TIF) orders for Phoenix v1.

    Changes:

    • Uses the padding on the FIFORestingOrder to store and expiration slot and an expiration time
    • Modifies the OrderPacket struct to enable specification of expiration
    • Injects logic into the matching engine to skip orders that are expired
    opened by jarry-xiao 0
  • Add minor changes to matching engine logic

    Add minor changes to matching engine logic

    Changes:

    • DecrementTake handles partial removals
    • Free fund accounting now occurs after the matching/order placement to ensure that checks work as intended.
    opened by jarry-xiao 0
  • Time In Force

    Time In Force

    Draft implementation of time-in-force (TIF) orders for Phoenix v1.

    Added a standard test in test_market.rs. Could use more coverage

    Changes:

    • Uses the padding on the FIFORestingOrder to store and expiration slot and an expiration time
    • Modifies the OrderPacket struct to enable specification of expiration
    • Injects logic into the matching engine to skip orders that are expired
    opened by jarry-xiao 0
  • Add dockerfile for verified build

    Add dockerfile for verified build

    This points to the published image at ellipsislabs/phoenix-v1:v0.1.1

    solana-verify verify-from-image -e target/deploy/phoenix.so -i ellipsislabs/phoenix-v1:v0.1.1 -p PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY -um
    

    This will verify the program and print the following output

    Verifying image: "ellipsislabs/phoenix-v1:v0.1.1", on network Some("m") against program ID PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY
    Executable path in container: "target/deploy/phoenix.so"
    
    Executable hash: 4d22fa635c85547d0280e5165f5d0901bdf2b553efb2d9e95772a02b79530a9c
    Program hash: 4d22fa635c85547d0280e5165f5d0901bdf2b553efb2d9e95772a02b79530a9c
    Executable matches on-chain program data ✅
    
    opened by jarry-xiao 0
  • Phoenix v1/crate boundaries

    Phoenix v1/crate boundaries

    Changes:

    • Partition structs and functions into pub(crate) and pub
    • Introduce a WritableMarket trait to create a logical separation between read/write functionality in the market
    opened by jarry-xiao 0
  • Instructions in README.md

    Instructions in README.md

    hey seems building the phoenix requires more crates and packages than expected, would be cool to add them to readme file. Also having issues between solana-bpf and solana-sbf, can make a pull req with changes if you like.

    opened by hydrogenbond007 0
Releases(v0.1.1)
Owner
Ellipsis Labs
Ellipsis Labs
Sample Artemis bot to fill UniswapX orders using on-chain liquidity

UniswapX Atomic Filler This is a sample Artemis bot that fills UniswapX orders atomically using Uniswap v2 and v3 liquidity. Feel free to fork and mod

null 102 Jul 25, 2023
tectonicdb is a fast, highly compressed standalone database and streaming protocol for order book ticks.

tectonicdb crate docs.rs crate.io tectonicdb tdb-core tdb-server-core tdb-cli tectonicdb is a fast, highly compressed standalone database and streamin

Ricky Han 525 Dec 23, 2022
A simple toy websocket client to connect to Bitstamp.net and print the live order book written in Rust.

A simple toy websocket client to connect to Bitstamp.net and print the live order book written in Rust.

Nate Houk 1 Feb 14, 2022
An open source, high performance limit order book for the Seaport smart contracts. Implemented in Rust using ethers-rs, this offers a turnkey option for digital asset marketplaces.

Quay Quay is an open source, high performance backend for the Seaport smart contracts. The project is implemented in Rust, using Postgres as a storage

Valorem Labs Inc. 169 Jun 23, 2023
Following "ZK HACK III - Building On-chain Apps Off-chain Using RISC Zero"

RISC Zero Rust Starter Template Welcome to the RISC Zero Rust Starter Template! This template is intended to give you a starting point for building a

drCathieSo.eth 3 Dec 22, 2022
🧑🏻‍⚕️ Command-line utility which poll on remote addresses in order to perform status checks periodically

ナース (Nāsu) ????‍⚕️ Command-line utility which poll on remote addresses in order to perform status checks periodically Motivation Nāsu (from Japanese ナ

Esteban Borai 13 Nov 14, 2021
Mundane is a Rust cryptography library backed by BoringSSL that is difficult to misuse, ergonomic, and performant (in that order).

Mundane Mundane is a Rust cryptography library backed by BoringSSL that is difficult to misuse, ergonomic, and performant (in that order). Issues and

Google 1.1k Jan 3, 2023
Source code for our paper "Higher-order finite elements for embedded simulation"

Higher-order Finite Elements for Embedded Simulation This repository contains the source code used to produce the results for our paper: Longva, A., L

Interactive Computer Graphics 18 Sep 30, 2022
Mundane is a Rust cryptography library backed by BoringSSL that is difficult to misuse, ergonomic, and performant (in that order).

Mundane Mundane is a Rust cryptography library backed by BoringSSL that is difficult to misuse, ergonomic, and performant (in that order). Issues and

Google 1.1k Jan 3, 2023
A Rust library for evaluating log4j substitution queries in order to determine whether or not malicious queries may exist.

log4j_interpreter A Rust library for evaluating log4j substitution queries in order to determine whether or not malicious queries may exist. Limitatio

Fastly 22 Nov 7, 2022
High-order Virtual Machine (HVM) is a pure functional compile target that is lazy, non-garbage-collected and massively parallel

High-order Virtual Machine (HVM) High-order Virtual Machine (HVM) is a pure functional compile target that is lazy, non-garbage-collected and massivel

null 5.5k Jan 2, 2023
TreeFlat - the simplest way to build & traverse a pre-order Tree in Rust

TreeFlat is the simplest way to build & traverse a pre-order Tree for Rust. Alpha-relase! If you build a Tree in pre-order, and display in pre-order,

Mario Montoya 22 Dec 16, 2022
Using USBPcap to side-step anticheat in games, in order to reroute rumble packets to sex toys via The Buttplug Sex Toy Control Library

Using USBPcap to side-step anticheat in games, in order to reroute rumble packets to sex toys via The Buttplug Sex Toy Control Library.

qDot 23 Jan 3, 2023
An implementation of Code Generation and Factoring for Fast Evaluation of Low-order Spherical Harmonic Products and Squares

sh_product An implementation of Code Generation and Factoring for Fast Evaluation of Low-order Spherical Harmonic Products and Squares (paper by John

Simon Brown 7 Dec 2, 2022
Functions for mapping plaintexts to a u64 while preserving sort order

ore_encoding.rs This is a companion package to ore.rs that can generate and manipulate u64 plaintexts before they are encrypted by ore.rs. Being able

CipherStash 2 Dec 14, 2022
First Git on Rust is reimplementation with rust in order to learn about rust, c and git.

First Git on Rust First Git on Rust is reimplementation with rust in order to learn about rust, c and git. Reference project This project refer to the

Nobkz 1 Jan 28, 2022
Log for concurrent workloads, with support for atomic batches and in-order recovery

sharded-log A batch-oriented multi-threaded sharded log for workloads that occasionally flush logs into some other system. All batches have a 32-bit C

Komora 16 Nov 20, 2022
Various extention traits for providing asynchronous higher-order functions

async-hofs Various extention traits for providing asynchronous higher-order functions. // This won't make any name conflicts since all imports inside

かわえもん 5 Jun 28, 2022
Generate IPv4 12th order Hilbert heatmaps from a file of IPv4 addresses.

Rustified IPv4 Heatmap This is a pure Rust version of the C ipv4-heatmap utility originally published by The Measurement Factory and updated forever-a

boB Rudis 8 Sep 28, 2022