Skip to content
36 changes: 36 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,39 @@ version = "0.1.0"
edition = "2021"

[dependencies]
anyhow = "1.0.55"
serde = { version = "1.0.136", features = ["derive"] }
async-trait = "0.1.52"
warp = { version = "0.3.1", features = ["websocket"] }
tokio = { version = "1.0", features = ["full"] }
tokio-stream = "0.1.1"
futures-util = { version = "0.3", default-features = false, features = [
"sink",
] }
jrpc = "0.4.1"
serde_json = "1.0.79"
tracing = "0.1.31"
chrono = "0.4.19"
parking_lot = "0.12.1"
pyth-sdk = "0.6.0"
pyth-sdk-solana = "0.6.0"
solana-client = "1.10.24"
solana-sdk = "1.10.24"
bincode = "1.3.3"
slog = "2.7.0"
schnorrkel = "0.10.1"
slog-term = "2.9.0"
rand = "0.8.5"
slog-async = "2.7.0"
config = "0.13.2"
thiserror = "1.0.32"

[dev-dependencies]
tokio-util = { version = "0.7.0", features = ["full"] }
soketto = "0.7.1"
mockall = "0.11.0"
portpicker = "0.1.1"
rand = "0.8.5"
tokio-retry = "0.3.0"
slog-extlog = "8.0.0"
iobuffer = "0.2.0"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.58.1-slim-bullseye
FROM rust:1.61.0-slim-bullseye

ADD . /agent
WORKDIR /agent
Expand Down
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#[macro_use]
extern crate slog;
extern crate slog_term;

pub mod publisher;
1 change: 1 addition & 0 deletions src/publisher.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod pythd;
2 changes: 2 additions & 0 deletions src/publisher/pythd.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod adapter;
pub mod api;
39 changes: 39 additions & 0 deletions src/publisher/pythd/adapter.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
use super::api::{
Conf, NotifyPrice, NotifyPriceSched, Price, ProductAccount, ProductAccountMetadata, Pubkey,
SubscriptionID,
};
use anyhow::Result;
use tokio::sync::{mpsc, oneshot};

// Adapter is the adapter between the pythd websocket API, and the stores.
// It is responsible for implementing the business logic for responding to
// the pythd websocket API calls.
#[derive(Debug)]
pub enum Message {
GetProductList {
result_tx: oneshot::Sender<Result<Vec<ProductAccountMetadata>>>,
},
GetProduct {
account: Pubkey,
result_tx: oneshot::Sender<Result<ProductAccount>>,
},
GetAllProducts {
result_tx: oneshot::Sender<Result<Vec<ProductAccount>>>,
},
SubscribePrice {
account: Pubkey,
notify_price_tx: mpsc::Sender<NotifyPrice>,
result_tx: oneshot::Sender<Result<SubscriptionID>>,
},
SubscribePriceSched {
account: Pubkey,
notify_price_sched_tx: mpsc::Sender<NotifyPriceSched>,
result_tx: oneshot::Sender<Result<SubscriptionID>>,
},
UpdatePrice {
account: Pubkey,
price: Price,
conf: Conf,
status: String,
},
}
Loading