11 releases

0.5.1 Jul 5, 2022
0.5.0 Jul 5, 2022
0.4.9 Jun 12, 2022
0.4.8 May 23, 2022
0.4.5 Apr 28, 2022

#3 in #instantly

Apache-2.0

30KB
487 lines

Swap

Crates.io Docs.rs

Swap provides a convenient API to the Serum DEX for performing instantly settled token swaps directly on the order book.

Developing

This program requires building the Serum DEX from source, which is done using git submodules.

Install Submodules

Pull the source

git submodule init
git submodule update

Build the DEX

Build it

cd deps/serum-dex/dex/ && cargo build-bpf && cd ../../../

Build

Anchor is used for developoment, and it's recommended workflow is used here. To get started, see the guide.

anchor build --verifiable

The --verifiable flag should be used before deploying so that your build artifacts can be deterministically generated with docker.

Test

anchor test

Verify

To verify the program deployed on Solana matches your local source code, install docker, cd programs/swap, and run

anchor verify <program-id | write-buffer>

A list of build artifacts can be found under releases.

Run the Test

Run the test

anchor test

Dependencies

~26–35MB
~589K SLoC