Skip to content

Commit

Permalink
Fix token-swap (solana-labs#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackcmay authored Jul 1, 2020
1 parent 76a61d7 commit b292d4c
Show file tree
Hide file tree
Showing 14 changed files with 704 additions and 155 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ install:
jobs:
include:
- stage: "Test Programs"
script: ./ci/memo.sh
script: ./ci/token.sh
script: ./ci/token.sh
- script: ./ci/memo.sh
21 changes: 21 additions & 0 deletions ci/token-swap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -e

(
cd "$(dirname "$0")/.."

./do.sh update
./do.sh build token-swap
./do.sh doc token-swap
./do.sh test token-swap
cc token/inc/token-swap.h -o token-swap/target/token-swap.gch
)

(
cd "$(dirname "$0")/../token/js"

npm install
npm run cluster:devnet
npm run start
)
201 changes: 199 additions & 2 deletions token-swap/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion token-swap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ edition = "2018"
[dependencies]
num-derive = "0.2"
num-traits = "0.2"
remove_dir_all = "=0.5.0"
solana-sdk = { version = "=1.2.0", default-features = false, features=["program"] }
solana-sdk-bpf-test = { path = "../bin/bpf-sdk/rust/test", default-features = false }
spl-token = { path = "../token", default-features = false }
spl-token = { path = "../token" }
thiserror = "1.0"

[dev-dependencies]
rand = { version = "0.7.0"}

[build-dependencies]
cbindgen = "=0.14.2"

[lib]
name = "spl_token_swap"
crate-type = ["cdylib", "lib"]
10 changes: 10 additions & 0 deletions token-swap/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extern crate cbindgen;

use std::env;

fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
cbindgen::generate(&crate_dir)
.unwrap()
.write_to_file("inc/token-swap.h");
}
15 changes: 15 additions & 0 deletions token-swap/cbindgen.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language = "C"
header = "/* Autogenerated SPL Token-Swap program C Bindings */"
pragma_once = true
cpp_compat = true
line_length = 80
tab_width = 4
style = "both"

[export]
prefix = "TokenSwap_"
include = ["SwapInstruction", "State"]

[parse]
parse_deps = true
include = ["solana-sdk"]
Loading

0 comments on commit b292d4c

Please sign in to comment.