-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add athena tables for affiliates/vaults.
- Loading branch information
1 parent
fc5ff36
commit 379e90e
Showing
4 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
indexer/services/roundtable/src/lib/athena-ddl-tables/affiliate_info.ts
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,49 @@ | ||
import { | ||
getAthenaTableCreationStatement, | ||
getExternalAthenaTableCreationStatement, | ||
castToDouble, | ||
} from '../../helpers/sql'; | ||
|
||
const TABLE_NAME: string = 'affiliate_info'; | ||
const RAW_TABLE_COLUMNS: string = ` | ||
\`address\` string, | ||
\`affiliateEarnings\` string, | ||
\`referredMakerTrades\` int, | ||
\`referredTakerTrades\` int, | ||
\'totalReferredUsers\' int, | ||
\'firstReferralBlockHeight\' bigint, | ||
\'referredTotalVolume\' string, | ||
\'totalReferredTakerFees\' string, | ||
\'totalReferredMakerFees\' string, | ||
\'totalReferredMakerRebates\' string | ||
`; | ||
const TABLE_COLUMNS: string = ` | ||
"id", | ||
${castToDouble('affiliateEarnings')}, | ||
"referredMakerTrades", | ||
"referredTakerTrades", | ||
"totalReferredUsers", | ||
"firstReferralBlockHeight", | ||
${castToDouble('referredTotalVolume')}, | ||
${castToDouble('totalReferredTakerFees')}, | ||
${castToDouble('totalReferredMakerFees')}, | ||
${castToDouble('totalReferredMakerFees')}, | ||
${castToDouble('totalReferredMakerRebates')} | ||
`; | ||
|
||
export function generateRawTable(tablePrefix: string, rdsExportIdentifier: string): string { | ||
return getExternalAthenaTableCreationStatement( | ||
tablePrefix, | ||
rdsExportIdentifier, | ||
TABLE_NAME, | ||
RAW_TABLE_COLUMNS, | ||
); | ||
} | ||
|
||
export function generateTable(tablePrefix: string): string { | ||
return getAthenaTableCreationStatement( | ||
tablePrefix, | ||
TABLE_NAME, | ||
TABLE_COLUMNS, | ||
); | ||
} |
34 changes: 34 additions & 0 deletions
34
indexer/services/roundtable/src/lib/athena-ddl-tables/affiliate_referred_users.ts
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,34 @@ | ||
import { | ||
getAthenaTableCreationStatement, | ||
getExternalAthenaTableCreationStatement, | ||
castToDouble, | ||
} from '../../helpers/sql'; | ||
|
||
const TABLE_NAME: string = 'affiliate_referred_users'; | ||
const RAW_TABLE_COLUMNS: string = ` | ||
\`referredAddress\` string, | ||
\`affiliateAddress\` string, | ||
\`referredAtBlock\` bigint | ||
`; | ||
const TABLE_COLUMNS: string = ` | ||
"referredAddress", | ||
"affiliateAddress", | ||
"referredAtBlock" | ||
`; | ||
|
||
export function generateRawTable(tablePrefix: string, rdsExportIdentifier: string): string { | ||
return getExternalAthenaTableCreationStatement( | ||
tablePrefix, | ||
rdsExportIdentifier, | ||
TABLE_NAME, | ||
RAW_TABLE_COLUMNS, | ||
); | ||
} | ||
|
||
export function generateTable(tablePrefix: string): string { | ||
return getAthenaTableCreationStatement( | ||
tablePrefix, | ||
TABLE_NAME, | ||
TABLE_COLUMNS, | ||
); | ||
} |
38 changes: 38 additions & 0 deletions
38
indexer/services/roundtable/src/lib/athena-ddl-tables/vaults.ts
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,38 @@ | ||
import { | ||
castToTimestamp, | ||
getAthenaTableCreationStatement, | ||
getExternalAthenaTableCreationStatement, | ||
} from '../../helpers/sql'; | ||
|
||
const TABLE_NAME: string = 'vaults'; | ||
const RAW_TABLE_COLUMNS: string = ` | ||
\`address\` string, | ||
\`clobPairId\` bigint, | ||
\`status\` string, | ||
\'createdAt\' string, | ||
\'updatedAt\' string | ||
`; | ||
const TABLE_COLUMNS: string = ` | ||
"address", | ||
"clobPairId", | ||
"status", | ||
${castToTimestamp('createdAt')}, | ||
${castToTimestamp('updatedAt')} | ||
`; | ||
|
||
export function generateRawTable(tablePrefix: string, rdsExportIdentifier: string): string { | ||
return getExternalAthenaTableCreationStatement( | ||
tablePrefix, | ||
rdsExportIdentifier, | ||
TABLE_NAME, | ||
RAW_TABLE_COLUMNS, | ||
); | ||
} | ||
|
||
export function generateTable(tablePrefix: string): string { | ||
return getAthenaTableCreationStatement( | ||
tablePrefix, | ||
TABLE_NAME, | ||
TABLE_COLUMNS, | ||
); | ||
} |
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