Skip to content

Commit

Permalink
Streamline swap sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Meeseeks committed Mar 17, 2024
1 parent 63f1715 commit 52aecd3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
4 changes: 1 addition & 3 deletions artifacts/graphQueries/swaps.query
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
query($minTime: BigInt, $maxTime: BigInt, $orderDir: OrderDirection) {
swaps(first: 1000, where: { time_gte: $minTime, time_lte: $maxTime },
swaps(first: 1000, where: { time_gte: $minTime, time_lte: $maxTime, block_gte: 4000000 },
orderBy: time, orderDirection: $orderDir) {
id
transactionHash
Expand All @@ -21,7 +21,5 @@ query($minTime: BigInt, $maxTime: BigInt, $orderDir: OrderDirection) {
minOut
baseFlow
quoteFlow
callSource
dex
}
}
11 changes: 0 additions & 11 deletions tables/swaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ type Swap struct {
MinOut *float64 `json:"minOut" db:"minOut"`
BaseFlow float64 `json:"baseFlow" db:"baseFlow"`
QuoteFlow float64 `json:"quoteFlow" db:"quoteFlow"`
CallSource string `json:"callSource" db:"callSource"`
Source string `json:"source" db:"source"`
Dex string `json:"dex" db:"dex"`
}

type SwapSubGraph struct {
Expand All @@ -63,8 +60,6 @@ type SwapSubGraph struct {
MinOut string `json:"minOut"`
BaseFlow string `json:"baseFlow"`
QuoteFlow string `json:"quoteFlow"`
CallSource string `json:"callSource"`
Dex string `json:"dex"`
}

type SwapSubGraphData struct {
Expand Down Expand Up @@ -106,9 +101,6 @@ func (tbl SwapsTable) ConvertSubGraphRow(r SwapSubGraph, network string) Swap {
MinOut: parseNullableFloat64(r.MinOut),
BaseFlow: *baseFlow,
QuoteFlow: *quoteFlow,
CallSource: r.CallSource,
Source: "graph",
Dex: r.Dex,
}
}

Expand Down Expand Up @@ -136,9 +128,6 @@ func (tbl SwapsTable) ReadSqlRow(rows *sql.Rows) Swap {
&swap.MinOut,
&swap.BaseFlow,
&swap.QuoteFlow,
&swap.CallSource,
&swap.Source,
&swap.Dex,
)
if err != nil {
log.Fatal(err.Error())
Expand Down

0 comments on commit 52aecd3

Please sign in to comment.