Skip to content

Commit

Permalink
explorer backend update
Browse files Browse the repository at this point in the history
  • Loading branch information
Defi-Moses committed Oct 10, 2024
1 parent 6cf146a commit 451a2d7
Show file tree
Hide file tree
Showing 12 changed files with 171 additions and 96 deletions.
49 changes: 25 additions & 24 deletions services/explorer/api/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,31 @@ func TestHandleJSONDailyStat(t *testing.T) {
// nolint
valueStruct := gqlClient.GetDailyStatisticsByChain{
Response: []*struct {
Date *string "json:\"date\" graphql:\"date\""
Ethereum *float64 "json:\"ethereum\" graphql:\"ethereum\""
Optimism *float64 "json:\"optimism\" graphql:\"optimism\""
Cronos *float64 "json:\"cronos\" graphql:\"cronos\""
Bsc *float64 "json:\"bsc\" graphql:\"bsc\""
Polygon *float64 "json:\"polygon\" graphql:\"polygon\""
Fantom *float64 "json:\"fantom\" graphql:\"fantom\""
Boba *float64 "json:\"boba\" graphql:\"boba\""
Metis *float64 "json:\"metis\" graphql:\"metis\""
Moonbeam *float64 "json:\"moonbeam\" graphql:\"moonbeam\""
Moonriver *float64 "json:\"moonriver\" graphql:\"moonriver\""
Klaytn *float64 "json:\"klaytn\" graphql:\"klaytn\""
Arbitrum *float64 "json:\"arbitrum\" graphql:\"arbitrum\""
Avalanche *float64 "json:\"avalanche\" graphql:\"avalanche\""
Dfk *float64 "json:\"dfk\" graphql:\"dfk\""
Aurora *float64 "json:\"aurora\" graphql:\"aurora\""
Harmony *float64 "json:\"harmony\" graphql:\"harmony\""
Canto *float64 "json:\"canto\" graphql:\"canto\""
Dogechain *float64 "json:\"dogechain\" graphql:\"dogechain\""
Base *float64 "json:\"base\" graphql:\"base\""
Blast *float64 "json:\"blast\" graphql:\"blast\""
Scroll *float64 "json:\"scroll\" graphql:\"scroll\""
Linea *float64 "json:\"linea\" graphql:\"linea\""
Total *float64 "json:\"total\" graphql:\"total\""
Date *string "json:\"date\" graphql:\"date\""
Ethereum *float64 "json:\"ethereum\" graphql:\"ethereum\""
Optimism *float64 "json:\"optimism\" graphql:\"optimism\""
Cronos *float64 "json:\"cronos\" graphql:\"cronos\""
Bsc *float64 "json:\"bsc\" graphql:\"bsc\""
Polygon *float64 "json:\"polygon\" graphql:\"polygon\""
Fantom *float64 "json:\"fantom\" graphql:\"fantom\""
Boba *float64 "json:\"boba\" graphql:\"boba\""
Metis *float64 "json:\"metis\" graphql:\"metis\""
Moonbeam *float64 "json:\"moonbeam\" graphql:\"moonbeam\""
Moonriver *float64 "json:\"moonriver\" graphql:\"moonriver\""
Klaytn *float64 "json:\"klaytn\" graphql:\"klaytn\""
Arbitrum *float64 "json:\"arbitrum\" graphql:\"arbitrum\""
Avalanche *float64 "json:\"avalanche\" graphql:\"avalanche\""
Dfk *float64 "json:\"dfk\" graphql:\"dfk\""
Aurora *float64 "json:\"aurora\" graphql:\"aurora\""
Harmony *float64 "json:\"harmony\" graphql:\"harmony\""
Canto *float64 "json:\"canto\" graphql:\"canto\""
Dogechain *float64 "json:\"dogechain\" graphql:\"dogechain\""
Base *float64 "json:\"base\" graphql:\"base\""
Blast *float64 "json:\"blast\" graphql:\"blast\""
Scroll *float64 "json:\"scroll\" graphql:\"scroll\""
Linea *float64 "json:\"linea\" graphql:\"linea\""
Worldchain *float64 "json:\"worldchain\" graphql:\"worldchain\""
Total *float64 "json:\"total\" graphql:\"total\""
}{
{
Total: &valueFloat,
Expand Down
5 changes: 5 additions & 0 deletions services/explorer/consumer/parser/tokendata/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,5 +287,10 @@ var tokenDataMap = map[string]TokenData{
"8453_0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb": {"DAI", 18, "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb"},
"1_0xAdF7C35560035944e805D98fF17d58CDe2449389": {"SPEC", 18, "0xAdF7C35560035944e805D98fF17d58CDe2449389"},
"8453_0x96419929d7949D6A801A6909c145C8EEf6A40431": {"SPEC", 18, "0x96419929d7949D6A801A6909c145C8EEf6A40431"},
"480_0x2cFc85d8E48F8EAB294be644d9E25C3030863003": {"WLD", 18, "0x2cFc85d8E48F8EAB294be644d9E25C3030863003"},
"10_0xdC6fF44d5d932Cbd77B52E5612Ba0529DC6226F1": {"WLD", 18, "0xdC6fF44d5d932Cbd77B52E5612Ba0529DC6226F1"},
"480_0x79A02482A880bCE3F13e09Da970dC34db4CD24d1": {"USDC.e", 6, "0x79A02482A880bCE3F13e09Da970dC34db4CD24d1"},
"480_0x4200000000000000000000000000000000000006": {"WETH", 18, "0x4200000000000000000000000000000000000006"},
"1_0x163f8c2467924be0ae7b5347228cabf260318753": {"WLD", 18, "0x163f8c2467924be0ae7b5347228cabf260318753"},
// Add additional tokens that are not part of the cache yet (and not by nature in bridge config) here
}
50 changes: 26 additions & 24 deletions services/explorer/graphql/client/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions services/explorer/graphql/client/queries/queries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ query GetDailyStatisticsByChain($chainID: Int, $type: DailyStatisticType, $durat
blast
scroll
linea
worldchain
total
}
}
Expand Down
49 changes: 25 additions & 24 deletions services/explorer/graphql/server/graph/model/models_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions services/explorer/graphql/server/graph/partials.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ const dailyVolumeBridgeMvPt1 = `
results[81457] AS blast,
results[534352] AS scroll,
results[59144] AS linea,
results[480] AS worldchain,
arraySum(mapValues(results)) AS total
FROM (SELECT date, maxMap(map(chain_id, total)) AS results
FROM (SELECT coalesce(toString(b.date), toString(s.date)) AS date,
Expand Down Expand Up @@ -445,6 +446,7 @@ const dailyVolumeBridge = `
results[81457] AS blast,
results[534352] AS scroll,
results[59144] AS linea,
results[480] AS worldchain,
arraySum(mapValues(results)) AS total
FROM (SELECT date, maxMap(map(chain_id, total)) AS results
FROM (SELECT coalesce(toString(b.date), toString(s.date)) AS date,
Expand Down Expand Up @@ -541,6 +543,7 @@ SELECT date,
results[81457] AS blast,
results[534352] AS scroll,
results[59144] AS linea,
results[480] AS worldchain,
arraySum(mapValues(results)) AS total
FROM (SELECT date, maxMap(map(chain_id, total)) AS results
FROM (SELECT coalesce(toString(b.date), toString(s.date), toString(m.date)) AS date,
Expand Down Expand Up @@ -643,6 +646,7 @@ SELECT date,
results[81457] AS blast,
results[534352] AS scroll,
results[59144] AS linea,
results[480] AS worldchain,
arraySum(mapValues(results)) AS total
FROM (
SELECT date,
Expand Down Expand Up @@ -674,6 +678,7 @@ SELECT date,
results[81457] AS blast,
results[534352] AS scroll,
results[59144] AS linea,
results[480] AS worldchain,
arraySum(mapValues(results)) AS total
FROM (
SELECT date,
Expand Down Expand Up @@ -706,6 +711,7 @@ SELECT date,
results[81457] AS blast,
results[534352] AS scroll,
results[59144] AS linea,
results[480] AS worldchain,
arraySum(mapValues(results)) AS total
FROM (
SELECT date,
Expand Down
102 changes: 78 additions & 24 deletions services/explorer/graphql/server/graph/resolver/server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ type DateResultByChain {
blast: Float
scroll: Float
linea: Float
worldchain: Float
total: Float
}

Expand Down
1 change: 1 addition & 0 deletions services/explorer/static/chainIDs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
81457: 'Blast'
534352: 'Scroll'
59144: 'Linea'
480: 'Worldchain'
Loading

0 comments on commit 451a2d7

Please sign in to comment.