-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Deepbook Indexer #19023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Deepbook Indexer #19023
Changes from 23 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
c1577ec
Add Deepbook Indexer
Bridgerz 572b20b
Add Deepbook Indexer
Bridgerz bc9a430
Update Cargo.lock
Bridgerz c65a876
upgrade diesel
Bridgerz 83e0577
Update schema.rs
Bridgerz 2a0faad
PR fixes
Bridgerz 642a421
Add Deepbook Indexer
Bridgerz 70b7457
Update Cargo.lock
Bridgerz 763129d
new events
0xaslan 6721ae5
Merge branch 'deepbook-indexer' of https://github.com/MystenLabs/sui …
0xaslan 9dbad6e
id as primary key
0xaslan e63751c
cargo
0xaslan bf4e8dd
Merge branch 'main' into deepbook-indexer
0xaslan b8ce672
clippy
0xaslan c4c501a
Merge branch 'deepbook-indexer' of https://github.com/MystenLabs/sui …
0xaslan db5288b
fixes
0xaslan 63c6628
Merge branch 'main' of https://github.com/MystenLabs/sui into deepboo…
0xaslan 653dfb8
Merge branch 'main' of https://github.com/MystenLabs/sui into deepboo…
0xaslan 108833e
cargolock
0xaslan ce8f22c
latest indexer changes
0xaslan d92fd89
Merge branch 'main' of https://github.com/MystenLabs/sui into deepboo…
0xaslan 42aec12
pull latest indexer changes
0xaslan 2a37333
Update Cargo.toml
Bridgerz 8e87606
Update cargo.lock
Bridgerz 31805a8
Update Cargo.lock
Bridgerz 69600fb
Update events.rs
Bridgerz 72c92da
Merge branch 'main' into db-indexer-squashed
longbowlu 91849b2
cargo.lock
longbowlu 9e648f8
remove unused files
longbowlu e4e295f
diesel stuff
longbowlu d9e898f
make it compile
longbowlu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,43 @@ | ||
[package] | ||
name = "sui-deepbook-indexer" | ||
version = "0.1.0" | ||
authors = ["Mysten Labs <build@mystenlabs.com>"] | ||
license = "Apache-2.0" | ||
publish = false | ||
edition = "2021" | ||
|
||
[dependencies] | ||
serde.workspace = true | ||
tap.workspace = true | ||
diesel = { version = "2.1.4", features = ["postgres", "r2d2", "serde_json", "numeric"] } | ||
tokio = { workspace = true, features = ["full"] } | ||
anyhow.workspace = true | ||
futures.workspace = true | ||
async-trait.workspace = true | ||
bcs.workspace = true | ||
bin-version.workspace = true | ||
clap.workspace = true | ||
mysten-metrics.workspace = true | ||
prometheus.workspace = true | ||
serde_yaml.workspace = true | ||
sui-bridge.workspace = true | ||
sui-sdk.workspace = true | ||
sui-json-rpc-types.workspace = true | ||
sui-data-ingestion-core.workspace = true | ||
sui-types.workspace = true | ||
telemetry-subscribers.workspace = true | ||
tracing.workspace = true | ||
backoff.workspace = true | ||
sui-config.workspace = true | ||
sui-indexer-builder.workspace = true | ||
bigdecimal = "0.4.0" | ||
|
||
[dev-dependencies] | ||
sui-types = { workspace = true, features = ["test-utils"] } | ||
sui-test-transaction-builder.workspace = true | ||
test-cluster.workspace = true | ||
hex-literal = "0.3.4" | ||
|
||
[[bin]] | ||
name = "deepbook-indexer" | ||
path = "src/main.rs" |
This file contains hidden or 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,22 @@ | ||
# config.yaml format: | ||
|
||
# URL of the remote store | ||
# remote_store_url: <url> | ||
# Database connection URL | ||
# db_url: <url> | ||
# Path to the checkpoints | ||
# checkpoints_path: <path> | ||
# DeepBook package ID | ||
# deepbook_package_id: | ||
# DeepBook genesis checkpoint | ||
# deepbook_genesis_checkpoint: | ||
# Number of concurrent operations | ||
# concurrency: 1 | ||
# Client metric URL | ||
# metric_url: <url> | ||
# Client metric port | ||
# metric_port: <port> | ||
# checkpoint size of each backfill worker, use 432000 for 1 worker per day, assume 5 checkpoint per second | ||
# back_fill_lot_size: <backfill lot size> | ||
# Optional starting checkpoint for realtime ingestion task | ||
# resume_from_checkpoint: <Sui checkpoint> |
This file contains hidden or 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,9 @@ | ||
# For documentation on how to configure this file, | ||
# see https://diesel.rs/guides/configuring-diesel-cli | ||
|
||
[print_schema] | ||
file = "src/schema.rs" | ||
#custom_type_derives = ["diesel::query_builder::QueryId"] | ||
|
||
[migrations_directory] | ||
dir = "src/migrations" |
This file contains hidden or 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,27 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use serde::{Deserialize, Serialize}; | ||
use std::env; | ||
|
||
/// config as loaded from `config.yaml`. | ||
#[derive(Debug, Clone, Deserialize, Serialize)] | ||
pub struct IndexerConfig { | ||
pub remote_store_url: String, | ||
#[serde(default = "default_db_url")] | ||
pub db_url: String, | ||
pub checkpoints_path: String, | ||
pub sui_rpc_url: String, | ||
pub deepbook_package_id: String, | ||
pub deepbook_genesis_checkpoint: u64, | ||
pub concurrency: u64, | ||
pub metric_url: String, | ||
pub metric_port: u16, | ||
pub resume_from_checkpoint: Option<u64>, | ||
} | ||
|
||
impl sui_config::Config for IndexerConfig {} | ||
|
||
pub fn default_db_url() -> String { | ||
env::var("DB_URL").expect("db_url must be set in config or via the $DB_URL env var") | ||
} |
This file contains hidden or 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,131 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use serde::{Deserialize, Serialize}; | ||
use sui_types::base_types::{ObjectID, SuiAddress}; | ||
|
||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] | ||
pub struct MoveOrderFilledEvent { | ||
pub pool_id: ObjectID, | ||
pub maker_order_id: u128, | ||
pub taker_order_id: u128, | ||
pub maker_client_order_id: u64, | ||
pub taker_client_order_id: u64, | ||
pub price: u64, | ||
pub taker_is_bid: bool, | ||
pub taker_fee: u64, | ||
pub maker_fee: u64, | ||
pub base_quantity: u64, | ||
pub quote_quantity: u64, | ||
pub maker_balance_manager_id: ObjectID, | ||
pub taker_balance_manager_id: ObjectID, | ||
pub timestamp: u64, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] | ||
pub struct MoveOrderCanceledEvent { | ||
pub balance_manager_id: ObjectID, | ||
pub pool_id: ObjectID, | ||
pub order_id: u128, | ||
pub client_order_id: u64, | ||
pub trader: SuiAddress, | ||
pub price: u64, | ||
pub is_bid: bool, | ||
pub original_quantity: u64, | ||
pub base_asset_quantity_canceled: u64, | ||
pub timestamp: u64, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] | ||
pub struct MoveOrderModifiedEvent { | ||
pub balance_manager_id: ObjectID, | ||
pub pool_id: ObjectID, | ||
pub order_id: u128, | ||
pub client_order_id: u64, | ||
pub trader: SuiAddress, | ||
pub price: u64, | ||
pub is_bid: bool, | ||
pub new_quantity: u64, | ||
pub timestamp: u64, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] | ||
pub struct MoveOrderPlacedEvent { | ||
pub balance_manager_id: ObjectID, | ||
pub pool_id: ObjectID, | ||
pub order_id: u128, | ||
pub client_order_id: u64, | ||
pub trader: SuiAddress, | ||
pub price: u64, | ||
pub is_bid: bool, | ||
pub placed_quantity: u64, | ||
pub expire_timestamp: u64, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] | ||
pub struct MovePriceAddedEvent { | ||
pub conversion_rate: u64, | ||
pub timestamp: u64, | ||
pub is_base_conversion: bool, | ||
pub reference_pool: ObjectID, | ||
pub target_pool: ObjectID, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] | ||
pub struct MoveFlashLoanBorrowedEvent { | ||
pub pool_id: ObjectID, | ||
pub borrow_quantity: u64, | ||
pub type_name: String, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] | ||
pub struct MoveBalanceEvent { | ||
pub balance_manager_id: ObjectID, | ||
pub asset: String, | ||
pub amount: u64, | ||
pub deposit: bool, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] | ||
pub struct MoveTradeParamsUpdateEvent { | ||
pub taker_fee: u64, | ||
pub maker_fee: u64, | ||
pub stake_required: u64, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] | ||
pub struct MoveStakeEvent { | ||
pub pool_id: ObjectID, | ||
pub balance_manager_id: ObjectID, | ||
pub epoch: u64, | ||
pub amount: u64, | ||
pub stake: bool, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] | ||
pub struct MoveProposalEvent { | ||
pub pool_id: ObjectID, | ||
pub balance_manager_id: ObjectID, | ||
pub epoch: u64, | ||
pub taker_fee: u64, | ||
pub maker_fee: u64, | ||
pub stake_required: u64, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] | ||
pub struct MoveVoteEvent { | ||
pub pool_id: ObjectID, | ||
pub balance_manager_id: ObjectID, | ||
pub epoch: u64, | ||
pub from_proposal_id: Option<ObjectID>, | ||
pub to_proposal_id: ObjectID, | ||
pub stake: u64, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] | ||
pub struct MoveRebateEvent { | ||
pub pool_id: ObjectID, | ||
pub balance_manager_id: ObjectID, | ||
pub epoch: u64, | ||
pub claim_amount: u64, | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.