https://github.com/starkware-libs/stark-perpetual
https://github.com/starkware-libs/stark-perpetual
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/starkware-libs/stark-perpetual
- Owner: starkware-libs
- License: apache-2.0
- Created: 2021-07-08T07:53:44.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-22T10:15:13.000Z (over 2 years ago)
- Last Synced: 2025-04-10T04:17:12.353Z (about 1 year ago)
- Language: Cairo
- Size: 5.28 MB
- Stars: 56
- Watchers: 2
- Forks: 17
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Audit: audit/ABDK_StarkWare_Perpetual_V3_1_v_1_0.pdf
Awesome Lists containing this project
README
# StarkEx Perpetual Resources
## Overview
This repository contains the Cairo code and a collection of tools used by StarkEx Perpetual,
StarkWare's scalability solution for derivatives trading.
If you are not familiar with StarkEx, you can read more about it [here](https://docs.starkware.co/starkex/).
Note: The Cairo code that proves spot trading, can be found [in another repo](https://github.com/starkware-libs/starkex-for-spot-trading).
If you are not familiar with the Cairo language, you can find more details about it [here](https://www.cairo-lang.org/).
The Cairo code is published to allow a permissionless audit of StarkEx business logic,
as enforced by the StarkEx smart-contract
## Repository Contents
**src/starkware/cairo/dex**, **src/services/exchange/cairo**, **src/services/perpetual/cairo**
The full Cairo program that StarkEx Perpetual executes.
It includes a Python file, *generate_program_hash_test.py*, that calculates the hash of the
Cairo code and compares it to the pre-calculated value found at *program_hash.json*
**src/starkware/crypto/starkware/crypto/signature**, **src/services/perpetual/public**
The Python implementation of the cryptographic primitives used by StarkEx.
These implementations, or equivalent implementations in other languages such as JS, are used by StarkEx user's wallets in order to generate and sign on orders.
### Usage:
1. Run the repo's tests by running the command:\
`docker build .`
2. Verify that the same hash is used by StarkEx on Mainnet by running the script
*src/services/extract_cairo_hash.py* in the following way:\
`./src/services/exchange/extract_cairo_hash.py --main_address --node_endpoint `
You can find the relevant addresses and current versions for the
different StarkEx deployments [here](https://docs.starkware.co/starkex/deployments-addresses.html).
When comparing the hash, please make sure you checkout the tag that corresponds to the
deployed version from this repo.