Skip to content

Commit 980dd11

Browse files
authored
apply contract type changes (#152)
* apply contract type changes * remove db migration * remove debug logs * fmt: use standard indentation for events.ts
1 parent 4990fb7 commit 980dd11

8 files changed

Lines changed: 2386 additions & 1945 deletions

File tree

indexer/chart/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: tfchainindexer
22
description: Helm Chart for the tfchain hydra indexer
3-
version: 2.7.7
3+
version: 2.7.8
44
apiVersion: v2
55
appVersion: '2.11.5'

indexer/chart/templates/indexer-config.yaml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ data:
478478
"pricingPolicyId": "u32",
479479
"certification": "FarmCertification",
480480
"publicIps": "Vec<PublicIP>",
481-
"dedicatedFarm:": "bool",
481+
"dedicatedFarm": "bool",
482482
"farmingPolicyLimits": "Option<FarmingPolicyLimit>"
483483
},
484484
"FarmingPolicyLimit": {
@@ -679,6 +679,36 @@ data:
679679
]
680680
}
681681
}
682+
},
683+
{
684+
"minmax": [
685+
147,
686+
147
687+
],
688+
"types": {
689+
"Cause": {
690+
"_enum": [
691+
"CanceledByCollective",
692+
"CanceledByUser",
693+
"OutOfFunds"
694+
]
695+
}
696+
}
697+
},
698+
{
699+
"minmax": [
700+
148,
701+
null
702+
],
703+
"types": {
704+
"Cause": {
705+
"_enum": [
706+
"CanceledByUser",
707+
"OutOfFunds",
708+
"CanceledByCollective"
709+
]
710+
}
711+
}
682712
}
683713
]
684714
}

indexer/typesBundle.json

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@
475475
"pricingPolicyId": "u32",
476476
"certification": "FarmCertification",
477477
"publicIps": "Vec<PublicIP>",
478-
"dedicatedFarm:": "bool",
478+
"dedicatedFarm": "bool",
479479
"farmingPolicyLimits": "Option<FarmingPolicyLimit>"
480480
},
481481
"FarmingPolicyLimit": {
@@ -676,6 +676,36 @@
676676
]
677677
}
678678
}
679+
},
680+
{
681+
"minmax": [
682+
147,
683+
147
684+
],
685+
"types": {
686+
"Cause": {
687+
"_enum": [
688+
"CanceledByCollective",
689+
"CanceledByUser",
690+
"OutOfFunds"
691+
]
692+
}
693+
}
694+
},
695+
{
696+
"minmax": [
697+
148,
698+
null
699+
],
700+
"types": {
701+
"Cause": {
702+
"_enum": [
703+
"CanceledByUser",
704+
"OutOfFunds",
705+
"CanceledByCollective"
706+
]
707+
}
708+
}
679709
}
680710
]
681711
}

src/mappings/contracts.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,16 @@ export async function contractCreated(
3737
contractEvent = contractCreatedEvent.asV101
3838
} else if (contractCreatedEvent.isV105) {
3939
contractEvent = contractCreatedEvent.asV105
40+
} else if (contractCreatedEvent.isV147) {
41+
contractEvent = contractCreatedEvent.asV147
42+
} else if (contractCreatedEvent.isV148) {
43+
contractEvent = contractCreatedEvent.asV148
4044
}
4145

42-
if (!contractEvent) return
46+
if (!contractEvent) {
47+
ctx.log.error(`found contract with unknown version! make sure types are updated`);
48+
return
49+
}
4350

4451
let state = ContractState.Created
4552

@@ -152,9 +159,18 @@ export async function contractUpdated(
152159
contractEvent = contractUpdatedEvent.asV59
153160
} else if (contractUpdatedEvent.isV101) {
154161
contractEvent = contractUpdatedEvent.asV101
162+
} else if (contractUpdatedEvent.isV105) {
163+
contractEvent = contractUpdatedEvent.asV105
164+
} else if (contractUpdatedEvent.isV147) {
165+
contractEvent = contractUpdatedEvent.asV147
166+
} else if (contractUpdatedEvent.isV148) {
167+
contractEvent = contractUpdatedEvent.asV148
155168
}
156169

157-
if (!contractEvent) return
170+
if (!contractEvent) {
171+
ctx.log.error(`found contract with unknown version! make sure types are updated`);
172+
return
173+
}
158174

159175
const SavedNodeContract = await ctx.store.get(NodeContract, { where: { contractID: contractEvent.contractId } })
160176
if (SavedNodeContract) {

0 commit comments

Comments
 (0)