-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
1,028 additions
and
332 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,35 @@ | ||
# IDE & Editor Directories | ||
.vscode/ | ||
.idea/ | ||
Reference/ | ||
|
||
# Rust-specific Directories | ||
/target/ | ||
**/target/ | ||
/build/ | ||
**/build/ | ||
|
||
# Environment & Config Files | ||
.envrc | ||
buf.gen.yaml | ||
*.dev.yaml | ||
**/buf.gen.yaml | ||
/configs/substream/*.index.yaml | ||
|
||
# Rust-specific Files | ||
Cargo.lock | ||
|
||
# Substreams Files | ||
*/pb/ | ||
**/data/ | ||
**/*.spkg | ||
*.spkg | ||
/sink | ||
/debug.log | ||
/replay.log | ||
|
||
# Miscellaneous | ||
*~ | ||
/env/ | ||
/node_modules/ | ||
deploy.sh |
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,18 @@ | ||
[workspace] | ||
resolver = "2" | ||
members = ["derive_deserialize", "orca-whirlpool"] | ||
exclude = [] | ||
|
||
[workspace.dependencies] | ||
substreams = "^0.5.21" | ||
substreams-solana = { git = "https://github.com/streamingfast/substreams-solana", branch = "master" } | ||
substreams-entity-change = "1.3.2" | ||
substreams-solana-program-instructions = "0.1" | ||
|
||
[build] | ||
target = "wasm32-unknown-unknown" | ||
|
||
[profile.release] | ||
lto = true | ||
opt-level = 's' | ||
strip = "debuginfo" |
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,20 @@ | ||
Copyright (c) 2018-2022 Messari Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,13 @@ | ||
[package] | ||
name = "derive_deserialize" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
proc-macro = true | ||
|
||
[dependencies] | ||
syn = { version = "2.0", features = ["full"] } | ||
quote = "1.0" | ||
proc-macro2 = "1.0" | ||
substreams-solana = { workspace = true } |
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,45 @@ | ||
extern crate proc_macro; | ||
use proc_macro::TokenStream; | ||
use quote::quote; | ||
use syn::{parse_macro_input, DeriveInput, Data, Fields}; | ||
|
||
#[proc_macro_derive(AccountsDeserialize)] | ||
pub fn accounts_deserialize_derive(input: TokenStream) -> TokenStream { | ||
let input = parse_macro_input!(input as DeriveInput); | ||
let name = &input.ident; | ||
|
||
let expanded = match input.data { | ||
Data::Struct(data_struct) => match data_struct.fields { | ||
Fields::Named(fields_named) => { | ||
let field_names = fields_named.named.iter().map(|f| &f.ident); | ||
let field_indices = (0..fields_named.named.len()).map(syn::Index::from); | ||
|
||
quote! { | ||
impl<'a> AccountsDeserialize<'a> for #name<'a> { | ||
fn deserialize( | ||
confirmed_txn: &'a ConfirmedTransaction, | ||
compiled_instr: &'a CompiledInstruction, | ||
) -> Option<Self> | ||
where | ||
Self: Sized, | ||
{ | ||
let instr_accounts: Vec<&Vec<u8>> = compiled_instr | ||
.accounts | ||
.iter() | ||
.map(|&idx| confirmed_txn.account_at(idx as u8).0) | ||
.collect(); | ||
|
||
Some(Self { | ||
#(#field_names: Address(instr_accounts.get(#field_indices)?)),* | ||
}) | ||
} | ||
} | ||
} | ||
} | ||
_ => panic!("AccountsDeserialize can only be derived for structs with named fields"), | ||
}, | ||
_ => panic!("AccountsDeserialize can only be derived for structs"), | ||
}; | ||
|
||
TokenStream::from(expanded) | ||
} |
This file was deleted.
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 |
---|---|---|
@@ -1,30 +1,20 @@ | ||
[package] | ||
name = "orca-whirlpool-solana-substreams" | ||
name = "orca-whirlpool" | ||
version = "1.0.0" | ||
edition = "2021" | ||
license = "MIT" | ||
description = "Orca Whirlpool Substream - by Messari" | ||
|
||
[lib] | ||
name = "substreams" | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
sha2 = "0.10.8" | ||
substreams = "^0.5.21" | ||
borsh = { version = "0.10.3" } | ||
substreams-solana = { git = "https://github.com/streamingfast/substreams-solana", branch = "master" } | ||
substreams-solana-program-instructions = "0.1" | ||
substreams-entity-change = "1.3.2" | ||
bytes = "1.1.0" | ||
prost = "0.11" | ||
num-bigint = "0.4" | ||
bs58 = "0.5.0" | ||
chrono = { version = "0.4", features = [ "std" ], default-features = false } | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_json = "1.0" | ||
regex = "1.10.2" | ||
hex = "0.4.0" | ||
|
||
[profile.release] | ||
lto = true | ||
opt-level = 's' | ||
strip = "debuginfo" | ||
borsh = { version = "1.5.0", features = ["derive"] } | ||
substreams = { workspace = true } | ||
substreams-solana = { workspace = true } | ||
substreams-entity-change = { workspace = true } | ||
substreams-solana-program-instructions = { workspace = true } | ||
derive_deserialize = { path = "../derive_deserialize" } |
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
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
Oops, something went wrong.