Skip to content

Commit

Permalink
fix: set all timestamp to be unix seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanVerstraete committed Jan 25, 2023
1 parent fe7c94b commit 204f032
Show file tree
Hide file tree
Showing 6 changed files with 5,437 additions and 5,536 deletions.
2 changes: 1 addition & 1 deletion indexer/chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ name: tfchainindexer
description: Helm Chart for the tfchain hydra indexer
version: 2.7.6
apiVersion: v2
appVersion: '2.8.0-rc7'
appVersion: '2.8.0-rc8'
4 changes: 2 additions & 2 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "graphql_tfgrid",
"private": "true",
"version": "2.8.0-rc7",
"version": "2.8.0-rc8",
"description": "GraphQL server and Substrate indexer. Generated with ♥ by Hydra-CLI",
"author": "",
"license": "ISC",
Expand Down Expand Up @@ -41,4 +41,4 @@
"@types/node": "16.11.47",
"typescript": "4.7.4"
}
}
}
2 changes: 1 addition & 1 deletion processor-chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v2
name: tfchain-processor
description: A chart for the tfchain graphql processor and query node
version: 1.0.5
appVersion: '2.8.0-rc7'
appVersion: '2.8.0-rc8'
37 changes: 19 additions & 18 deletions src/processor.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
import { processBalancesTransfer } from './mappings/balances'
import { twinCreateOrUpdateOrDelete } from './mappings/twins'
import {
nodeUptimeReported,
nodeUptimeReported,
nodeCertificationSet, nodeDeleted, nodePublicConfigStored,
nodeStored, nodeUpdated
} from './mappings/nodes'
import { farmingPolicyStored, pricingPolicyStored, farmingPolicyUpdated } from './mappings/policies';
import {
farmDeleted, farmPayoutV2AddressRegistered,
} from './mappings/nodes'
import { farmingPolicyStored, pricingPolicyStored, farmingPolicyUpdated } from './mappings/policies';
import {
farmDeleted, farmPayoutV2AddressRegistered,
farmStored, farmUpdated, farmCertificationSet
} from './mappings/farms';
import {
import {
collectContractBillReports,
contractCreated, contractGracePeriodEnded,
contractCreated, contractGracePeriodEnded,
contractGracePeriodStarted, contractUpdateUsedResources,
nameContractCanceled, nodeContractCanceled,
nameContractCanceled, nodeContractCanceled,
contractUpdated, nruConsumptionReportReceived, rentContractCanceled
} from './mappings/contracts';
import { solutionProviderApproved, solutionProviderCreated } from './mappings/solutionProviders'
import {
serviceContractCreated, serviceContractMetadataSet,
serviceContractFeesSet, serviceContractApproved,
serviceContractCanceled, serviceContractBilled
import {
serviceContractCreated, serviceContractMetadataSet,
serviceContractFeesSet, serviceContractApproved,
serviceContractCanceled, serviceContractBilled
} from './mappings/serviceContracts';

import {
SubstrateBlock
} from "@subsquid/substrate-processor";
import { TypeormDatabase, Store } from '@subsquid/typeorm-store'
import {BatchContext, BatchProcessorItem, SubstrateBatchProcessor } from "@subsquid/substrate-processor"
import { BatchContext, BatchProcessorItem, SubstrateBatchProcessor } from "@subsquid/substrate-processor"

const eventOptions = {
data: {
Expand Down Expand Up @@ -94,10 +94,11 @@ export type Item = BatchProcessorItem<typeof processor>
export type Ctx = BatchContext<Store, Item>

async function handleEvents(ctx: Ctx, block: SubstrateBlock, item: Item) {
let timestamp = block.timestamp / 1000 // unix seconds
switch (item.name) {
// Contracts
case 'SmartContractModule.ContractCreated': return contractCreated(ctx, item, block.timestamp)
case 'SmartContractModule.ContractUpdated': return contractUpdated(ctx, item, block.timestamp)
case 'SmartContractModule.ContractCreated': return contractCreated(ctx, item, timestamp)
case 'SmartContractModule.ContractUpdated': return contractUpdated(ctx, item, timestamp)
case 'SmartContractModule.NodeContractCanceled': return nodeContractCanceled(ctx, item)
case 'SmartContractModule.NameContractCanceled': return nameContractCanceled(ctx, item)
case 'SmartContractModule.RentContractCanceled': return rentContractCanceled(ctx, item)
Expand All @@ -108,12 +109,12 @@ async function handleEvents(ctx: Ctx, block: SubstrateBlock, item: Item) {
// Farms
case 'TfgridModule.FarmStored': return farmStored(ctx, item)
case 'TfgridModule.FarmUpdated': return farmUpdated(ctx, item)
case 'TfgridModule.FarmDeleted': return farmDeleted(ctx, item)
case 'TfgridModule.FarmDeleted': return farmDeleted(ctx, item)
case 'TfgridModule.FarmPayoutV2AddressRegistered': return farmPayoutV2AddressRegistered(ctx, item)
case 'TfgridModule.FarmCertificationSet': return farmCertificationSet(ctx, item)
// Nodes
case "TfgridModule.NodeStored": return nodeStored(ctx, item, block.timestamp)
case "TfgridModule.NodeUpdated": return nodeUpdated(ctx, item, block.timestamp)
case "TfgridModule.NodeStored": return nodeStored(ctx, item, timestamp)
case "TfgridModule.NodeUpdated": return nodeUpdated(ctx, item, timestamp)
case "TfgridModule.NodeDeleted": return nodeDeleted(ctx, item)
case 'TfgridModule.NodePublicConfigStored': return nodePublicConfigStored(ctx, item)
case 'TfgridModule.NodeCertificationSet': return nodeCertificationSet(ctx, item)
Expand Down
Loading

0 comments on commit 204f032

Please sign in to comment.