Skip to content

Commit

Permalink
Merge pull request #935 from rainlanguage/2024-10-12-debug-subgraph
Browse files Browse the repository at this point in the history
debug subgraph
  • Loading branch information
thedavidmeister authored Oct 12, 2024
2 parents f2b3290 + d9b5046 commit 1021da7
Show file tree
Hide file tree
Showing 9 changed files with 818 additions and 27 deletions.
468 changes: 468 additions & 0 deletions crates/subgraph/schema/orderbook.graphql

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions crates/subgraph/src/types/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ pub enum VaultBalanceChange {
Withdrawal(Withdrawal),
TradeVaultBalanceChange(TradeVaultBalanceChange),
Deposit(Deposit),
ClearBounty(ClearBounty),
#[cynic(fallback)]
Unknown,
}
Expand Down Expand Up @@ -234,6 +235,22 @@ pub struct TradeVaultBalanceChange {
pub orderbook: Orderbook,
}

#[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
#[typeshare]
#[serde(rename_all = "camelCase")]
pub struct ClearBounty {
pub id: Bytes,
pub __typename: String,
pub amount: BigInt,
pub new_vault_balance: BigInt,
pub old_vault_balance: BigInt,
pub vault: VaultBalanceChangeVault,
pub timestamp: BigInt,
pub transaction: Transaction,
pub orderbook: Orderbook,
pub sender: Bytes,
}

#[derive(cynic::QueryFragment, Debug, Clone, Serialize)]
#[typeshare]
pub struct TradeEvent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,35 @@ query BatchOrderDetailQuery($id_list: Order_filter!) {
id
}
}
... on ClearBounty {
id
__typename
amount
newVaultBalance
oldVaultBalance
vault {
id
vaultId
token {
id
address
name
symbol
decimals
}
}
timestamp
transaction {
id
from
blockNumber
timestamp
}
orderbook {
id
}
sender
}
}
}
inputs {
Expand Down Expand Up @@ -232,6 +261,35 @@ query BatchOrderDetailQuery($id_list: Order_filter!) {
id
}
}
... on ClearBounty {
id
__typename
amount
newVaultBalance
oldVaultBalance
vault {
id
vaultId
token {
id
address
name
symbol
decimals
}
}
timestamp
transaction {
id
from
blockNumber
timestamp
}
orderbook {
id
}
sender
}
}
}
orderbook {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,35 @@ query OrderDetailQuery($id: ID!) {
id
}
}
... on ClearBounty {
id
__typename
amount
newVaultBalance
oldVaultBalance
vault {
id
vaultId
token {
id
address
name
symbol
decimals
}
}
timestamp
transaction {
id
from
blockNumber
timestamp
}
orderbook {
id
}
sender
}
}
}
inputs {
Expand Down Expand Up @@ -232,6 +261,35 @@ query OrderDetailQuery($id: ID!) {
id
}
}
... on ClearBounty {
id
__typename
amount
newVaultBalance
oldVaultBalance
vault {
id
vaultId
token {
id
address
name
symbol
decimals
}
}
timestamp
transaction {
id
from
blockNumber
timestamp
}
orderbook {
id
}
sender
}
}
}
orderbook {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,35 @@ query OrdersListQuery($first: Int, $skip: Int, $filters: Order_filter) {
id
}
}
... on ClearBounty {
id
__typename
amount
newVaultBalance
oldVaultBalance
vault {
id
vaultId
token {
id
address
name
symbol
decimals
}
}
timestamp
transaction {
id
from
blockNumber
timestamp
}
orderbook {
id
}
sender
}
}
}
inputs {
Expand Down Expand Up @@ -232,6 +261,35 @@ query OrdersListQuery($first: Int, $skip: Int, $filters: Order_filter) {
id
}
}
... on ClearBounty {
id
__typename
amount
newVaultBalance
oldVaultBalance
vault {
id
vaultId
token {
id
address
name
symbol
decimals
}
}
timestamp
transaction {
id
from
blockNumber
timestamp
}
orderbook {
id
}
sender
}
}
}
orderbook {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,35 @@ query VaultDetailQuery($id: ID!) {
id
}
}
... on ClearBounty {
id
__typename
amount
newVaultBalance
oldVaultBalance
vault {
id
vaultId
token {
id
address
name
symbol
decimals
}
}
timestamp
transaction {
id
from
blockNumber
timestamp
}
orderbook {
id
}
sender
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,35 @@ query VaultsListQuery($first: Int, $skip: Int, $filters: Vault_filter) {
id
}
}
... on ClearBounty {
id
__typename
amount
newVaultBalance
oldVaultBalance
vault {
id
vaultId
token {
id
address
name
symbol
decimals
}
}
timestamp
transaction {
id
from
blockNumber
timestamp
}
orderbook {
id
}
sender
}
}
}
}
20 changes: 20 additions & 0 deletions subgraph/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,26 @@ type TradeVaultBalanceChange implements VaultBalanceChange @entity(immutable: tr
transaction: Transaction!
}

type ClearBounty implements VaultBalanceChange @entity(immutable: true) {
id: Bytes!
"The orderbook this balance change is for"
orderbook: Orderbook!
"The msg.sender of this clear call and owner of the vault"
sender: Bytes!
"The vault that was affected"
vault: Vault!
"The amount that was changed - this is signed"
amount: BigInt!
"The balance of the vault before the change"
oldVaultBalance: BigInt!
"The balance of the vault after the change"
newVaultBalance: BigInt!
"The timestamp this balance change was executed"
timestamp: BigInt!
"The transaction in which this balance change was executed"
transaction: Transaction!
}

type Order @entity {
id: Bytes!
"The orderbook this order is in"
Expand Down
Loading

0 comments on commit 1021da7

Please sign in to comment.