5 个不稳定版本

0.5.4 2022年1月25日
0.5.0 2021年12月7日
0.4.0 2021年8月3日
0.3.1 2021年5月31日
0.3.0 2021年4月30日

#1#serum

Download history 732/week @ 2024-04-14 656/week @ 2024-04-21 623/week @ 2024-04-28 518/week @ 2024-05-05 1061/week @ 2024-05-12 765/week @ 2024-05-19 1234/week @ 2024-05-26 891/week @ 2024-06-02 430/week @ 2024-06-09 466/week @ 2024-06-16 643/week @ 2024-06-23 523/week @ 2024-06-30 318/week @ 2024-07-07 624/week @ 2024-07-14 639/week @ 2024-07-21 648/week @ 2024-07-28

2,325 每月下载量
用于 25 个 crate (14 个直接使用)

Apache-2.0 协议

250KB
6.5K SLoC

serum-dex

部署 DEX

使用仓库顶级目录下的 do.sh 脚本,

运行单元测试

./do.sh test dex

编译 DEX 二进制文件

./do.sh build dex

将 DEX 部署到配置的 Solana 集群

DEX_PROGRAM_ID="$(solana deploy dex/target/bpfel-unknown-unknown/release/serum_dex.so | jq .programId -r)"

运行模糊测试

cd dex
cargo install cargo-fuzz
cargo fuzz run multiple_orders

使用 crank 客户端工具

cd crank

# read the autogenerated help text
cargo run -- help

# supported options are localnet, mainnet, testnet, devnet
CLUSTER=localnet

# verify that you have SOL balances for gas
KEYPAIR=~/.config/solana/id.json
solana balance -k $KEYPAIR

# run the demo script (this is mostly a smoke test)
cargo run -- $CLUSTER whole-shebang $KEYPAIR $DEX_PROGRAM_ID

# list a market with the default tick size and minimum quantity.
# if both assets have 6 decimals, this will be a quantity of 1 and a tick size of 0.01
COIN_MINT="..."
PRICE_CURRENCY_MINT="..."
cargo run -- $CLUSTER list-market $KEYPAIR $DEX_PROGRAM_ID --coin-mint $COIN_MINT --pc-mint $PRICE_CURRENCY_MINT

首次设置

# Building the dex
sudo apt-get install -y pkg-config build-essential python3-pip jq
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
curl -sSf https://raw.githubusercontent.com/solana-labs/solana/v1.4.14/install/solana-install-init.sh | sh -s - v1.4.14
export PATH="/home/ubuntu/.local/share/solana/install/active_release/bin:$PATH"

git clone https://github.com/project-serum/serum-dex
cd serum-dex
./do.sh update
./do.sh build dex

# run a solana cluster. in a new shell:
git clone https://github.com/solana-labs/solana --branch v1.4.14
cd solana
sudo apt-get install -y libssl-dev libudev-dev zlib1g-dev llvm clang
cargo build --release
export RUST_LOG=solana_runtime::system_instruction_processor=trace,solana_runtime::message_processor=info,solana_bpf_loader=debug,solana_rbpf=debug
NDEBUG=1 ./run.sh

# Deploy the dex to our cluster (in the old shell)
solana config set -u http://127.0.0.1:8899
solana-keygen new
solana airdrop 100
DEX_PROGRAM_ID="$(solana deploy dex/target/bpfel-unknown-unknown/release/serum_dex.so | jq .programId -r)"
CLUSTER=localnet
KEYPAIR=~/.config/solana/id.json

# run the demo script (this is mostly a smoke test)
cargo run -- $CLUSTER whole-shebang $KEYPAIR $DEX_PROGRAM_ID

依赖项

~18–26MB
~451K SLoC