Skip to content

Commit

Permalink
refactor: update protocol metadata keys siblingProtocols -> linkedPro…
Browse files Browse the repository at this point in the history
…tocols (#9084)
  • Loading branch information
g1nt0ki authored Jan 19, 2025
1 parent 88f3579 commit 99a356f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions defi/src/api2/cron-task/dimensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async function run() {
Object.keys(summaries).forEach((summaryKey) => {
if (!summaries[summaryKey]?.totalAllTime) return;
if (!protocolSummaryMetadata[protocolId]) protocolSummaryMetadata[protocolId] = new Set()
protocolSummaryMetadata[protocolId].add(summaryKey)
protocolSummaryMetadata[protocolId].add(summaryKey)
})
}

Expand Down Expand Up @@ -516,7 +516,8 @@ function mergeChildRecords(protocol: any, childProtocolData: any[]) {
childProtocolData.forEach(({ records, info: childData }: any) => {

const versionKey = childData.name ?? childData.displayName ?? childData.versionKey
childData.siblingProtocols = info.childProtocols.filter((name: any) => name !== versionKey)
childData.linkedProtocols = info.childProtocols.concat([info.name])

if (!versionKey) console.log('versionKey is missing', childData)

// update child metadata and chain info
Expand Down
2 changes: 1 addition & 1 deletion defi/src/api2/routes/dimensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export async function getOverviewProcess2({
response.change_7dover7d = getPercentage(summary.total7d, summary.total14dto7d)
response.change_30dover30d = getPercentage(summary.total30d, summary.total60dto30d)

const protocolInfoKeys = ['defillamaId', 'name', 'disabled', 'displayName', 'module', 'category', 'logo', 'chains', 'protocolType', 'methodologyURL', 'methodology', 'latestFetchIsOk', 'childProtocols', 'parentProtocol', 'slug', 'siblingProtocols',]
const protocolInfoKeys = ['defillamaId', 'name', 'disabled', 'displayName', 'module', 'category', 'logo', 'chains', 'protocolType', 'methodologyURL', 'methodology', 'latestFetchIsOk', 'childProtocols', 'parentProtocol', 'slug', 'linkedProtocols',]
const protocolDataKeys = ['total24h', 'total48hto24h', 'total7d', 'total14dto7d', 'total60dto30d', 'total30d', 'total1y', 'totalAllTime', 'average1y', 'change_1d', 'change_7d', 'change_1m', 'change_7dover7d', 'change_30dover30d', 'breakdown24h', 'total14dto7d', 'total7DaysAgo', 'total30DaysAgo'] // TODO: missing breakdown24h/fix it?

response.protocols = Object.entries(protocolSummaries).map(([_id, { summaries, info }]: any) => {
Expand Down

0 comments on commit 99a356f

Please sign in to comment.