protocol-v2
On-chain perpetuals dex with multiple liquidity mechanisms
File Explorer
Download Latest Version (.zip)- audit.toml
- devcontainer.json
- Dockerfile
- solana-install-init.sh
- action.yaml
- audit.yml
- main.yml
- security.yml
- pre-commit
- README.md
- .gitignore
- cli.ts
- package.json
- README.md
- tsconfig.json
- build-devnet.sh
- deploy-devnet.sh
- verified-build.sh
- pyth_lazer_storage.json
- usdc.json
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- amm_jit_tests.rs
- fuel_tests.rs
- tests.rs
- delisting.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- amm.rs
- funding.rs
- insurance.rs
- isolated_position.rs
- liquidation.rs
- lp.rs
- mod.rs
- orders.rs
- pda.rs
- pnl.rs
- position.rs
- repeg.rs
- revenue_share.rs
- spot_balance.rs
- spot_position.rs
- token.rs
- admin.rs
- constraints.rs
- if_staker.rs
- keeper.rs
- lp_admin.rs
- lp_pool.rs
- mod.rs
- optional_accounts.rs
- pyth_lazer_oracle.rs
- user.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- amm.rs
- amm_jit.rs
- amm_spread.rs
- auction.rs
- bankruptcy.rs
- bn.rs
- casting.rs
- ceil_div.rs
- constants.rs
- cp_curve.rs
- fees.rs
- floor_div.rs
- fuel.rs
- fulfillment.rs
- funding.rs
- helpers.rs
- insurance.rs
- liquidation.rs
- lp_pool.rs
- margin.rs
- matching.rs
- mod.rs
- oracle.rs
- orders.rs
- pnl.rs
- position.rs
- quote_asset.rs
- repeg.rs
- safe_math.rs
- safe_unwrap.rs
- serum.rs
- spot_balance.rs
- spot_swap.rs
- spot_withdraw.rs
- stats.rs
- tests.rs
- drift.rs
- mod.rs
- openbook_v2.rs
- phoenix.rs
- serum.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- tests.rs
- isolated_transfer_tests.rs
- tests.rs
- amm_cache.rs
- constituent_map.rs
- events.rs
- fill_mode.rs
- fulfillment.rs
- high_leverage_mode_config.rs
- if_rebalance_config.rs
- insurance_fund_stake.rs
- liquidation_mode.rs
- load_ref.rs
- lp_pool.rs
- margin_calculation.rs
- mod.rs
- oracle.rs
- oracle_map.rs
- order_params.rs
- paused_operations.rs
- perp_market.rs
- perp_market_map.rs
- protected_maker_mode_config.rs
- pyth_lazer_oracle.rs
- revenue_share.rs
- revenue_share_map.rs
- scale_order_params.rs
- settle_pnl_mode.rs
- signed_msg_user.rs
- spot_fulfillment_params.rs
- spot_market.rs
- spot_market_map.rs
- state.rs
- traits.rs
- user.rs
- user_map.rs
- zero_copy.rs
- tests.rs
- test.rs
- tests.rs
- fee_structure.rs
- margin.rs
- mod.rs
- order.rs
- perp_market.rs
- position.rs
- sig_verification.rs
- spot_market.rs
- user.rs
- whitelist.rs
- error.rs
- ids.rs
- lib.rs
- macros.rs
- signer.rs
- test_utils.rs
- Cargo.toml
- Xargo.toml
- account.rs
- constants.rs
- context.rs
- lib.rs
- Cargo.toml
- README.md
- lib.rs
- pc.rs
- Cargo.toml
- Xargo.toml
- api.rs
- lib.rs
- message.rs
- payload.rs
- price.rs
- rate.rs
- serde_price_as_i64.rs
- serde_str.rs
- signature.rs
- storage.rs
- time.rs
- Cargo.toml
- lib.rs
- Cargo.toml
- lib.rs
- Cargo.toml
- lib.rs
- Cargo.toml
- Xargo.toml
- deposit-isolated-positions.ts
- find-flagged-users.ts
- grpc-client-test-comparison.ts
- grpc-multiuser-client-test-comparison.ts
- postbuild.js
- single-grpc-client-test.ts
- updateVersion.js
- withdraw-isolated-positions.ts
- basicUserAccountSubscriber.ts
- basicUserStatsAccountSubscriber.ts
- bulkAccountLoader.ts
- bulkUserStatsSubscription.ts
- bulkUserSubscription.ts
- customizedCadenceBulkAccountLoader.ts
- fetch.ts
- grpcAccountSubscriber.ts
- grpcDriftClientAccountSubscriber.ts
- grpcDriftClientAccountSubscriberV2.ts
- grpcInsuranceFundStakeAccountSubscriber.ts
- grpcMultiAccountSubscriber.ts
- grpcMultiUserAccountSubscriber.ts
- grpcProgramAccountSubscriber.ts
- grpcUserAccountSubscriber.ts
- grpcUserStatsAccountSubscriber.ts
- laserProgramAccountSubscriber.ts
- oneShotUserAccountSubscriber.ts
- oneShotUserStatsAccountSubscriber.ts
- pollingDriftClientAccountSubscriber.ts
- pollingHighLeverageModeConfigAccountSubscriber.ts
- pollingInsuranceFundStakeAccountSubscriber.ts
- pollingOracleAccountSubscriber.ts
- pollingTokenAccountSubscriber.ts
- pollingUserAccountSubscriber.ts
- pollingUserStatsAccountSubscriber.ts
- README_WebSocketAccountSubscriberV2.md
- README_WebSocketProgramAccountSubscriberV2.md
- testBulkAccountLoader.ts
- types.ts
- utils.ts
- webSocketAccountSubscriber.ts
- webSocketAccountSubscriberV2.ts
- webSocketDriftClientAccountSubscriber.ts
- webSocketDriftClientAccountSubscriberV2.ts
- webSocketHighLeverageModeConfigAccountSubscriber.ts
- webSocketInsuranceFundStakeAccountSubscriber.ts
- webSocketProgramAccountsSubscriberV2.ts
- webSocketProgramAccountSubscriber.ts
- webSocketProgramAccountSubscriberV2.ts
- websocketProgramUserAccountSubscriber.ts
- webSocketUserAccountSubscriber.ts
- webSocketUserStatsAccountSubsriber.ts
- marketAddresses.ts
- pda.ts
- assert.ts
- auctionSubscriber.ts
- auctionSubscriberGrpc.ts
- index.ts
- types.ts
- bankrunConnection.ts
- BlockhashSubscriber.ts
- index.ts
- types.ts
- clockSubscriber.ts
- index.ts
- insuranceFund.ts
- numericConstants.ts
- perpMarkets.ts
- spotMarkets.ts
- txConstants.ts
- constituentMap.ts
- pollingConstituentAccountSubscriber.ts
- webSocketConstituentAccountSubscriber.ts
- customCoder.ts
- phoenix.ts
- user.ts
- DLOB.ts
- DLOBNode.ts
- DLOBSubscriber.ts
- NodeList.ts
- orderBookLevels.ts
- types.ts
- eventList.ts
- eventsServerLogProvider.ts
- eventSubscriber.ts
- fetchLogs.ts
- parse.ts
- pollingLogProvider.ts
- sort.ts
- txEventCache.ts
- types.ts
- webSocketLogProvider.ts
- bigNum.ts
- oracleClient.ts
- drift.json
- openbook.json
- pyth.json
- pyth_solana_receiver.json
- switchboard.json
- switchboard_on_demand_30.json
- token_faucet.json
- indicativeQuotesSender.ts
- grpc.browser.ts
- grpc.node.ts
- grpc.ts
- README.md
- jupiterClient.ts
- README.md
- idl.json
- index.ts
- types.ts
- amm.ts
- auction.ts
- bankruptcy.ts
- builder.ts
- conversion.ts
- exchangeStatus.ts
- fuel.ts
- funding.ts
- insurance.ts
- liquidation.ts
- margin.ts
- market.ts
- oracles.ts
- orders.ts
- position.ts
- protectedMakerParams.ts
- repeg.ts
- spotBalance.ts
- spotMarket.ts
- spotPosition.ts
- state.ts
- superStake.ts
- tiers.ts
- trade.ts
- userStatus.ts
- utils.ts
- openbookV2FulfillmentConfigMap.ts
- openbookV2Subscriber.ts
- oracleClientCache.ts
- oracleId.ts
- prelaunchOracleClient.ts
- pythClient.ts
- pythLazerClient.ts
- pythPullClient.ts
- quoteAssetOracleClient.ts
- strictOraclePrice.ts
- switchboardClient.ts
- switchboardOnDemandClient.ts
- types.ts
- utils.ts
- grpcSubscription.ts
- index.ts
- OrderSubscriber.ts
- PollingSubscription.ts
- types.ts
- WebsocketSubscription.ts
- phoenixFulfillmentConfigMap.ts
- phoenixSubscriber.ts
- averageOverSlotsStrategy.ts
- averageStrategy.ts
- driftPriorityFeeMethod.ts
- ewmaStrategy.ts
- heliusPriorityFeeMethod.ts
- index.ts
- maxOverSlotsStrategy.ts
- maxStrategy.ts
- priorityFeeSubscriber.ts
- priorityFeeSubscriberMap.ts
- solanaPriorityFeeMethod.ts
- types.ts
- constants.ts
- index.ts
- pythLazerSubscriber.ts
- types.ts
- utils.ts
- serumFulfillmentConfigMap.ts
- serumSubscriber.ts
- types.ts
- SlothashSubscriber.ts
- SlotSubscriber.ts
- UnifiedSwapClient.ts
- grpcSignedMsgUserAccountSubscriber.ts
- index.ts
- signedMsgUserAccountSubscriber.ts
- swiftOrderSubscriber.ts
- titanClient.ts
- index.ts
- baseBlockhashFetcher.ts
- cachedBlockhashFetcher.ts
- types.ts
- baseTxSender.ts
- fastSingleTxSender.ts
- forwardOnlyTxSender.ts
- priorityFeeCalculator.ts
- reportTransactionError.ts
- retryTxSender.ts
- txHandler.ts
- txParamProcessor.ts
- types.ts
- utils.ts
- whileValidTxSender.ts
- grpcSubscription.ts
- PollingSubscription.ts
- referrerMap.ts
- revenueShareEscrowMap.ts
- userMap.ts
- userMapConfig.ts
- userStatsMap.ts
- WebsocketSubscription.ts
- chainClock.ts
- computeUnits.ts
- digest.ts
- ed25519Utils.ts
- promiseTimeout.ts
- pythOracleUtils.ts
- tps.ts
- TransactionConfirmationManager.ts
- adminClient.ts
- config.ts
- driftClient.ts
- driftClientConfig.ts
- index.ts
- keypair.ts
- marginCalculation.ts
- memcmp.ts
- orderParams.ts
- testClient.ts
- tokenFaucet.ts
- types.ts
- user.ts
- userConfig.ts
- userName.ts
- userStats.ts
- userStatsConfig.ts
- wallet.ts
- customizedCadenceBulkAccountLoader.test.ts
- test.ts
- test.ts
- test.ts
- verifyConstants.ts
- phoenix.ts
- test.ts
- userAccountBufferStrings.ts
- helpers.ts
- test.ts
- parseLogsForCuUsage.ts
- test.ts
- test.ts
- openbook.ts
- cachedBlockhashFetcher.test.ts
- priorityFeeCalculator.ts
- priorityFeeStrategy.ts
- TransactionConfirmationManager.test.ts
- getMarginCalculation.ts
- helpers.ts
- liquidations.ts
- marginCalculations.test.ts
- test.ts
- .gitignore
- build-browser.js
- bun.lock
- esbuild-shims.js
- get_events.ts
- package.json
- README.md
- tsconfig.browser.json
- tsconfig.json
- VERSION
- yarn.lock
- run-anchor-local-validator-tests.sh
- run-anchor-tests.sh
- run-til-failure.sh
- run-ts-mocha
- single-anchor-test.sh
- openbook.so
- phoenix_dex.so
- pyth_solana_receiver.so
- serum_dex.so
- spl_transfer_hook_example.so
- token_2022.so
- token_2022_test.so
- admin.ts
- adminDeposit.ts
- adminWithdrawFromInsuranceFundVault.ts
- assetTier.ts
- builderCodes.ts
- cancelAllOrders.ts
- cappedSymFunding.ts
- curve.ts
- decodeUser.ts
- deleteInitializedSpotMarket.ts
- delistMarket.ts
- delistMarketLiq.ts
- depositIntoSpotMarketVault.ts
- driftClient.ts
- fillSpot.ts
- forceUserDelete.ts
- fuel.ts
- fuelSweep.ts
- govStakeDevnet.ts
- highLeverageMode.ts
- ifRebalance.ts
- imbalancePerpPnl.ts
- insuranceFundStake.ts
- isolatedPositionDriftClient.ts
- isolatedPositionLiquidatePerp.ts
- isolatedPositionLiquidatePerpwithFill.ts
- isolatedTransferMarginChecks.ts
- ksolver.ts
- liquidateBorrowForPerpPnl.ts
- liquidatePerp.ts
- liquidatePerpPnlForDeposit.ts
- liquidatePerpWithFill.ts
- liquidateSpot.ts
- liquidateSpotSocialLoss.ts
- liquidateSpotWithSwap.ts
- liquidityBook.ts
- lpPool.ts
- lpPoolCUs.ts
- lpPoolSwap.ts
- marketOrder.ts
- marketOrderBaseAssetAmount.ts
- maxDeposit.ts
- maxLeverageOrderParams.ts
- modifyOrder.ts
- multipleMakerOrders.ts
- multipleSpotMakerOrders.ts
- openbookHelpers.ts
- openbookTest.ts
- oracleDiffSources.ts
- oracleFillPriceGuardrails.ts
- oracleOffsetOrders.ts
- order.ts
- orderMarginChecks.ts
- ordersWithSpread.ts
- overwritePerpAccounts.ts
- pauseDepositWithdraw.ts
- pauseExchange.ts
- perpMarketConfig.ts
- phoenixTest.ts
- phoenixTestAccountData.ts
- placeAndMakePerp.ts
- placeAndMakeSignedMsg.ts
- placeAndMakeSignedMsgBankrun.ts
- placeAndMakeSpotOrder.ts
- postOnly.ts
- postOnlyAmmFulfillment.ts
- prelisting.ts
- prepegMarketOrderBaseAssetAmount.ts
- pyth.ts
- pythLazer.ts
- pythLazerBankrun.ts
- pythLazerData.ts
- pythPullOracleData.ts
- referencePriceOffset.ts
- referrer.ts
- repegAndSpread.ts
- resizeSwiftUserOrderIds.ts
- roundInFavorBaseAsset.ts
- scaleOrders.ts
- serumHelper.ts
- serumTest.ts
- settlePNLInvariant.ts
- signedMsgWsDelegates.ts
- splTransferHookClient.ts
- spotDepositWithdraw.ts
- spotDepositWithdraw22.ts
- spotDepositWithdraw22ScaledUI.ts
- spotDepositWithdraw22TransferHooks.ts
- spotMarketPoolIds.ts
- spotSwap.ts
- spotSwap22.ts
- spotWithdrawUtil100.ts
- stopLimits.ts
- subaccounts.ts
- surgePricing.ts
- switchboardOnDemand.ts
- switchboardOnDemandData.ts
- switchboardTxCus.ts
- switchOracle.ts
- testHelpers.ts
- testHelpersLocalValidator.ts
- tokenFaucet.ts
- transferPerpPosition.ts
- transferPools.ts
- triggerOrders.ts
- triggerSpotOrder.ts
- updateAMM.ts
- updateK.ts
- userAccount.ts
- userDelegate.ts
- userOrderId.ts
- whitelist.ts
- .coderabbit.yaml
- .eslintrc.js
- .gitignore
- .gitmodules
- .prettierignore
- .prettierrc.js
- .verified-build.json
- Anchor.toml
- AUDIT.md
- bun.lock
- Cargo.lock
- Cargo.toml
- CHANGELOG.md
- codecov.yml
- LICENSE
- package.json
- README.md
- SECURITY.md
- tsconfig.json
- typedoc.json
- yarn.lock
# Installation Guide
1. Get the code
git clone https://github.com/velocity-exchange/protocol-v2
Downloads the entire project code from GitHub to your computer.
cd protocol-v2
Moves into the project folder you just downloaded.
2. Node.js
Easy RecommendedPrerequisites
yarn
Downloads and installs the libraries listed in package.json.
cd sdk/ && yarn && yarn build && cd ..
Moves into the project folder you just downloaded.
After running the command, open the address shown in the terminal (usually something like http://localhost:3000) in your browser.
Pulled directly from this repo's README.
3. Rust
MediumPrerequisites
- Git Needed to download the project code from GitHub.
- Rust (rustup) Installing via rustup also installs cargo.
cargo test
Type this command into your terminal and run it.
If cargo build finishes without errors, it worked. The executable is created under target/.
Pulled directly from this repo's README.
// repository documentation
Was this content helpful?
(0 ratings)
