MCPcopy Index your code
hub / github.com/Bonfida/dex-v4

github.com/Bonfida/dex-v4 @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
348 symbols 739 edges 56 files 85 documented · 24%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Serum dex

Orderbook-based on-chain SPL token swap market

This program is intended for use to build a decentralized exchange (DEX) specialized on SPL token swaps.

Repository

  • program contains the code for the on-chain program
  • js contains the code for the JS/wasm bindings for the on-chain program, an up to date npm package is available here
  • cranker contains the code for the associated cranking runtime

Documentation

Detailed API documentation is available for the program by running cargo doc --open in the program directory.

FAQ

Testing on devnet

Market information

  • Market Address: Gdaxn4WkV2ZyNcMYsUWiAnmjy4YqSka4woy8ggazh4ba
  • Base Mint (6 decimals): 72m4rktxyKqWQxTnXz1rpjJ6v9RPaa6mW5Qb2aizQ8Zq
  • Quote Mint (4 decimals): Cetq9LiKkhvQuyHRjbk1FSbbsWSCCEVvPVQ4BHCHDF3t

Faucets (airdrop test tokens):

  • (Add the Test USDC Mint to your wallet)
  • Go to: https://www.spl-token-ui.com/#/
  • Select devnet in the top right
  • In the Airdrop dropdown menu select Token Faucets
  • Select Token Airdrop
  • Enter your address in Token destination address
  • Enter one of the addresses below in Faucet address
  • Enter the amount you want to receive (with decimals, max is 1k in ui amount) and click Airdrop Tokens

  • Base faucet: DiptCWpttbGc5y4Pb2LhxWLnkbmZUUzmEoeca55aaJfy

  • Quote faucet: 2ewphvAYknMVe55d9KgZMEw1vKTFgFUDTdyMGNcyGD1c

Extension points exported contracts — how you extend this code

Account (Interface)
(no doc)
js/src/test.ts
UiPrice (Interface)
(no doc)
js/src/orderbook.ts
AccountKey (Interface)
(no doc)
js/src/raw_instructions.ts
OrderParams (Interface)
(no doc)
js/src/types.ts
Order (Interface)
(no doc)
js/src/types.ts

Core symbols most depended-on inside this repo

random
called by 29
js/tests/utils/random.ts
check_account_key
called by 29
program/src/utils.rs
retrieve
called by 28
js/src/state.ts
check_account_owner
called by 22
program/src/utils.rs
placeOrder
called by 19
js/src/bindings.ts
from
called by 14
program/src/error.rs
load
called by 12
js/src/market.ts
computeFp32Price
called by 12
js/src/utils.ts

Shape

Method 160
Function 99
Class 67
Enum 15
Interface 7

Languages

TypeScript59%
Rust41%

Modules by API surface

js/src/raw_instructions.ts56 symbols
js/src/market.ts53 symbols
program/src/state.rs36 symbols
js/src/openOrders.ts17 symbols
js/src/state.ts16 symbols
program/src/instruction_auto.rs12 symbols
js/src/orderbook.ts11 symbols
js/src/bindings.ts10 symbols
program/src/utils.rs9 symbols
program/tests/common/performance_test_utils.rs8 symbols
program/src/processor/new_order.rs7 symbols
js/src/types.ts7 symbols

For agents

$ claude mcp add dex-v4 \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact