-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples: Swap on the serum orderbook (#224)
- Loading branch information
1 parent
af735a4
commit a1464d1
Showing
20 changed files
with
1,679 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "examples/swap/deps/serum-dex"] | ||
path = examples/swap/deps/serum-dex | ||
url = https://github.com/project-serum/serum-dex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,6 @@ members = [ | |
"lang/syn", | ||
"spl", | ||
] | ||
exclude = [ | ||
"examples/swap/deps/serum-dex" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
cluster = "localnet" | ||
wallet = "~/.config/solana/id.json" | ||
|
||
[[test.genesis]] | ||
address = "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin" | ||
program = "./deps/serum-dex/dex/target/deploy/serum_dex.so" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[workspace] | ||
members = [ | ||
"programs/*" | ||
] | ||
exclude = [ | ||
"deps/serum-dex" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Swap | ||
|
||
An example swap program that provides a convenient API to the Serum orderbook | ||
for performing instantly settled token swaps. | ||
|
||
## Usage | ||
|
||
This example 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 ../../../ | ||
``` | ||
|
||
### Run the Test | ||
|
||
Run the test | ||
|
||
``` | ||
anchor test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Migrations are an early feature. Currently, they're nothing more than this | ||
// single deploy script that's invoked from the CLI, injecting a provider | ||
// configured from the workspace's Anchor.toml. | ||
|
||
const anchor = require("@project-serum/anchor"); | ||
|
||
module.exports = async function (provider) { | ||
// Configure client to use the provider. | ||
anchor.setProvider(provider); | ||
|
||
// Add your deploy script here. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "swap" | ||
version = "0.1.0" | ||
description = "Created with Anchor" | ||
edition = "2018" | ||
|
||
[lib] | ||
crate-type = ["cdylib", "lib"] | ||
name = "swap" | ||
|
||
[features] | ||
no-entrypoint = [] | ||
no-idl = [] | ||
cpi = ["no-entrypoint"] | ||
default = [] | ||
|
||
[dependencies] | ||
anchor-lang = { path = "../../../../lang" } | ||
anchor-spl = { path = "../../../../spl" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[target.bpfel-unknown-unknown.dependencies.std] | ||
features = [] |
Oops, something went wrong.